code
stringlengths
3
10M
language
stringclasses
31 values
/Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/HandyJSON.build/Objects-normal/x86_64/PropertyInfo.o : /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Metadata.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/CBridge.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Transformable.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Measuable.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/MangledName.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ExtendCustomBasicType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/BuiltInBasicType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/BuiltInBridgeType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ExtendCustomModelType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/TransformType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/EnumType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/PointerType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ContextDescriptorType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/TransformOf.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/URLTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DataTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DateTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ISO8601DateTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/EnumTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/NSDecimalNumberTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DateFormatterTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HexColorTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/CustomDateFormatTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/OtherExtension.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Configuration.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/PropertyInfo.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Logger.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ReflectionHelper.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HelpingMapper.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Serializer.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Deserializer.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/FieldDescriptor.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Properties.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/AnyExtensions.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Export.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HandyJSON.h /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/Target\ Support\ Files/HandyJSON/HandyJSON-umbrella.h /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/HandyJSON.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/HandyJSON.build/Objects-normal/x86_64/PropertyInfo~partial.swiftmodule : /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Metadata.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/CBridge.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Transformable.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Measuable.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/MangledName.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ExtendCustomBasicType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/BuiltInBasicType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/BuiltInBridgeType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ExtendCustomModelType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/TransformType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/EnumType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/PointerType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ContextDescriptorType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/TransformOf.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/URLTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DataTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DateTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ISO8601DateTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/EnumTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/NSDecimalNumberTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DateFormatterTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HexColorTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/CustomDateFormatTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/OtherExtension.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Configuration.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/PropertyInfo.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Logger.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ReflectionHelper.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HelpingMapper.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Serializer.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Deserializer.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/FieldDescriptor.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Properties.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/AnyExtensions.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Export.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HandyJSON.h /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/Target\ Support\ Files/HandyJSON/HandyJSON-umbrella.h /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/HandyJSON.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/HandyJSON.build/Objects-normal/x86_64/PropertyInfo~partial.swiftdoc : /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Metadata.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/CBridge.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Transformable.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Measuable.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/MangledName.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ExtendCustomBasicType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/BuiltInBasicType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/BuiltInBridgeType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ExtendCustomModelType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/TransformType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/EnumType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/PointerType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ContextDescriptorType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/TransformOf.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/URLTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DataTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DateTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ISO8601DateTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/EnumTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/NSDecimalNumberTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DateFormatterTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HexColorTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/CustomDateFormatTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/OtherExtension.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Configuration.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/PropertyInfo.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Logger.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ReflectionHelper.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HelpingMapper.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Serializer.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Deserializer.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/FieldDescriptor.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Properties.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/AnyExtensions.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Export.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HandyJSON.h /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/Target\ Support\ Files/HandyJSON/HandyJSON-umbrella.h /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/HandyJSON.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/HandyJSON.build/Objects-normal/x86_64/PropertyInfo~partial.swiftsourceinfo : /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Metadata.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/CBridge.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Transformable.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Measuable.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/MangledName.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ExtendCustomBasicType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/BuiltInBasicType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/BuiltInBridgeType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ExtendCustomModelType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/TransformType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/EnumType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/PointerType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ContextDescriptorType.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/TransformOf.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/URLTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DataTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DateTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ISO8601DateTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/EnumTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/NSDecimalNumberTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/DateFormatterTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HexColorTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/CustomDateFormatTransform.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/OtherExtension.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Configuration.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/PropertyInfo.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Logger.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/ReflectionHelper.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HelpingMapper.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Serializer.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Deserializer.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/FieldDescriptor.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Properties.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/AnyExtensions.swift /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/Export.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/HandyJSON/Source/HandyJSON.h /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Pods/Target\ Support\ Files/HandyJSON/HandyJSON-umbrella.h /Users/GuoYanjun/Desktop/TestDemo/WanAndroid_IOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/HandyJSON.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
lucky in making unexpected and fortunate discoveries
D
/Users/kando/Desktop/nri/xctesting/Build/Intermediates/xctesting.build/Debug-iphonesimulator/xctesting.build/Objects-normal/x86_64/ViewController.o : /Users/kando/Desktop/nri/xctesting/xctesting/ViewController.swift /Users/kando/Desktop/nri/xctesting/xctesting/AppDelegate.swift /Users/kando/Desktop/nri/xctesting/xctesting/User.swift /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/kando/Desktop/nri/xctesting/Build/Intermediates/xctesting.build/Debug-iphonesimulator/xctesting.build/Objects-normal/x86_64/ViewController~partial.swiftmodule : /Users/kando/Desktop/nri/xctesting/xctesting/ViewController.swift /Users/kando/Desktop/nri/xctesting/xctesting/AppDelegate.swift /Users/kando/Desktop/nri/xctesting/xctesting/User.swift /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/kando/Desktop/nri/xctesting/Build/Intermediates/xctesting.build/Debug-iphonesimulator/xctesting.build/Objects-normal/x86_64/ViewController~partial.swiftdoc : /Users/kando/Desktop/nri/xctesting/xctesting/ViewController.swift /Users/kando/Desktop/nri/xctesting/xctesting/AppDelegate.swift /Users/kando/Desktop/nri/xctesting/xctesting/User.swift /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule
D
module perfontain.misc.draw; import core.stdc.stdlib, perfontain, perfontain.opengl; final class DrawAllocator : RCounted { this(ubyte type) { iv = new IndexVertex(type); } void draw(Program pg, in DrawInfo[] nodes, uint submeshes) { _drawnNodes = cast(uint)nodes.length; _drawnTriangles = 0; pg.bind; iv.bind; if(GL_ARB_shader_draw_parameters) { uint k; auto counts = cast(uint *)alloca(submeshes * 4); auto starts = cast(size_t *)alloca(submeshes * size_t.sizeof); foreach(ref n; nodes) { auto mh = n.mh; auto reg = mh.reg; auto off = reg.index.start; auto subs = mh.meshes[n.id].subs; assert(GL_ARB_bindless_texture || subs.length == 1); foreach(ref sm; subs) { counts[k] = sm.len; starts[k++] = off + sm.start * 4; _drawnTriangles += sm.len / 3; } } assert(k == submeshes); glMultiDrawElements(GL_TRIANGLES, counts, GL_UNSIGNED_INT, cast(void **)starts, submeshes); } else { foreach(uint i, ref n; nodes) { pg.send(`pe_object_id`, i); auto mh = n.mh; auto sm = mh.meshes[n.id].subs.ptr; _drawnTriangles += sm.len / 3; glDrawElements(GL_TRIANGLES, sm.len, GL_UNSIGNED_INT, cast(void *)(mh.reg.index.start + sm.start * 4)); } } } RC!IndexVertex iv; private: mixin publicProperty!(uint, `drawnNodes`); mixin publicProperty!(uint, `drawnTriangles`); }
D
module godot.audioeffectdistortion; import std.meta : AliasSeq, staticIndexOf; import std.traits : Unqual; import godot.d.meta; import godot.core; import godot.c; import godot.object; import godot.classdb; import godot.audioeffect; @GodotBaseClass struct AudioEffectDistortion { static immutable string _GODOT_internal_name = "AudioEffectDistortion"; public: union { godot_object _godot_object; AudioEffect base; } alias base this; alias BaseClasses = AliasSeq!(typeof(base), typeof(base).BaseClasses); package(godot) void* opCast(T : void*)() const { return cast(void*)_godot_object.ptr; } godot_object opCast(T : godot_object)() const { return cast(godot_object)_godot_object; } bool opEquals(in AudioEffectDistortion other) const { return _godot_object.ptr is other._godot_object.ptr; } AudioEffectDistortion opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } bool opCast(T : bool)() const { return _godot_object.ptr !is null; } inout(T) opCast(T)() inout if(isGodotBaseClass!T) { static assert(staticIndexOf!(AudioEffectDistortion, T.BaseClasses) != -1, "Godot class "~T.stringof~" does not inherit AudioEffectDistortion"); if(_godot_object.ptr is null) return T.init; String c = String(T._GODOT_internal_name); if(is_class(c)) return inout(T)(_godot_object); return T.init; } inout(T) opCast(T)() inout if(extendsGodotBaseClass!T) { static assert(is(typeof(T.owner) : AudioEffectDistortion) || staticIndexOf!(AudioEffectDistortion, typeof(T.owner).BaseClasses) != -1, "D class "~T.stringof~" does not extend AudioEffectDistortion"); if(_godot_object.ptr is null) return null; if(has_method(String(`_GDNATIVE_D_typeid`))) { Object o = cast(Object)godot_nativescript_get_userdata(opCast!godot_object); return cast(inout(T))o; } return null; } static AudioEffectDistortion _new() { static godot_class_constructor constructor; if(constructor is null) constructor = godot_get_class_constructor("AudioEffectDistortion"); if(constructor is null) return typeof(this).init; return cast(AudioEffectDistortion)(constructor()); } void set_mode(in int mode) { static godot_method_bind* mb = null; if(mb is null) mb = godot_method_bind_get_method("AudioEffectDistortion", "set_mode"); const(void*)[1] _GODOT_args = [cast(void*)(&mode), ]; godot_method_bind_ptrcall(mb, cast(godot_object)(this), _GODOT_args.ptr); } int get_mode() const { static godot_method_bind* mb = null; if(mb is null) mb = godot_method_bind_get_method("AudioEffectDistortion", "get_mode"); int _GODOT_ret = int.init; godot_method_bind_ptrcall(mb, cast(godot_object)(this), null, cast(void*)&_GODOT_ret); return _GODOT_ret; } void set_pre_gain(in float pre_gain) { static godot_method_bind* mb = null; if(mb is null) mb = godot_method_bind_get_method("AudioEffectDistortion", "set_pre_gain"); const(void*)[1] _GODOT_args = [cast(void*)(&pre_gain), ]; godot_method_bind_ptrcall(mb, cast(godot_object)(this), _GODOT_args.ptr); } float get_pre_gain() const { static godot_method_bind* mb = null; if(mb is null) mb = godot_method_bind_get_method("AudioEffectDistortion", "get_pre_gain"); float _GODOT_ret = float.init; godot_method_bind_ptrcall(mb, cast(godot_object)(this), null, cast(void*)&_GODOT_ret); return _GODOT_ret; } void set_keep_hf_hz(in float keep_hf_hz) { static godot_method_bind* mb = null; if(mb is null) mb = godot_method_bind_get_method("AudioEffectDistortion", "set_keep_hf_hz"); const(void*)[1] _GODOT_args = [cast(void*)(&keep_hf_hz), ]; godot_method_bind_ptrcall(mb, cast(godot_object)(this), _GODOT_args.ptr); } float get_keep_hf_hz() const { static godot_method_bind* mb = null; if(mb is null) mb = godot_method_bind_get_method("AudioEffectDistortion", "get_keep_hf_hz"); float _GODOT_ret = float.init; godot_method_bind_ptrcall(mb, cast(godot_object)(this), null, cast(void*)&_GODOT_ret); return _GODOT_ret; } void set_drive(in float drive) { static godot_method_bind* mb = null; if(mb is null) mb = godot_method_bind_get_method("AudioEffectDistortion", "set_drive"); const(void*)[1] _GODOT_args = [cast(void*)(&drive), ]; godot_method_bind_ptrcall(mb, cast(godot_object)(this), _GODOT_args.ptr); } float get_drive() const { static godot_method_bind* mb = null; if(mb is null) mb = godot_method_bind_get_method("AudioEffectDistortion", "get_drive"); float _GODOT_ret = float.init; godot_method_bind_ptrcall(mb, cast(godot_object)(this), null, cast(void*)&_GODOT_ret); return _GODOT_ret; } void set_post_gain(in float post_gain) { static godot_method_bind* mb = null; if(mb is null) mb = godot_method_bind_get_method("AudioEffectDistortion", "set_post_gain"); const(void*)[1] _GODOT_args = [cast(void*)(&post_gain), ]; godot_method_bind_ptrcall(mb, cast(godot_object)(this), _GODOT_args.ptr); } float get_post_gain() const { static godot_method_bind* mb = null; if(mb is null) mb = godot_method_bind_get_method("AudioEffectDistortion", "get_post_gain"); float _GODOT_ret = float.init; godot_method_bind_ptrcall(mb, cast(godot_object)(this), null, cast(void*)&_GODOT_ret); return _GODOT_ret; } }
D
// Written in the D programming language. /** This is a submodule of $(MREF std, algorithm). It contains generic _searching algorithms. $(SCRIPT inhibitQuickIndex = 1;) $(BOOKTABLE Cheat Sheet, $(TR $(TH Function Name) $(TH Description)) $(T2 all, $(D all!"a > 0"([1, 2, 3, 4])) returns $(D true) because all elements are positive) $(T2 any, $(D any!"a > 0"([1, 2, -3, -4])) returns $(D true) because at least one element is positive) $(T2 balancedParens, $(D balancedParens("((1 + 1) / 2)")) returns $(D true) because the string has balanced parentheses.) $(T2 boyerMooreFinder, $(D find("hello world", boyerMooreFinder("or"))) returns $(D "orld") using the $(LINK2 https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm, Boyer-Moore _algorithm).) $(T2 canFind, $(D canFind("hello world", "or")) returns $(D true).) $(T2 count, Counts elements that are equal to a specified value or satisfy a predicate. $(D count([1, 2, 1], 1)) returns $(D 2) and $(D count!"a < 0"([1, -3, 0])) returns $(D 1).) $(T2 countUntil, $(D countUntil(a, b)) returns the number of steps taken in $(D a) to reach $(D b); for example, $(D countUntil("hello!", "o")) returns $(D 4).) $(T2 commonPrefix, $(D commonPrefix("parakeet", "parachute")) returns $(D "para").) $(T2 endsWith, $(D endsWith("rocks", "ks")) returns $(D true).) $(T2 find, $(D find("hello world", "or")) returns $(D "orld") using linear search. (For binary search refer to $(REF sortedRange, std,range).)) $(T2 findAdjacent, $(D findAdjacent([1, 2, 3, 3, 4])) returns the subrange starting with two equal adjacent elements, i.e. $(D [3, 3, 4]).) $(T2 findAmong, $(D findAmong("abcd", "qcx")) returns $(D "cd") because $(D 'c') is among $(D "qcx").) $(T2 findSkip, If $(D a = "abcde"), then $(D findSkip(a, "x")) returns $(D false) and leaves $(D a) unchanged, whereas $(D findSkip(a, "c")) advances $(D a) to $(D "de") and returns $(D true).) $(T2 findSplit, $(D findSplit("abcdefg", "de")) returns the three ranges $(D "abc"), $(D "de"), and $(D "fg").) $(T2 findSplitAfter, $(D findSplitAfter("abcdefg", "de")) returns the two ranges $(D "abcde") and $(D "fg").) $(T2 findSplitBefore, $(D findSplitBefore("abcdefg", "de")) returns the two ranges $(D "abc") and $(D "defg").) $(T2 minCount, $(D minCount([2, 1, 1, 4, 1])) returns $(D tuple(1, 3)).) $(T2 maxCount, $(D maxCount([2, 4, 1, 4, 1])) returns $(D tuple(4, 2)).) $(T2 minElement, Selects the minimal element of a range. `minElement([3, 4, 1, 2])` returns `1`.) $(T2 maxElement, Selects the maximal element of a range. `maxElement([3, 4, 1, 2])` returns `4`.) $(T2 minIndex, Index of the minimal element of a range. `minElement([3, 4, 1, 2])` returns `2`.) $(T2 maxIndex, Index of the maximal element of a range. `maxElement([3, 4, 1, 2])` returns `1`.) $(T2 minPos, $(D minPos([2, 3, 1, 3, 4, 1])) returns the subrange $(D [1, 3, 4, 1]), i.e., positions the range at the first occurrence of its minimal element.) $(T2 maxPos, $(D maxPos([2, 3, 1, 3, 4, 1])) returns the subrange $(D [4, 1]), i.e., positions the range at the first occurrence of its maximal element.) $(T2 mismatch, $(D mismatch("parakeet", "parachute")) returns the two ranges $(D "keet") and $(D "chute").) $(T2 skipOver, Assume $(D a = "blah"). Then $(D skipOver(a, "bi")) leaves $(D a) unchanged and returns $(D false), whereas $(D skipOver(a, "bl")) advances $(D a) to refer to $(D "ah") and returns $(D true).) $(T2 startsWith, $(D startsWith("hello, world", "hello")) returns $(D true).) $(T2 until, Lazily iterates a range until a specific value is found.) ) Copyright: Andrei Alexandrescu 2008-. License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0). Authors: $(HTTP erdani.com, Andrei Alexandrescu) Source: $(PHOBOSSRC std/algorithm/_searching.d) Macros: T2=$(TR $(TDNW $(LREF $1)) $(TD $+)) */ module std.algorithm.searching; // FIXME import std.functional; // : unaryFun, binaryFun; import std.range.primitives; import std.traits; // FIXME import std.typecons; // : Tuple, Flag, Yes, No; /++ Checks if $(I _all) of the elements verify $(D pred). +/ template all(alias pred = "a") { /++ Returns $(D true) if and only if $(I _all) values $(D v) found in the input _range $(D range) satisfy the predicate $(D pred). Performs (at most) $(BIGOH range.length) evaluations of $(D pred). +/ bool all(Range)(Range range) if (isInputRange!Range && is(typeof(unaryFun!pred(range.front)))) { import std.functional : not; return find!(not!(unaryFun!pred))(range).empty; } } /// @safe unittest { assert( all!"a & 1"([1, 3, 5, 7, 9])); assert(!all!"a & 1"([1, 2, 3, 5, 7, 9])); } /++ $(D all) can also be used without a predicate, if its items can be evaluated to true or false in a conditional statement. This can be a convenient way to quickly evaluate that $(I _all) of the elements of a range are true. +/ @safe unittest { int[3] vals = [5, 3, 18]; assert( all(vals[])); } @safe unittest { int x = 1; assert(all!(a => a > x)([2, 3])); } /++ Checks if $(I _any) of the elements verifies $(D pred). $(D !any) can be used to verify that $(I none) of the elements verify $(D pred). This is sometimes called `exists` in other languages. +/ template any(alias pred = "a") { /++ Returns $(D true) if and only if $(I _any) value $(D v) found in the input _range $(D range) satisfies the predicate $(D pred). Performs (at most) $(BIGOH range.length) evaluations of $(D pred). +/ bool any(Range)(Range range) if (isInputRange!Range && is(typeof(unaryFun!pred(range.front)))) { return !find!pred(range).empty; } } /// @safe unittest { import std.ascii : isWhite; assert( all!(any!isWhite)(["a a", "b b"])); assert(!any!(all!isWhite)(["a a", "b b"])); } /++ $(D any) can also be used without a predicate, if its items can be evaluated to true or false in a conditional statement. $(D !any) can be a convenient way to quickly test that $(I none) of the elements of a range evaluate to true. +/ @safe unittest { int[3] vals1 = [0, 0, 0]; assert(!any(vals1[])); //none of vals1 evaluate to true int[3] vals2 = [2, 0, 2]; assert( any(vals2[])); assert(!all(vals2[])); int[3] vals3 = [3, 3, 3]; assert( any(vals3[])); assert( all(vals3[])); } @safe unittest { auto a = [ 1, 2, 0, 4 ]; assert(any!"a == 2"(a)); } // balancedParens /** Checks whether $(D r) has "balanced parentheses", i.e. all instances of $(D lPar) are closed by corresponding instances of $(D rPar). The parameter $(D maxNestingLevel) controls the nesting level allowed. The most common uses are the default or $(D 0). In the latter case, no nesting is allowed. Params: r = The range to check. lPar = The element corresponding with a left (opening) parenthesis. rPar = The element corresponding with a right (closing) parenthesis. maxNestingLevel = The maximum allowed nesting level. Returns: true if the given range has balanced parenthesis within the given maximum nesting level; false otherwise. */ bool balancedParens(Range, E)(Range r, E lPar, E rPar, size_t maxNestingLevel = size_t.max) if (isInputRange!(Range) && is(typeof(r.front == lPar))) { size_t count; for (; !r.empty; r.popFront()) { if (r.front == lPar) { if (count > maxNestingLevel) return false; ++count; } else if (r.front == rPar) { if (!count) return false; --count; } } return count == 0; } /// @safe unittest { auto s = "1 + (2 * (3 + 1 / 2)"; assert(!balancedParens(s, '(', ')')); s = "1 + (2 * (3 + 1) / 2)"; assert(balancedParens(s, '(', ')')); s = "1 + (2 * (3 + 1) / 2)"; assert(!balancedParens(s, '(', ')', 0)); s = "1 + (2 * 3 + 1) / (2 - 5)"; assert(balancedParens(s, '(', ')', 0)); } /** * Sets up Boyer-Moore matching for use with $(D find) below. * By default, elements are compared for equality. * * $(D BoyerMooreFinder) allocates GC memory. * * Params: * pred = Predicate used to compare elements. * needle = A random-access range with length and slicing. * * Returns: * An instance of $(D BoyerMooreFinder) that can be used with $(D find()) to * invoke the Boyer-Moore matching algorithm for finding of $(D needle) in a * given haystack. */ struct BoyerMooreFinder(alias pred, Range) { private: size_t[] skip; // GC allocated ptrdiff_t[ElementType!(Range)] occ; // GC allocated Range needle; ptrdiff_t occurrence(ElementType!(Range) c) { auto p = c in occ; return p ? *p : -1; } /* This helper function checks whether the last "portion" bytes of "needle" (which is "nlen" bytes long) exist within the "needle" at offset "offset" (counted from the end of the string), and whether the character preceding "offset" is not a match. Notice that the range being checked may reach beyond the beginning of the string. Such range is ignored. */ static bool needlematch(R)(R needle, size_t portion, size_t offset) { import std.algorithm.comparison : equal; ptrdiff_t virtual_begin = needle.length - offset - portion; ptrdiff_t ignore = 0; if (virtual_begin < 0) { ignore = -virtual_begin; virtual_begin = 0; } if (virtual_begin > 0 && needle[virtual_begin - 1] == needle[$ - portion - 1]) return 0; immutable delta = portion - ignore; return equal(needle[needle.length - delta .. needle.length], needle[virtual_begin .. virtual_begin + delta]); } public: /// this(Range needle) { if (!needle.length) return; this.needle = needle; /* Populate table with the analysis of the needle */ /* But ignoring the last letter */ foreach (i, n ; needle[0 .. $ - 1]) { this.occ[n] = i; } /* Preprocess #2: init skip[] */ /* Note: This step could be made a lot faster. * A simple implementation is shown here. */ this.skip = new size_t[needle.length]; foreach (a; 0 .. needle.length) { size_t value = 0; while (value < needle.length && !needlematch(needle, a, value)) { ++value; } this.skip[needle.length - a - 1] = value; } } /// Range beFound(Range haystack) { import std.algorithm.comparison : max; if (!needle.length) return haystack; if (needle.length > haystack.length) return haystack[$ .. $]; /* Search: */ immutable limit = haystack.length - needle.length; for (size_t hpos = 0; hpos <= limit; ) { size_t npos = needle.length - 1; while (pred(needle[npos], haystack[npos+hpos])) { if (npos == 0) return haystack[hpos .. $]; --npos; } hpos += max(skip[npos], cast(sizediff_t) npos - occurrence(haystack[npos+hpos])); } return haystack[$ .. $]; } /// @property size_t length() { return needle.length; } /// alias opDollar = length; } /// Ditto BoyerMooreFinder!(binaryFun!(pred), Range) boyerMooreFinder (alias pred = "a == b", Range) (Range needle) if ((isRandomAccessRange!(Range) && hasSlicing!Range) || isSomeString!Range) { return typeof(return)(needle); } /// @safe pure nothrow unittest { auto bmFinder = boyerMooreFinder("TG"); string r = "TAGTGCCTGA"; // search for the first match in the haystack r r = bmFinder.beFound(r); assert(r == "TGCCTGA"); // continue search in haystack r = bmFinder.beFound(r[2 .. $]); assert(r == "TGA"); } /** Returns the common prefix of two ranges. Params: pred = The predicate to use in comparing elements for commonality. Defaults to equality $(D "a == b"). r1 = A $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) of elements. r2 = An $(REF_ALTTEXT input range, isInputRange, std,range,primitives) of elements. Returns: A slice of $(D r1) which contains the characters that both ranges start with, if the first argument is a string; otherwise, the same as the result of $(D takeExactly(r1, n)), where $(D n) is the number of elements in the common prefix of both ranges. See_Also: $(REF takeExactly, std,range) */ auto commonPrefix(alias pred = "a == b", R1, R2)(R1 r1, R2 r2) if (isForwardRange!R1 && isInputRange!R2 && !isNarrowString!R1 && is(typeof(binaryFun!pred(r1.front, r2.front)))) { import std.algorithm.comparison : min; static if (isRandomAccessRange!R1 && isRandomAccessRange!R2 && hasLength!R1 && hasLength!R2 && hasSlicing!R1) { immutable limit = min(r1.length, r2.length); foreach (i; 0 .. limit) { if (!binaryFun!pred(r1[i], r2[i])) { return r1[0 .. i]; } } return r1[0 .. limit]; } else { import std.range : takeExactly; auto result = r1.save; size_t i = 0; for (; !r1.empty && !r2.empty && binaryFun!pred(r1.front, r2.front); ++i, r1.popFront(), r2.popFront()) {} return takeExactly(result, i); } } /// @safe unittest { assert(commonPrefix("hello, world", "hello, there") == "hello, "); } /// ditto auto commonPrefix(alias pred, R1, R2)(R1 r1, R2 r2) if (isNarrowString!R1 && isInputRange!R2 && is(typeof(binaryFun!pred(r1.front, r2.front)))) { import std.utf : decode; auto result = r1.save; immutable len = r1.length; size_t i = 0; for (size_t j = 0; i < len && !r2.empty; r2.popFront(), i = j) { immutable f = decode(r1, j); if (!binaryFun!pred(f, r2.front)) break; } return result[0 .. i]; } /// ditto auto commonPrefix(R1, R2)(R1 r1, R2 r2) if (isNarrowString!R1 && isInputRange!R2 && !isNarrowString!R2 && is(typeof(r1.front == r2.front))) { return commonPrefix!"a == b"(r1, r2); } /// ditto auto commonPrefix(R1, R2)(R1 r1, R2 r2) if (isNarrowString!R1 && isNarrowString!R2) { import std.algorithm.comparison : min; static if (ElementEncodingType!R1.sizeof == ElementEncodingType!R2.sizeof) { import std.utf : stride, UTFException; immutable limit = min(r1.length, r2.length); for (size_t i = 0; i < limit;) { immutable codeLen = stride(r1, i); size_t j = 0; for (; j < codeLen && i < limit; ++i, ++j) { if (r1[i] != r2[i]) return r1[0 .. i - j]; } if (i == limit && j < codeLen) throw new UTFException("Invalid UTF-8 sequence", i); } return r1[0 .. limit]; } else return commonPrefix!"a == b"(r1, r2); } @safe unittest { import std.algorithm.comparison : equal; import std.algorithm.iteration : filter; import std.conv : to; import std.exception : assertThrown; import std.meta : AliasSeq; import std.range; import std.utf : UTFException; assert(commonPrefix([1, 2, 3], [1, 2, 3, 4, 5]) == [1, 2, 3]); assert(commonPrefix([1, 2, 3, 4, 5], [1, 2, 3]) == [1, 2, 3]); assert(commonPrefix([1, 2, 3, 4], [1, 2, 3, 4]) == [1, 2, 3, 4]); assert(commonPrefix([1, 2, 3], [7, 2, 3, 4, 5]).empty); assert(commonPrefix([7, 2, 3, 4, 5], [1, 2, 3]).empty); assert(commonPrefix([1, 2, 3], cast(int[]) null).empty); assert(commonPrefix(cast(int[]) null, [1, 2, 3]).empty); assert(commonPrefix(cast(int[]) null, cast(int[]) null).empty); foreach (S; AliasSeq!(char[], const(char)[], string, wchar[], const(wchar)[], wstring, dchar[], const(dchar)[], dstring)) { foreach (T; AliasSeq!(string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 assert(commonPrefix(to!S(""), to!T("")).empty); assert(commonPrefix(to!S(""), to!T("hello")).empty); assert(commonPrefix(to!S("hello"), to!T("")).empty); assert(commonPrefix(to!S("hello, world"), to!T("hello, there")) == to!S("hello, ")); assert(commonPrefix(to!S("hello, there"), to!T("hello, world")) == to!S("hello, ")); assert(commonPrefix(to!S("hello, "), to!T("hello, world")) == to!S("hello, ")); assert(commonPrefix(to!S("hello, world"), to!T("hello, ")) == to!S("hello, ")); assert(commonPrefix(to!S("hello, world"), to!T("hello, world")) == to!S("hello, world")); //Bug# 8890 assert(commonPrefix(to!S("Пиво"), to!T("Пони"))== to!S("П")); assert(commonPrefix(to!S("Пони"), to!T("Пиво"))== to!S("П")); assert(commonPrefix(to!S("Пиво"), to!T("Пиво"))== to!S("Пиво")); assert(commonPrefix(to!S("\U0010FFFF\U0010FFFB\U0010FFFE"), to!T("\U0010FFFF\U0010FFFB\U0010FFFC")) == to!S("\U0010FFFF\U0010FFFB")); assert(commonPrefix(to!S("\U0010FFFF\U0010FFFB\U0010FFFC"), to!T("\U0010FFFF\U0010FFFB\U0010FFFE")) == to!S("\U0010FFFF\U0010FFFB")); assert(commonPrefix!"a != b"(to!S("Пиво"), to!T("онво")) == to!S("Пи")); assert(commonPrefix!"a != b"(to!S("онво"), to!T("Пиво")) == to!S("он")); }(); static assert(is(typeof(commonPrefix(to!S("Пиво"), filter!"true"("Пони"))) == S)); assert(equal(commonPrefix(to!S("Пиво"), filter!"true"("Пони")), to!S("П"))); static assert(is(typeof(commonPrefix(filter!"true"("Пиво"), to!S("Пони"))) == typeof(takeExactly(filter!"true"("П"), 1)))); assert(equal(commonPrefix(filter!"true"("Пиво"), to!S("Пони")), takeExactly(filter!"true"("П"), 1))); } assertThrown!UTFException(commonPrefix("\U0010FFFF\U0010FFFB", "\U0010FFFF\U0010FFFB"[0 .. $ - 1])); assert(commonPrefix("12345"d, [49, 50, 51, 60, 60]) == "123"d); assert(commonPrefix([49, 50, 51, 60, 60], "12345" ) == [49, 50, 51]); assert(commonPrefix([49, 50, 51, 60, 60], "12345"d) == [49, 50, 51]); assert(commonPrefix!"a == ('0' + b)"("12345" , [1, 2, 3, 9, 9]) == "123"); assert(commonPrefix!"a == ('0' + b)"("12345"d, [1, 2, 3, 9, 9]) == "123"d); assert(commonPrefix!"('0' + a) == b"([1, 2, 3, 9, 9], "12345" ) == [1, 2, 3]); assert(commonPrefix!"('0' + a) == b"([1, 2, 3, 9, 9], "12345"d) == [1, 2, 3]); } // count /** The first version counts the number of elements $(D x) in $(D r) for which $(D pred(x, value)) is $(D true). $(D pred) defaults to equality. Performs $(BIGOH haystack.length) evaluations of $(D pred). The second version returns the number of times $(D needle) occurs in $(D haystack). Throws an exception if $(D needle.empty), as the _count of the empty range in any range would be infinite. Overlapped counts are not considered, for example $(D count("aaa", "aa")) is $(D 1), not $(D 2). The third version counts the elements for which $(D pred(x)) is $(D true). Performs $(BIGOH haystack.length) evaluations of $(D pred). The fourth version counts the number of elements in a range. It is an optimization for the third version: if the given range has the `length` property the count is returned right away, otherwise performs $(BIGOH haystack.length) to walk the range. Note: Regardless of the overload, $(D count) will not accept infinite ranges for $(D haystack). Params: pred = The predicate to evaluate. haystack = The range to _count. needle = The element or sub-range to _count in the `haystack`. Returns: The number of positions in the `haystack` for which `pred` returned true. */ size_t count(alias pred = "a == b", Range, E)(Range haystack, E needle) if (isInputRange!Range && !isInfinite!Range && is(typeof(binaryFun!pred(haystack.front, needle)) : bool)) { bool pred2(ElementType!Range a) { return binaryFun!pred(a, needle); } return count!pred2(haystack); } /// @safe unittest { import std.uni : toLower; // count elements in range int[] a = [ 1, 2, 4, 3, 2, 5, 3, 2, 4 ]; assert(count(a) == 9); assert(count(a, 2) == 3); assert(count!("a > b")(a, 2) == 5); // count range in range assert(count("abcadfabf", "ab") == 2); assert(count("ababab", "abab") == 1); assert(count("ababab", "abx") == 0); // fuzzy count range in range assert(count!((a, b) => toLower(a) == toLower(b))("AbcAdFaBf", "ab") == 2); // count predicate in range assert(count!("a > 1")(a) == 8); } @safe unittest { import std.conv : text; int[] a = [ 1, 2, 4, 3, 2, 5, 3, 2, 4 ]; assert(count(a, 2) == 3, text(count(a, 2))); assert(count!("a > b")(a, 2) == 5, text(count!("a > b")(a, 2))); // check strings assert(count("日本語") == 3); assert(count("日本語"w) == 3); assert(count("日本語"d) == 3); assert(count!("a == '日'")("日本語") == 1); assert(count!("a == '本'")("日本語"w) == 1); assert(count!("a == '語'")("日本語"d) == 1); } @safe unittest { string s = "This is a fofofof list"; string sub = "fof"; assert(count(s, sub) == 2); } /// Ditto size_t count(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) if (isForwardRange!R1 && !isInfinite!R1 && isForwardRange!R2 && is(typeof(binaryFun!pred(haystack.front, needle.front)) : bool)) { assert(!needle.empty, "Cannot count occurrences of an empty range"); static if (isInfinite!R2) { //Note: This is the special case of looking for an infinite inside a finite... //"How many instances of the Fibonacci sequence can you count in [1, 2, 3]?" - "None." return 0; } else { size_t result; //Note: haystack is not saved, because findskip is designed to modify it for ( ; findSkip!pred(haystack, needle.save) ; ++result) {} return result; } } /// Ditto size_t count(alias pred, R)(R haystack) if (isInputRange!R && !isInfinite!R && is(typeof(unaryFun!pred(haystack.front)) : bool)) { size_t result; alias T = ElementType!R; //For narrow strings forces dchar iteration foreach (T elem; haystack) if (unaryFun!pred(elem)) ++result; return result; } /// Ditto size_t count(R)(R haystack) if (isInputRange!R && !isInfinite!R) { return walkLength(haystack); } @safe unittest { int[] a = [ 1, 2, 4, 3, 2, 5, 3, 2, 4 ]; assert(count!("a == 3")(a) == 2); assert(count("日本語") == 3); } // Issue 11253 @safe nothrow unittest { assert([1, 2, 3].count([2, 3]) == 1); } /++ Counts elements in the given $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) until the given predicate is true for one of the given $(D needles). Params: pred = The predicate for determining when to stop counting. haystack = The $(REF_ALTTEXT input range, isInputRange, std,range,primitives) to be counted. needles = Either a single element, or a $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) of elements, to be evaluated in turn against each element in $(D haystack) under the given predicate. Returns: The number of elements which must be popped from the front of $(D haystack) before reaching an element for which $(D startsWith!pred(haystack, needles)) is $(D true). If $(D startsWith!pred(haystack, needles)) is not $(D true) for any element in $(D haystack), then $(D -1) is returned. See_Also: $(REF indexOf, std,string) +/ ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R haystack, Rs needles) if (isForwardRange!R && Rs.length > 0 && isForwardRange!(Rs[0]) == isInputRange!(Rs[0]) && is(typeof(startsWith!pred(haystack, needles[0]))) && (Rs.length == 1 || is(typeof(countUntil!pred(haystack, needles[1 .. $]))))) { typeof(return) result; static if (needles.length == 1) { static if (hasLength!R) //Note: Narrow strings don't have length. { //We delegate to find because find is very efficient. //We store the length of the haystack so we don't have to save it. auto len = haystack.length; auto r2 = find!pred(haystack, needles[0]); if (!r2.empty) return cast(typeof(return)) (len - r2.length); } else { import std.range : dropOne; if (needles[0].empty) return 0; //Default case, slower route doing startsWith iteration for ( ; !haystack.empty ; ++result ) { //We compare the first elements of the ranges here before //forwarding to startsWith. This avoids making useless saves to //haystack/needle if they aren't even going to be mutated anyways. //It also cuts down on the amount of pops on haystack. if (binaryFun!pred(haystack.front, needles[0].front)) { //Here, we need to save the needle before popping it. //haystack we pop in all paths, so we do that, and then save. haystack.popFront(); if (startsWith!pred(haystack.save, needles[0].save.dropOne())) return result; } else haystack.popFront(); } } } else { foreach (i, Ri; Rs) { static if (isForwardRange!Ri) { if (needles[i].empty) return 0; } } Tuple!Rs t; foreach (i, Ri; Rs) { static if (!isForwardRange!Ri) { t[i] = needles[i]; } } for (; !haystack.empty ; ++result, haystack.popFront()) { foreach (i, Ri; Rs) { static if (isForwardRange!Ri) { t[i] = needles[i].save; } } if (startsWith!pred(haystack.save, t.expand)) { return result; } } } //Because of @@@8804@@@: Avoids both "unreachable code" or "no return statement" static if (isInfinite!R) assert(0); else return -1; } /// ditto ptrdiff_t countUntil(alias pred = "a == b", R, N)(R haystack, N needle) if (isInputRange!R && is(typeof(binaryFun!pred(haystack.front, needle)) : bool)) { bool pred2(ElementType!R a) { return binaryFun!pred(a, needle); } return countUntil!pred2(haystack); } /// @safe unittest { assert(countUntil("hello world", "world") == 6); assert(countUntil("hello world", 'r') == 8); assert(countUntil("hello world", "programming") == -1); assert(countUntil("日本語", "本語") == 1); assert(countUntil("日本語", '語') == 2); assert(countUntil("日本語", "五") == -1); assert(countUntil("日本語", '五') == -1); assert(countUntil([0, 7, 12, 22, 9], [12, 22]) == 2); assert(countUntil([0, 7, 12, 22, 9], 9) == 4); assert(countUntil!"a > b"([0, 7, 12, 22, 9], 20) == 3); } @safe unittest { import std.algorithm.iteration : filter; import std.internal.test.dummyrange; assert(countUntil("日本語", "") == 0); assert(countUntil("日本語"d, "") == 0); assert(countUntil("", "") == 0); assert(countUntil("".filter!"true"(), "") == 0); auto rf = [0, 20, 12, 22, 9].filter!"true"(); assert(rf.countUntil!"a > b"((int[]).init) == 0); assert(rf.countUntil!"a > b"(20) == 3); assert(rf.countUntil!"a > b"([20, 8]) == 3); assert(rf.countUntil!"a > b"([20, 10]) == -1); assert(rf.countUntil!"a > b"([20, 8, 0]) == -1); auto r = new ReferenceForwardRange!int([0, 1, 2, 3, 4, 5, 6]); auto r2 = new ReferenceForwardRange!int([3, 4]); auto r3 = new ReferenceForwardRange!int([3, 5]); assert(r.save.countUntil(3) == 3); assert(r.save.countUntil(r2) == 3); assert(r.save.countUntil(7) == -1); assert(r.save.countUntil(r3) == -1); } @safe unittest { assert(countUntil("hello world", "world", "asd") == 6); assert(countUntil("hello world", "world", "ello") == 1); assert(countUntil("hello world", "world", "") == 0); assert(countUntil("hello world", "world", 'l') == 2); } /++ Similar to the previous overload of $(D countUntil), except that this one evaluates only the predicate $(D pred). Params: pred = Predicate to when to stop counting. haystack = An $(REF_ALTTEXT input range, isInputRange, std,range,primitives) of elements to be counted. Returns: The number of elements which must be popped from $(D haystack) before $(D pred(haystack.front)) is $(D true). +/ ptrdiff_t countUntil(alias pred, R)(R haystack) if (isInputRange!R && is(typeof(unaryFun!pred(haystack.front)) : bool)) { typeof(return) i; static if (isRandomAccessRange!R) { //Optimized RA implementation. Since we want to count *and* iterate at //the same time, it is more efficient this way. static if (hasLength!R) { immutable len = cast(typeof(return)) haystack.length; for ( ; i < len ; ++i ) if (unaryFun!pred(haystack[i])) return i; } else //if (isInfinite!R) { for ( ; ; ++i ) if (unaryFun!pred(haystack[i])) return i; } } else static if (hasLength!R) { //For those odd ranges that have a length, but aren't RA. //It is faster to quick find, and then compare the lengths auto r2 = find!pred(haystack.save); if (!r2.empty) return cast(typeof(return)) (haystack.length - r2.length); } else //Everything else { alias T = ElementType!R; //For narrow strings forces dchar iteration foreach (T elem; haystack) { if (unaryFun!pred(elem)) return i; ++i; } } //Because of @@@8804@@@: Avoids both "unreachable code" or "no return statement" static if (isInfinite!R) assert(0); else return -1; } /// @safe unittest { import std.ascii : isDigit; import std.uni : isWhite; assert(countUntil!(std.uni.isWhite)("hello world") == 5); assert(countUntil!(std.ascii.isDigit)("hello world") == -1); assert(countUntil!"a > 20"([0, 7, 12, 22, 9]) == 3); } @safe unittest { import std.internal.test.dummyrange; // References { // input ReferenceInputRange!int r; r = new ReferenceInputRange!int([0, 1, 2, 3, 4, 5, 6]); assert(r.countUntil(3) == 3); r = new ReferenceInputRange!int([0, 1, 2, 3, 4, 5, 6]); assert(r.countUntil(7) == -1); } { // forward auto r = new ReferenceForwardRange!int([0, 1, 2, 3, 4, 5, 6]); assert(r.save.countUntil([3, 4]) == 3); assert(r.save.countUntil(3) == 3); assert(r.save.countUntil([3, 7]) == -1); assert(r.save.countUntil(7) == -1); } { // infinite forward auto r = new ReferenceInfiniteForwardRange!int(0); assert(r.save.countUntil([3, 4]) == 3); assert(r.save.countUntil(3) == 3); } } /** Checks if the given range ends with (one of) the given needle(s). The reciprocal of $(D startsWith). Params: pred = The predicate to use for comparing elements between the range and the needle(s). doesThisEnd = The $(REF_ALTTEXT bidirectional range, isBidirectionalRange, std,range,primitives) to check. withOneOfThese = The needles to check against, which may be single elements, or bidirectional ranges of elements. withThis = The single element to check. Returns: 0 if the needle(s) do not occur at the end of the given range; otherwise the position of the matching needle, that is, 1 if the range ends with $(D withOneOfThese[0]), 2 if it ends with $(D withOneOfThese[1]), and so on. In the case when no needle parameters are given, return $(D true) iff back of $(D doesThisStart) fulfils predicate $(D pred). */ uint endsWith(alias pred = "a == b", Range, Needles...)(Range doesThisEnd, Needles withOneOfThese) if (isBidirectionalRange!Range && Needles.length > 1 && is(typeof(.endsWith!pred(doesThisEnd, withOneOfThese[0])) : bool) && is(typeof(.endsWith!pred(doesThisEnd, withOneOfThese[1 .. $])) : uint)) { alias haystack = doesThisEnd; alias needles = withOneOfThese; // Make one pass looking for empty ranges in needles foreach (i, Unused; Needles) { // Empty range matches everything static if (!is(typeof(binaryFun!pred(haystack.back, needles[i])) : bool)) { if (needles[i].empty) return i + 1; } } for (; !haystack.empty; haystack.popBack()) { foreach (i, Unused; Needles) { static if (is(typeof(binaryFun!pred(haystack.back, needles[i])) : bool)) { // Single-element if (binaryFun!pred(haystack.back, needles[i])) { // found, but continue to account for one-element // range matches (consider endsWith("ab", "b", // 'b') should return 1, not 2). continue; } } else { if (binaryFun!pred(haystack.back, needles[i].back)) continue; } // This code executed on failure to match // Out with this guy, check for the others uint result = endsWith!pred(haystack, needles[0 .. i], needles[i + 1 .. $]); if (result > i) ++result; return result; } // If execution reaches this point, then the back matches for all // needles ranges. What we need to do now is to lop off the back of // all ranges involved and recurse. foreach (i, Unused; Needles) { static if (is(typeof(binaryFun!pred(haystack.back, needles[i])) : bool)) { // Test has passed in the previous loop return i + 1; } else { needles[i].popBack(); if (needles[i].empty) return i + 1; } } } return 0; } /// Ditto bool endsWith(alias pred = "a == b", R1, R2)(R1 doesThisEnd, R2 withThis) if (isBidirectionalRange!R1 && isBidirectionalRange!R2 && is(typeof(binaryFun!pred(doesThisEnd.back, withThis.back)) : bool)) { alias haystack = doesThisEnd; alias needle = withThis; static if (is(typeof(pred) : string)) enum isDefaultPred = pred == "a == b"; else enum isDefaultPred = false; static if (isDefaultPred && isArray!R1 && isArray!R2 && is(Unqual!(ElementEncodingType!R1) == Unqual!(ElementEncodingType!R2))) { if (haystack.length < needle.length) return false; return haystack[$ - needle.length .. $] == needle; } else { import std.range : retro; return startsWith!pred(retro(doesThisEnd), retro(withThis)); } } /// Ditto bool endsWith(alias pred = "a == b", R, E)(R doesThisEnd, E withThis) if (isBidirectionalRange!R && is(typeof(binaryFun!pred(doesThisEnd.back, withThis)) : bool)) { if (doesThisEnd.empty) return false; alias predFunc = binaryFun!pred; // auto-decoding special case static if (isNarrowString!R) { // specialize for ASCII as to not change previous behavior if (withThis <= 0x7F) return predFunc(doesThisEnd[$ - 1], withThis); else return predFunc(doesThisEnd.back, withThis); } else { return predFunc(doesThisEnd.back, withThis); } } /// Ditto bool endsWith(alias pred, R)(R doesThisEnd) if (isInputRange!R && ifTestable!(typeof(doesThisEnd.front), unaryFun!pred)) { return !doesThisEnd.empty && unaryFun!pred(doesThisEnd.back); } /// @safe unittest { import std.ascii : isAlpha; assert("abc".endsWith!(a => a.isAlpha)); assert("abc".endsWith!isAlpha); assert(!"ab1".endsWith!(a => a.isAlpha)); assert(!"ab1".endsWith!isAlpha); assert(!"".endsWith!(a => a.isAlpha)); import std.algorithm.comparison : among; assert("abc".endsWith!(a => a.among('c', 'd') != 0)); assert(!"abc".endsWith!(a => a.among('a', 'b') != 0)); assert(endsWith("abc", "")); assert(!endsWith("abc", "b")); assert(endsWith("abc", "a", 'c') == 2); assert(endsWith("abc", "c", "a") == 1); assert(endsWith("abc", "c", "c") == 1); assert(endsWith("abc", "bc", "c") == 2); assert(endsWith("abc", "x", "c", "b") == 2); assert(endsWith("abc", "x", "aa", "bc") == 3); assert(endsWith("abc", "x", "aaa", "sab") == 0); assert(endsWith("abc", "x", "aaa", 'c', "sab") == 3); } @safe unittest { import std.algorithm.iteration : filterBidirectional; import std.conv : to; import std.meta : AliasSeq; foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) { assert(!endsWith(to!S("abc"), 'a')); assert(endsWith(to!S("abc"), 'a', 'c') == 2); assert(!endsWith(to!S("abc"), 'x', 'n', 'b')); assert(endsWith(to!S("abc"), 'x', 'n', 'c') == 3); assert(endsWith(to!S("abc\uFF28"), 'a', '\uFF28', 'c') == 2); foreach (T; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 //Lots of strings assert(endsWith(to!S("abc"), to!T(""))); assert(!endsWith(to!S("abc"), to!T("a"))); assert(!endsWith(to!S("abc"), to!T("b"))); assert(endsWith(to!S("abc"), to!T("bc"), 'c') == 2); assert(endsWith(to!S("abc"), to!T("a"), "c") == 2); assert(endsWith(to!S("abc"), to!T("c"), "a") == 1); assert(endsWith(to!S("abc"), to!T("c"), "c") == 1); assert(endsWith(to!S("abc"), to!T("x"), 'c', "b") == 2); assert(endsWith(to!S("abc"), 'x', to!T("aa"), "bc") == 3); assert(endsWith(to!S("abc"), to!T("x"), "aaa", "sab") == 0); assert(endsWith(to!S("abc"), to!T("x"), "aaa", "c", "sab") == 3); assert(endsWith(to!S("\uFF28el\uFF4co"), to!T("l\uFF4co"))); assert(endsWith(to!S("\uFF28el\uFF4co"), to!T("lo"), to!T("l\uFF4co")) == 2); //Unicode assert(endsWith(to!S("\uFF28el\uFF4co"), to!T("l\uFF4co"))); assert(endsWith(to!S("\uFF28el\uFF4co"), to!T("lo"), to!T("l\uFF4co")) == 2); assert(endsWith(to!S("日本語"), to!T("本語"))); assert(endsWith(to!S("日本語"), to!T("日本語"))); assert(!endsWith(to!S("本語"), to!T("日本語"))); //Empty assert(endsWith(to!S(""), T.init)); assert(!endsWith(to!S(""), 'a')); assert(endsWith(to!S("a"), T.init)); assert(endsWith(to!S("a"), T.init, "") == 1); assert(endsWith(to!S("a"), T.init, 'a') == 1); assert(endsWith(to!S("a"), 'a', T.init) == 2); }(); } foreach (T; AliasSeq!(int, short)) { immutable arr = cast(T[])[0, 1, 2, 3, 4, 5]; //RA range assert(endsWith(arr, cast(int[]) null)); assert(!endsWith(arr, 0)); assert(!endsWith(arr, 4)); assert(endsWith(arr, 5)); assert(endsWith(arr, 0, 4, 5) == 3); assert(endsWith(arr, [5])); assert(endsWith(arr, [4, 5])); assert(endsWith(arr, [4, 5], 7) == 1); assert(!endsWith(arr, [2, 4, 5])); assert(endsWith(arr, [2, 4, 5], [3, 4, 5]) == 2); //Normal input range assert(!endsWith(filterBidirectional!"true"(arr), 4)); assert(endsWith(filterBidirectional!"true"(arr), 5)); assert(endsWith(filterBidirectional!"true"(arr), [5])); assert(endsWith(filterBidirectional!"true"(arr), [4, 5])); assert(endsWith(filterBidirectional!"true"(arr), [4, 5], 7) == 1); assert(!endsWith(filterBidirectional!"true"(arr), [2, 4, 5])); assert(endsWith(filterBidirectional!"true"(arr), [2, 4, 5], [3, 4, 5]) == 2); assert(endsWith(arr, filterBidirectional!"true"([4, 5]))); assert(endsWith(arr, filterBidirectional!"true"([4, 5]), 7) == 1); assert(!endsWith(arr, filterBidirectional!"true"([2, 4, 5]))); assert(endsWith(arr, [2, 4, 5], filterBidirectional!"true"([3, 4, 5])) == 2); //Non-default pred assert(endsWith!("a%10 == b%10")(arr, [14, 15])); assert(!endsWith!("a%10 == b%10")(arr, [15, 14])); } } /** Iterates the passed range and selects the extreme element with `less`. If the extreme element occurs multiple time, the first occurrence will be returned. Params: map = custom accessor for the comparison key selector = custom mapping for the extrema selection seed = custom seed to use as initial element r = Range from which the extreme value will be selected Returns: The extreme value according to `map` and `selector` of the passed-in values. */ private auto extremum(alias map, alias selector = "a < b", Range)(Range r) if (isInputRange!Range && !isInfinite!Range && is(typeof(unaryFun!map(ElementType!(Range).init)))) in { assert(!r.empty, "r is an empty range"); } do { alias Element = ElementType!Range; Unqual!Element seed = r.front; r.popFront(); return extremum!(map, selector)(r, seed); } private auto extremum(alias map, alias selector = "a < b", Range, RangeElementType = ElementType!Range) (Range r, RangeElementType seedElement) if (isInputRange!Range && !isInfinite!Range && !is(CommonType!(ElementType!Range, RangeElementType) == void) && is(typeof(unaryFun!map(ElementType!(Range).init)))) { alias mapFun = unaryFun!map; alias selectorFun = binaryFun!selector; alias Element = ElementType!Range; alias CommonElement = CommonType!(Element, RangeElementType); Unqual!CommonElement extremeElement = seedElement; alias MapType = Unqual!(typeof(mapFun(CommonElement.init))); MapType extremeElementMapped = mapFun(extremeElement); // direct access via a random access range is faster static if (isRandomAccessRange!Range) { foreach (const i; 0 .. r.length) { MapType mapElement = mapFun(r[i]); if (selectorFun(mapElement, extremeElementMapped)) { extremeElement = r[i]; extremeElementMapped = mapElement; } } } else { while (!r.empty) { MapType mapElement = mapFun(r.front); if (selectorFun(mapElement, extremeElementMapped)) { extremeElement = r.front; extremeElementMapped = mapElement; } r.popFront(); } } return extremeElement; } private auto extremum(alias selector = "a < b", Range)(Range r) if (isInputRange!Range && !isInfinite!Range && !is(typeof(unaryFun!selector(ElementType!(Range).init)))) { alias Element = ElementType!Range; Unqual!Element seed = r.front; r.popFront(); return extremum!selector(r, seed); } // if we only have one statement in the loop it can be optimized a lot better private auto extremum(alias selector = "a < b", Range, RangeElementType = ElementType!Range) (Range r, RangeElementType seedElement) if (isInputRange!Range && !isInfinite!Range && !is(CommonType!(ElementType!Range, RangeElementType) == void) && !is(typeof(unaryFun!selector(ElementType!(Range).init)))) { alias Element = ElementType!Range; alias CommonElement = CommonType!(Element, RangeElementType); Unqual!CommonElement extremeElement = seedElement; alias selectorFun = binaryFun!selector; // direct access via a random access range is faster static if (isRandomAccessRange!Range) { foreach (const i; 0 .. r.length) { if (selectorFun(r[i], extremeElement)) { extremeElement = r[i]; } } } else { while (!r.empty) { if (selectorFun(r.front, extremeElement)) { extremeElement = r.front; } r.popFront(); } } return extremeElement; } @safe pure unittest { // allows a custom map to select the extremum assert([[0, 4], [1, 2]].extremum!"a[0]" == [0, 4]); assert([[0, 4], [1, 2]].extremum!"a[1]" == [1, 2]); // allows a custom selector for comparison assert([[0, 4], [1, 2]].extremum!("a[0]", "a > b") == [1, 2]); assert([[0, 4], [1, 2]].extremum!("a[1]", "a > b") == [0, 4]); // use a custom comparator import std.math : cmp; assert([-2., 0, 5].extremum!cmp == 5.0); assert([-2., 0, 2].extremum!`cmp(a, b) < 0` == -2.0); // combine with map import std.range : enumerate; assert([-3., 0, 5].enumerate.extremum!(`a.value`, cmp) == tuple(2, 5.0)); assert([-2., 0, 2].enumerate.extremum!(`a.value`, `cmp(a, b) < 0`) == tuple(0, -2.0)); // seed with a custom value int[] arr; assert(arr.extremum(1) == 1); } @safe pure nothrow unittest { // 2d seeds int[][] arr2d; assert(arr2d.extremum([1]) == [1]); // allow seeds of different types (implicit casting) assert(extremum([2, 3, 4], 1.5) == 1.5); } @safe pure unittest { import std.range : enumerate, iota; // forward ranges assert(iota(1, 5).extremum() == 1); assert(iota(2, 5).enumerate.extremum!"a.value" == tuple(0, 2)); // should work with const const(int)[] immArr = [2, 1, 3]; assert(immArr.extremum == 1); // should work with immutable immutable(int)[] immArr2 = [2, 1, 3]; assert(immArr2.extremum == 1); // with strings assert(["b", "a", "c"].extremum == "a"); // with all dummy ranges import std.internal.test.dummyrange; foreach (DummyType; AllDummyRanges) { DummyType d; assert(d.extremum == 1); assert(d.extremum!(a => a) == 1); assert(d.extremum!`a > b` == 10); assert(d.extremum!(a => a, `a > b`) == 10); } } @nogc @safe nothrow pure unittest { static immutable arr = [7, 3, 4, 2, 1, 8]; assert(arr.extremum == 1); static immutable arr2d = [[1, 9], [3, 1], [4, 2]]; assert(arr2d.extremum!"a[1]" == arr2d[1]); } // find /** Finds an individual element in an input range. Elements of $(D haystack) are compared with $(D needle) by using predicate $(D pred). Performs $(BIGOH walkLength(haystack)) evaluations of $(D pred). To _find the last occurrence of $(D needle) in $(D haystack), call $(D find(retro(haystack), needle)). See $(REF retro, std,range). Params: pred = The predicate for comparing each element with the needle, defaulting to $(D "a == b"). The negated predicate $(D "a != b") can be used to search instead for the first element $(I not) matching the needle. haystack = The $(REF_ALTTEXT input range, isInputRange, std,range,primitives) searched in. needle = The element searched for. Constraints: $(D isInputRange!InputRange && is(typeof(binaryFun!pred(haystack.front, needle) : bool))) Returns: $(D haystack) advanced such that the front element is the one searched for; that is, until $(D binaryFun!pred(haystack.front, needle)) is $(D true). If no such position exists, returns an empty $(D haystack). See_Also: $(HTTP sgi.com/tech/stl/_find.html, STL's _find) */ InputRange find(alias pred = "a == b", InputRange, Element)(InputRange haystack, scope Element needle) if (isInputRange!InputRange && is (typeof(binaryFun!pred(haystack.front, needle)) : bool)) { alias R = InputRange; alias E = Element; alias predFun = binaryFun!pred; static if (is(typeof(pred == "a == b"))) enum isDefaultPred = pred == "a == b"; else enum isDefaultPred = false; enum isIntegralNeedle = isSomeChar!E || isIntegral!E || isBoolean!E; alias EType = ElementType!R; // If the haystack is a SortedRange we can use binary search to find the needle. // Works only for the default find predicate and any SortedRange predicate. // 8829 enhancement import std.range : SortedRange; static if (is(InputRange : SortedRange!TT, TT) && isDefaultPred) { auto lb = haystack.lowerBound(needle); if (lb.length == haystack.length || haystack[lb.length] != needle) return haystack[$ .. $]; return haystack[lb.length .. $]; } else static if (isNarrowString!R) { alias EEType = ElementEncodingType!R; alias UEEType = Unqual!EEType; //These are two special cases which can search without decoding the UTF stream. static if (isDefaultPred && isIntegralNeedle) { import std.utf : canSearchInCodeUnits; //This special case deals with UTF8 search, when the needle //is represented by a single code point. //Note: "needle <= 0x7F" properly handles sign via unsigned promotion static if (is(UEEType == char)) { if (!__ctfe && canSearchInCodeUnits!char(needle)) { static R trustedMemchr(ref R haystack, ref E needle) @trusted nothrow pure { import core.stdc.string : memchr; auto ptr = memchr(haystack.ptr, needle, haystack.length); return ptr ? haystack[cast(char*) ptr - haystack.ptr .. $] : haystack[$ .. $]; } return trustedMemchr(haystack, needle); } } //Ditto, but for UTF16 static if (is(UEEType == wchar)) { if (canSearchInCodeUnits!wchar(needle)) { foreach (i, ref EEType e; haystack) { if (e == needle) return haystack[i .. $]; } return haystack[$ .. $]; } } } //Previous conditonal optimizations did not succeed. Fallback to //unconditional implementations static if (isDefaultPred) { import std.utf : encode; //In case of default pred, it is faster to do string/string search. UEEType[is(UEEType == char) ? 4 : 2] buf; size_t len = encode(buf, needle); return find(haystack, buf[0 .. len]); } else { import std.utf : decode; //Explicit pred: we must test each character by the book. //We choose a manual decoding approach, because it is faster than //the built-in foreach, or doing a front/popFront for-loop. immutable len = haystack.length; size_t i = 0, next = 0; while (next < len) { if (predFun(decode(haystack, next), needle)) return haystack[i .. $]; i = next; } return haystack[$ .. $]; } } else static if (isArray!R) { //10403 optimization static if (isDefaultPred && isIntegral!EType && EType.sizeof == 1 && isIntegralNeedle) { import std.algorithm.comparison : max, min; R findHelper(ref R haystack, ref E needle) @trusted nothrow pure { import core.stdc.string : memchr; EType* ptr = null; //Note: we use "min/max" to handle sign mismatch. if (min(EType.min, needle) == EType.min && max(EType.max, needle) == EType.max) { ptr = cast(EType*) memchr(haystack.ptr, needle, haystack.length); } return ptr ? haystack[ptr - haystack.ptr .. $] : haystack[$ .. $]; } if (!__ctfe) return findHelper(haystack, needle); } //Default implementation. foreach (i, ref e; haystack) if (predFun(e, needle)) return haystack[i .. $]; return haystack[$ .. $]; } else { //Everything else. Walk. for ( ; !haystack.empty; haystack.popFront() ) { if (predFun(haystack.front, needle)) break; } return haystack; } } /// @safe unittest { import std.algorithm.comparison : equal; import std.container : SList; import std.range; import std.range.primitives : empty; auto arr = assumeSorted!"a < b"([1, 2, 4, 4, 4, 4, 5, 6, 9]); assert(find(arr, 4) == assumeSorted!"a < b"([4, 4, 4, 4, 5, 6, 9])); assert(find(arr, 1) == arr); assert(find(arr, 9) == assumeSorted!"a < b"([9])); assert(find!"a > b"(arr, 4) == assumeSorted!"a < b"([5, 6, 9])); assert(find!"a < b"(arr, 4) == arr); assert(find(arr, 0).empty()); assert(find(arr, 10).empty()); assert(find(arr, 8).empty()); auto r = assumeSorted!"a > b"([10, 7, 3, 1, 0, 0]); assert(find(r, 3) == assumeSorted!"a > b"([3, 1, 0, 0])); assert(find!"a > b"(r, 8) == r); assert(find!"a < b"(r, 5) == assumeSorted!"a > b"([3, 1, 0, 0])); assert(find("hello, world", ',') == ", world"); assert(find([1, 2, 3, 5], 4) == []); assert(equal(find(SList!int(1, 2, 3, 4, 5)[], 4), SList!int(4, 5)[])); assert(find!"a > b"([1, 2, 3, 5], 2) == [3, 5]); auto a = [ 1, 2, 3 ]; assert(find(a, 5).empty); // not found assert(!find(a, 2).empty); // found // Case-insensitive find of a string string[] s = [ "Hello", "world", "!" ]; assert(!find!("toLower(a) == b")(s, "hello").empty); } @safe unittest { import std.algorithm.comparison : equal; import std.container : SList; auto lst = SList!int(1, 2, 5, 7, 3); assert(lst.front == 1); auto r = find(lst[], 5); assert(equal(r, SList!int(5, 7, 3)[])); assert(find([1, 2, 3, 5], 4).empty); assert(equal(find!"a > b"("hello", 'k'), "llo")); } @safe pure nothrow unittest { assert(!find ([1, 2, 3], 2).empty); assert(!find!((a,b)=>a == b)([1, 2, 3], 2).empty); assert(!find ([1, 2, 3], 2).empty); assert(!find!((a,b)=>a == b)([1, 2, 3], 2).empty); } @safe pure unittest { import std.meta : AliasSeq; foreach (R; AliasSeq!(string, wstring, dstring)) { foreach (E; AliasSeq!(char, wchar, dchar)) { assert(find ("hello world", 'w') == "world"); assert(find!((a,b)=>a == b)("hello world", 'w') == "world"); assert(find ("日c語", 'c') == "c語"); assert(find!((a,b)=>a == b)("日c語", 'c') == "c語"); assert(find ("0123456789", 'A').empty); static if (E.sizeof >= 2) { assert(find ("日本語", '本') == "本語"); assert(find!((a,b)=>a == b)("日本語", '本') == "本語"); } } } } @safe unittest { //CTFE static assert(find("abc", 'b') == "bc"); static assert(find("日b語", 'b') == "b語"); static assert(find("日本語", '本') == "本語"); static assert(find([1, 2, 3], 2) == [2, 3]); static assert(find ([1, 2, 3], 2)); static assert(find!((a,b)=>a == b)([1, 2, 3], 2)); static assert(find ([1, 2, 3], 2)); static assert(find!((a,b)=>a == b)([1, 2, 3], 2)); } @safe unittest { import std.exception : assertCTFEable; import std.meta : AliasSeq; void dg() @safe pure nothrow { byte[] sarr = [1, 2, 3, 4]; ubyte[] uarr = [1, 2, 3, 4]; foreach (arr; AliasSeq!(sarr, uarr)) { foreach (T; AliasSeq!(byte, ubyte, int, uint)) { assert(find(arr, cast(T) 3) == arr[2 .. $]); assert(find(arr, cast(T) 9) == arr[$ .. $]); } assert(find(arr, 256) == arr[$ .. $]); } } dg(); assertCTFEable!dg; } @safe unittest { // Bugzilla 11603 enum Foo : ubyte { A } assert([Foo.A].find(Foo.A).empty == false); ubyte x = 0; assert([x].find(x).empty == false); } /** Advances the input range $(D haystack) by calling $(D haystack.popFront) until either $(D pred(haystack.front)), or $(D haystack.empty). Performs $(BIGOH haystack.length) evaluations of $(D pred). To _find the last element of a $(REF_ALTTEXT bidirectional, isBidirectionalRange, std,range,primitives) $(D haystack) satisfying $(D pred), call $(D find!(pred)(retro(haystack))). See $(REF retro, std,range). `find` behaves similar to `dropWhile` in other languages. Params: pred = The predicate for determining if a given element is the one being searched for. haystack = The $(REF_ALTTEXT input range, isInputRange, std,range,primitives) to search in. Returns: $(D haystack) advanced such that the front element is the one searched for; that is, until $(D binaryFun!pred(haystack.front, needle)) is $(D true). If no such position exists, returns an empty $(D haystack). See_Also: $(HTTP sgi.com/tech/stl/find_if.html, STL's find_if) */ InputRange find(alias pred, InputRange)(InputRange haystack) if (isInputRange!InputRange) { alias R = InputRange; alias predFun = unaryFun!pred; static if (isNarrowString!R) { import std.utf : decode; immutable len = haystack.length; size_t i = 0, next = 0; while (next < len) { if (predFun(decode(haystack, next))) return haystack[i .. $]; i = next; } return haystack[$ .. $]; } else { //standard range for ( ; !haystack.empty; haystack.popFront() ) { if (predFun(haystack.front)) break; } return haystack; } } /// @safe unittest { auto arr = [ 1, 2, 3, 4, 1 ]; assert(find!("a > 2")(arr) == [ 3, 4, 1 ]); // with predicate alias bool pred(int x) { return x + 1 > 1.5; } assert(find!(pred)(arr) == arr); } @safe pure unittest { int[] r = [ 1, 2, 3 ]; assert(find!(a=>a > 2)(r) == [3]); bool pred(int x) { return x + 1 > 1.5; } assert(find!(pred)(r) == r); assert(find!(a=>a > 'v')("hello world") == "world"); assert(find!(a=>a%4 == 0)("日本語") == "本語"); } /** Finds the first occurrence of a forward range in another forward range. Performs $(BIGOH walkLength(haystack) * walkLength(needle)) comparisons in the worst case. There are specializations that improve performance by taking advantage of $(REF_ALTTEXT bidirectional range, isBidirectionalRange, std,range,primitives) or random access in the given ranges (where possible), depending on the statistics of the two ranges' content. Params: pred = The predicate to use for comparing respective elements from the haystack and the needle. Defaults to simple equality $(D "a == b"). haystack = The $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) searched in. needle = The $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) searched for. Returns: $(D haystack) advanced such that $(D needle) is a prefix of it (if no such position exists, returns $(D haystack) advanced to termination). */ R1 find(alias pred = "a == b", R1, R2)(R1 haystack, scope R2 needle) if (isForwardRange!R1 && isForwardRange!R2 && is(typeof(binaryFun!pred(haystack.front, needle.front)) : bool)) { static if (!isRandomAccessRange!R1) { static if (is(typeof(pred == "a == b")) && pred == "a == b" && isSomeString!R1 && isSomeString!R2 && haystack[0].sizeof == needle[0].sizeof) { // return cast(R1) find(representation(haystack), representation(needle)); // Specialization for simple string search alias Representation = Select!(haystack[0].sizeof == 1, ubyte[], Select!(haystack[0].sizeof == 2, ushort[], uint[])); // Will use the array specialization static TO force(TO, T)(inout T r) @trusted { return cast(TO) r; } return force!R1(.find!(pred, Representation, Representation) (force!Representation(haystack), force!Representation(needle))); } else { return simpleMindedFind!pred(haystack, needle); } } else static if (!isBidirectionalRange!R2 || !hasSlicing!R1) { static if (!is(ElementType!R1 == ElementType!R2)) { return simpleMindedFind!pred(haystack, needle); } else { // Prepare the search with needle's first element if (needle.empty) return haystack; haystack = .find!pred(haystack, needle.front); static if (hasLength!R1 && hasLength!R2 && is(typeof(takeNone(haystack)) == R1)) { if (needle.length > haystack.length) return takeNone(haystack); } else { if (haystack.empty) return haystack; } needle.popFront(); size_t matchLen = 1; // Loop invariant: haystack[0 .. matchLen] matches everything in // the initial needle that was popped out of needle. for (;;) { // Extend matchLength as much as possible for (;;) { import std.range : takeNone; if (needle.empty || haystack.empty) return haystack; static if (hasLength!R1 && is(typeof(takeNone(haystack)) == R1)) { if (matchLen == haystack.length) return takeNone(haystack); } if (!binaryFun!pred(haystack[matchLen], needle.front)) break; ++matchLen; needle.popFront(); } auto bestMatch = haystack[0 .. matchLen]; haystack.popFront(); haystack = .find!pred(haystack, bestMatch); } } } else // static if (hasSlicing!R1 && isBidirectionalRange!R2) { if (needle.empty) return haystack; static if (hasLength!R2) { immutable needleLength = needle.length; } else { immutable needleLength = walkLength(needle.save); } if (needleLength > haystack.length) { return haystack[haystack.length .. haystack.length]; } // Optimization in case the ranges are both SortedRanges. // Binary search can be used to find the first occurence // of the first element of the needle in haystack. // When it is found O(walklength(needle)) steps are performed. // 8829 enhancement import std.algorithm.comparison : mismatch; import std.range : SortedRange; static if (is(R1 == R2) && is(R1 : SortedRange!TT, TT) && pred == "a == b") { auto needleFirstElem = needle[0]; auto partitions = haystack.trisect(needleFirstElem); auto firstElemLen = partitions[1].length; size_t count = 0; if (firstElemLen == 0) return haystack[$ .. $]; while (needle.front() == needleFirstElem) { needle.popFront(); ++count; if (count > firstElemLen) return haystack[$ .. $]; } auto m = mismatch(partitions[2], needle); if (m[1].empty) return haystack[partitions[0].length + partitions[1].length - count .. $]; } else static if (isRandomAccessRange!R2) { immutable lastIndex = needleLength - 1; auto last = needle[lastIndex]; size_t j = lastIndex, skip = 0; for (; j < haystack.length;) { if (!binaryFun!pred(haystack[j], last)) { ++j; continue; } immutable k = j - lastIndex; // last elements match for (size_t i = 0;; ++i) { if (i == lastIndex) return haystack[k .. haystack.length]; if (!binaryFun!pred(haystack[k + i], needle[i])) break; } if (skip == 0) { skip = 1; while (skip < needleLength && needle[needleLength - 1 - skip] != needle[needleLength - 1]) { ++skip; } } j += skip; } } else { // @@@BUG@@@ // auto needleBack = moveBack(needle); // Stage 1: find the step size_t step = 1; auto needleBack = needle.back; needle.popBack(); for (auto i = needle.save; !i.empty && i.back != needleBack; i.popBack(), ++step) { } // Stage 2: linear find size_t scout = needleLength - 1; for (;;) { if (scout >= haystack.length) break; if (!binaryFun!pred(haystack[scout], needleBack)) { ++scout; continue; } // Found a match with the last element in the needle auto cand = haystack[scout + 1 - needleLength .. haystack.length]; if (startsWith!pred(cand, needle)) { // found return cand; } scout += step; } } return haystack[haystack.length .. haystack.length]; } } /// @safe unittest { import std.container : SList; import std.range.primitives : empty; import std.typecons : Tuple; assert(find("hello, world", "World").empty); assert(find("hello, world", "wo") == "world"); assert([1, 2, 3, 4].find(SList!int(2, 3)[]) == [2, 3, 4]); alias C = Tuple!(int, "x", int, "y"); auto a = [C(1,0), C(2,0), C(3,1), C(4,0)]; assert(a.find!"a.x == b"([2, 3]) == [C(2,0), C(3,1), C(4,0)]); assert(a[1 .. $].find!"a.x == b"([2, 3]) == [C(2,0), C(3,1), C(4,0)]); } @safe unittest { import std.container : SList; alias C = Tuple!(int, "x", int, "y"); assert([C(1,0), C(2,0), C(3,1), C(4,0)].find!"a.x == b"(SList!int(2, 3)[]) == [C(2,0), C(3,1), C(4,0)]); } @safe unittest // issue 12470 { import std.array : replace; inout(char)[] sanitize(inout(char)[] p) { return p.replace("\0", " "); } assert(sanitize("O\x00o") == "O o"); } @safe unittest { import std.algorithm.comparison : equal; import std.container : SList; auto lst = SList!int(1, 2, 5, 7, 3); static assert(isForwardRange!(int[])); static assert(isForwardRange!(typeof(lst[]))); auto r = find(lst[], [2, 5]); assert(equal(r, SList!int(2, 5, 7, 3)[])); } @safe unittest { import std.range; import std.stdio; auto r1 = assumeSorted([1, 2, 3, 3, 3, 4, 5, 6, 7, 8, 8, 8, 10]); auto r2 = assumeSorted([3, 3, 4, 5, 6, 7, 8, 8]); auto r3 = assumeSorted([3, 4, 5, 6, 7, 8]); auto r4 = assumeSorted([4, 5, 6]); auto r5 = assumeSorted([12, 13]); auto r6 = assumeSorted([8, 8, 10, 11]); auto r7 = assumeSorted([3, 3, 3, 3, 3, 3, 3]); assert(find(r1, r2) == assumeSorted([3, 3, 4, 5, 6, 7, 8, 8, 8, 10])); assert(find(r1, r3) == assumeSorted([3, 4, 5, 6, 7, 8, 8, 8, 10])); assert(find(r1, r4) == assumeSorted([4, 5, 6, 7, 8, 8, 8, 10])); assert(find(r1, r5).empty()); assert(find(r1, r6).empty()); assert(find(r1, r7).empty()); } @safe unittest { import std.algorithm.comparison : equal; // @@@BUG@@@ removing static below makes unittest fail static struct BiRange { int[] payload; @property bool empty() { return payload.empty; } @property BiRange save() { return this; } @property ref int front() { return payload[0]; } @property ref int back() { return payload[$ - 1]; } void popFront() { return payload.popFront(); } void popBack() { return payload.popBack(); } } auto r = BiRange([1, 2, 3, 10, 11, 4]); assert(equal(find(r, [10, 11]), [10, 11, 4])); } @safe unittest { import std.container : SList; assert(find([ 1, 2, 3 ], SList!int(2, 3)[]) == [ 2, 3 ]); assert(find([ 1, 2, 1, 2, 3, 3 ], SList!int(2, 3)[]) == [ 2, 3, 3 ]); } //Bug# 8334 @safe unittest { import std.algorithm.iteration : filter; import std.range; auto haystack = [1, 2, 3, 4, 1, 9, 12, 42]; auto needle = [12, 42, 27]; //different overload of find, but it's the base case. assert(find(haystack, needle).empty); assert(find(haystack, takeExactly(filter!"true"(needle), 3)).empty); assert(find(haystack, filter!"true"(needle)).empty); } // Internally used by some find() overloads above private R1 simpleMindedFind(alias pred, R1, R2)(R1 haystack, scope R2 needle) { enum estimateNeedleLength = hasLength!R1 && !hasLength!R2; static if (hasLength!R1) { static if (!hasLength!R2) size_t estimatedNeedleLength = 0; else immutable size_t estimatedNeedleLength = needle.length; } bool haystackTooShort() { static if (estimateNeedleLength) { return haystack.length < estimatedNeedleLength; } else { return haystack.empty; } } searching: for (;; haystack.popFront()) { if (haystackTooShort()) { // Failed search static if (hasLength!R1) { static if (is(typeof(haystack[haystack.length .. haystack.length]) : R1)) return haystack[haystack.length .. haystack.length]; else return R1.init; } else { assert(haystack.empty); return haystack; } } static if (estimateNeedleLength) size_t matchLength = 0; for (auto h = haystack.save, n = needle.save; !n.empty; h.popFront(), n.popFront()) { if (h.empty || !binaryFun!pred(h.front, n.front)) { // Failed searching n in h static if (estimateNeedleLength) { if (estimatedNeedleLength < matchLength) estimatedNeedleLength = matchLength; } continue searching; } static if (estimateNeedleLength) ++matchLength; } break; } return haystack; } @safe unittest { // Test simpleMindedFind for the case where both haystack and needle have // length. struct CustomString { @safe: string _impl; // This is what triggers issue 7992. @property size_t length() const { return _impl.length; } @property void length(size_t len) { _impl.length = len; } // This is for conformance to the forward range API (we deliberately // make it non-random access so that we will end up in // simpleMindedFind). @property bool empty() const { return _impl.empty; } @property dchar front() const { return _impl.front; } void popFront() { _impl.popFront(); } @property CustomString save() { return this; } } // If issue 7992 occurs, this will throw an exception from calling // popFront() on an empty range. auto r = find(CustomString("a"), CustomString("b")); assert(r.empty); } /** Finds two or more $(D needles) into a $(D haystack). The predicate $(D pred) is used throughout to compare elements. By default, elements are compared for equality. Params: pred = The predicate to use for comparing elements. haystack = The target of the search. Must be an input range. If any of $(D needles) is a range with elements comparable to elements in $(D haystack), then $(D haystack) must be a $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) such that the search can backtrack. needles = One or more items to search for. Each of $(D needles) must be either comparable to one element in $(D haystack), or be itself a forward range with elements comparable with elements in $(D haystack). Returns: A tuple containing $(D haystack) positioned to match one of the needles and also the 1-based index of the matching element in $(D needles) (0 if none of $(D needles) matched, 1 if $(D needles[0]) matched, 2 if $(D needles[1]) matched...). The first needle to be found will be the one that matches. If multiple needles are found at the same spot in the range, then the shortest one is the one which matches (if multiple needles of the same length are found at the same spot (e.g $(D "a") and $(D 'a')), then the left-most of them in the argument list matches). The relationship between $(D haystack) and $(D needles) simply means that one can e.g. search for individual $(D int)s or arrays of $(D int)s in an array of $(D int)s. In addition, if elements are individually comparable, searches of heterogeneous types are allowed as well: a $(D double[]) can be searched for an $(D int) or a $(D short[]), and conversely a $(D long) can be searched for a $(D float) or a $(D double[]). This makes for efficient searches without the need to coerce one side of the comparison into the other's side type. The complexity of the search is $(BIGOH haystack.length * max(needles.length)). (For needles that are individual items, length is considered to be 1.) The strategy used in searching several subranges at once maximizes cache usage by moving in $(D haystack) as few times as possible. */ Tuple!(Range, size_t) find(alias pred = "a == b", Range, Ranges...) (Range haystack, Ranges needles) if (Ranges.length > 1 && is(typeof(startsWith!pred(haystack, needles)))) { for (;; haystack.popFront()) { size_t r = startsWith!pred(haystack, needles); if (r || haystack.empty) { return tuple(haystack, r); } } } /// @safe unittest { import std.typecons : tuple; int[] a = [ 1, 4, 2, 3 ]; assert(find(a, 4) == [ 4, 2, 3 ]); assert(find(a, [ 1, 4 ]) == [ 1, 4, 2, 3 ]); assert(find(a, [ 1, 3 ], 4) == tuple([ 4, 2, 3 ], 2)); // Mixed types allowed if comparable assert(find(a, 5, [ 1.2, 3.5 ], 2.0) == tuple([ 2, 3 ], 3)); } @safe unittest { auto s1 = "Mary has a little lamb"; assert(find(s1, "has a", "has an") == tuple("has a little lamb", 1)); assert(find(s1, 't', "has a", "has an") == tuple("has a little lamb", 2)); assert(find(s1, 't', "has a", 'y', "has an") == tuple("y has a little lamb", 3)); assert(find("abc", "bc").length == 2); } @safe unittest { import std.algorithm.internal : rndstuff; import std.meta : AliasSeq; import std.uni : toUpper; int[] a = [ 1, 2, 3 ]; assert(find(a, 5).empty); assert(find(a, 2) == [2, 3]); foreach (T; AliasSeq!(int, double)) { auto b = rndstuff!(T)(); if (!b.length) continue; b[$ / 2] = 200; b[$ / 4] = 200; assert(find(b, 200).length == b.length - b.length / 4); } // Case-insensitive find of a string string[] s = [ "Hello", "world", "!" ]; assert(find!("toUpper(a) == toUpper(b)")(s, "hello").length == 3); static bool f(string a, string b) { return toUpper(a) == toUpper(b); } assert(find!(f)(s, "hello").length == 3); } @safe unittest { import std.algorithm.comparison : equal; import std.algorithm.internal : rndstuff; import std.meta : AliasSeq; import std.range : retro; int[] a = [ 1, 2, 3, 2, 6 ]; assert(find(retro(a), 5).empty); assert(equal(find(retro(a), 2), [ 2, 3, 2, 1 ][])); foreach (T; AliasSeq!(int, double)) { auto b = rndstuff!(T)(); if (!b.length) continue; b[$ / 2] = 200; b[$ / 4] = 200; assert(find(retro(b), 200).length == b.length - (b.length - 1) / 2); } } @safe unittest { import std.algorithm.comparison : equal; import std.internal.test.dummyrange; int[] a = [ -1, 0, 1, 2, 3, 4, 5 ]; int[] b = [ 1, 2, 3 ]; assert(find(a, b) == [ 1, 2, 3, 4, 5 ]); assert(find(b, a).empty); foreach (DummyType; AllDummyRanges) { DummyType d; auto findRes = find(d, 5); assert(equal(findRes, [5,6,7,8,9,10])); } } /** * Finds $(D needle) in $(D haystack) efficiently using the * $(LINK2 https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm, * Boyer-Moore) method. * * Params: * haystack = A random-access range with length and slicing. * needle = A $(LREF BoyerMooreFinder). * * Returns: * $(D haystack) advanced such that $(D needle) is a prefix of it (if no * such position exists, returns $(D haystack) advanced to termination). */ RandomAccessRange find(RandomAccessRange, alias pred, InputRange)( RandomAccessRange haystack, scope BoyerMooreFinder!(pred, InputRange) needle) { return needle.beFound(haystack); } @safe unittest { string h = "/homes/aalexand/d/dmd/bin/../lib/libphobos.a(dmain2.o)"~ "(.gnu.linkonce.tmain+0x74): In function `main' undefined reference"~ " to `_Dmain':"; string[] ns = ["libphobos", "function", " undefined", "`", ":"]; foreach (n ; ns) { auto p = find(h, boyerMooreFinder(n)); assert(!p.empty); } } /// @safe unittest { import std.range.primitives : empty; int[] a = [ -1, 0, 1, 2, 3, 4, 5 ]; int[] b = [ 1, 2, 3 ]; assert(find(a, boyerMooreFinder(b)) == [ 1, 2, 3, 4, 5 ]); assert(find(b, boyerMooreFinder(a)).empty); } @safe unittest { auto bm = boyerMooreFinder("for"); auto match = find("Moor", bm); assert(match.empty); } // canFind /++ Convenience function. Like find, but only returns whether or not the search was successful. See_Also: $(LREF among) for checking a value against multiple possibilities. +/ template canFind(alias pred="a == b") { import std.meta : allSatisfy; /++ Returns $(D true) if and only if any value $(D v) found in the input range $(D range) satisfies the predicate $(D pred). Performs (at most) $(BIGOH haystack.length) evaluations of $(D pred). +/ bool canFind(Range)(Range haystack) if (is(typeof(find!pred(haystack)))) { return any!pred(haystack); } /++ Returns $(D true) if and only if $(D needle) can be found in $(D range). Performs $(BIGOH haystack.length) evaluations of $(D pred). +/ bool canFind(Range, Element)(Range haystack, scope Element needle) if (is(typeof(find!pred(haystack, needle)))) { return !find!pred(haystack, needle).empty; } /++ Returns the 1-based index of the first needle found in $(D haystack). If no needle is found, then $(D 0) is returned. So, if used directly in the condition of an if statement or loop, the result will be $(D true) if one of the needles is found and $(D false) if none are found, whereas if the result is used elsewhere, it can either be cast to $(D bool) for the same effect or used to get which needle was found first without having to deal with the tuple that $(D LREF find) returns for the same operation. +/ size_t canFind(Range, Ranges...)(Range haystack, scope Ranges needles) if (Ranges.length > 1 && allSatisfy!(isForwardRange, Ranges) && is(typeof(find!pred(haystack, needles)))) { return find!pred(haystack, needles)[1]; } } /// @safe unittest { assert(canFind([0, 1, 2, 3], 2) == true); assert(canFind([0, 1, 2, 3], [1, 2], [2, 3])); assert(canFind([0, 1, 2, 3], [1, 2], [2, 3]) == 1); assert(canFind([0, 1, 2, 3], [1, 7], [2, 3])); assert(canFind([0, 1, 2, 3], [1, 7], [2, 3]) == 2); assert(canFind([0, 1, 2, 3], 4) == false); assert(!canFind([0, 1, 2, 3], [1, 3], [2, 4])); assert(canFind([0, 1, 2, 3], [1, 3], [2, 4]) == 0); } /** * Example using a custom predicate. * Note that the needle appears as the second argument of the predicate. */ @safe unittest { auto words = [ "apple", "beeswax", "cardboard" ]; assert(!canFind(words, "bees")); assert( canFind!((string a, string b) => a.startsWith(b))(words, "bees")); } @safe unittest { import std.algorithm.internal : rndstuff; auto a = rndstuff!(int)(); if (a.length) { auto b = a[a.length / 2]; assert(canFind(a, b)); } } @safe unittest { import std.algorithm.comparison : equal; assert(equal!(canFind!"a < b")([[1, 2, 3], [7, 8, 9]], [2, 8])); } // findAdjacent /** Advances $(D r) until it finds the first two adjacent elements $(D a), $(D b) that satisfy $(D pred(a, b)). Performs $(BIGOH r.length) evaluations of $(D pred). Params: pred = The predicate to satisfy. r = A $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) to search in. Returns: $(D r) advanced to the first occurrence of two adjacent elements that satisfy the given predicate. If there are no such two elements, returns $(D r) advanced until empty. See_Also: $(HTTP sgi.com/tech/stl/adjacent_find.html, STL's adjacent_find) */ Range findAdjacent(alias pred = "a == b", Range)(Range r) if (isForwardRange!(Range)) { auto ahead = r.save; if (!ahead.empty) { for (ahead.popFront(); !ahead.empty; r.popFront(), ahead.popFront()) { if (binaryFun!(pred)(r.front, ahead.front)) return r; } } static if (!isInfinite!Range) return ahead; } /// @safe unittest { int[] a = [ 11, 10, 10, 9, 8, 8, 7, 8, 9 ]; auto r = findAdjacent(a); assert(r == [ 10, 10, 9, 8, 8, 7, 8, 9 ]); auto p = findAdjacent!("a < b")(a); assert(p == [ 7, 8, 9 ]); } @safe unittest { import std.algorithm.comparison : equal; import std.internal.test.dummyrange; import std.range; int[] a = [ 11, 10, 10, 9, 8, 8, 7, 8, 9 ]; auto p = findAdjacent(a); assert(p == [10, 10, 9, 8, 8, 7, 8, 9 ]); p = findAdjacent!("a < b")(a); assert(p == [7, 8, 9]); // empty a = []; p = findAdjacent(a); assert(p.empty); // not found a = [ 1, 2, 3, 4, 5 ]; p = findAdjacent(a); assert(p.empty); p = findAdjacent!"a > b"(a); assert(p.empty); ReferenceForwardRange!int rfr = new ReferenceForwardRange!int([1, 2, 3, 2, 2, 3]); assert(equal(findAdjacent(rfr), [2, 2, 3])); // Issue 9350 assert(!repeat(1).findAdjacent().empty); } // findAmong /** Searches the given range for an element that matches one of the given choices. Advances $(D seq) by calling $(D seq.popFront) until either $(D find!(pred)(choices, seq.front)) is $(D true), or $(D seq) becomes empty. Performs $(BIGOH seq.length * choices.length) evaluations of $(D pred). Params: pred = The predicate to use for determining a match. seq = The $(REF_ALTTEXT input range, isInputRange, std,range,primitives) to search. choices = A $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) of possible choices. Returns: $(D seq) advanced to the first matching element, or until empty if there are no matching elements. See_Also: $(HTTP sgi.com/tech/stl/find_first_of.html, STL's find_first_of) */ InputRange findAmong(alias pred = "a == b", InputRange, ForwardRange)( InputRange seq, ForwardRange choices) if (isInputRange!InputRange && isForwardRange!ForwardRange) { for (; !seq.empty && find!pred(choices, seq.front).empty; seq.popFront()) { } return seq; } /// @safe unittest { int[] a = [ -1, 0, 1, 2, 3, 4, 5 ]; int[] b = [ 3, 1, 2 ]; assert(findAmong(a, b) == a[2 .. $]); } @safe unittest { int[] a = [ -1, 0, 2, 1, 2, 3, 4, 5 ]; int[] b = [ 1, 2, 3 ]; assert(findAmong(a, b) == [2, 1, 2, 3, 4, 5 ]); assert(findAmong(b, [ 4, 6, 7 ][]).empty); assert(findAmong!("a == b")(a, b).length == a.length - 2); assert(findAmong!("a == b")(b, [ 4, 6, 7 ][]).empty); } // findSkip /** * Finds $(D needle) in $(D haystack) and positions $(D haystack) * right after the first occurrence of $(D needle). * * Params: * haystack = The * $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) to search * in. * needle = The * $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) to search * for. * pred = Custom predicate for comparison of haystack and needle * * Returns: $(D true) if the needle was found, in which case $(D haystack) is * positioned after the end of the first occurrence of $(D needle); otherwise * $(D false), leaving $(D haystack) untouched. */ bool findSkip(alias pred = "a == b", R1, R2)(ref R1 haystack, R2 needle) if (isForwardRange!R1 && isForwardRange!R2 && is(typeof(binaryFun!pred(haystack.front, needle.front)))) { auto parts = findSplit!pred(haystack, needle); if (parts[1].empty) return false; // found haystack = parts[2]; return true; } /// @safe unittest { import std.range.primitives : empty; // Needle is found; s is replaced by the substring following the first // occurrence of the needle. string s = "abcdef"; assert(findSkip(s, "cd") && s == "ef"); // Needle is not found; s is left untouched. s = "abcdef"; assert(!findSkip(s, "cxd") && s == "abcdef"); // If the needle occurs at the end of the range, the range is left empty. s = "abcdef"; assert(findSkip(s, "def") && s.empty); } /** * Advances the `haystack` as long as `pred` evaluates to `true`. * The haystack is positioned so as pred evaluates to false for haystack.front. * * Params: * haystack = The * $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) to search * in. * pred = Custom predicate for comparison of haystack and needle * * Returns: The number of times `pred(haystack.front)` returned true. */ size_t findSkip(alias pred, R1)(ref R1 haystack) if (isForwardRange!R1 && ifTestable!(typeof(haystack.front), unaryFun!pred)) { size_t result; while (!haystack.empty && unaryFun!pred(haystack.front)) { result++; haystack.popFront; } return result; } /// @safe unittest { import std.ascii : isWhite; string s = " abc"; assert(findSkip!isWhite(s) && s == "abc"); assert(!findSkip!isWhite(s) && s == "abc"); s = " "; assert(findSkip!isWhite(s) == 2); import std.stdio; s = " "; findSkip!isWhite(s).writeln; } @safe unittest { import std.ascii : isWhite; auto s = " "; assert(findSkip!isWhite(s) == 2); } /** These functions find the first occurrence of `needle` in `haystack` and then split `haystack` as follows. `findSplit` returns a tuple `result` containing $(I three) ranges. `result[0]` is the portion of `haystack` before `needle`, `result[1]` is the portion of `haystack` that matches `needle`, and `result[2]` is the portion of `haystack` after the match. If `needle` was not found, `result[0]` comprehends `haystack` entirely and `result[1]` and `result[2]` are empty. `findSplitBefore` returns a tuple `result` containing two ranges. `result[0]` is the portion of `haystack` before `needle`, and `result[1]` is the balance of `haystack` starting with the match. If `needle` was not found, `result[0]` comprehends `haystack` entirely and `result[1]` is empty. `findSplitAfter` returns a tuple `result` containing two ranges. `result[0]` is the portion of `haystack` up to and including the match, and `result[1]` is the balance of `haystack` starting after the match. If `needle` was not found, `result[0]` is empty and `result[1]` is `haystack`. In all cases, the concatenation of the returned ranges spans the entire `haystack`. If `haystack` is a random-access range, all three components of the tuple have the same type as `haystack`. Otherwise, `haystack` must be a $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) and the type of `result[0]` and `result[1]` is the same as $(REF takeExactly, std,range). Params: pred = Predicate to use for comparing needle against haystack. haystack = The range to search. needle = What to look for. Returns: A sub-type of `Tuple!()` of the split portions of `haystack` (see above for details). This sub-type of `Tuple!()` has `opCast` defined for `bool`. This `opCast` returns `true` when the separating `needle` was found (`!result[1].empty`) and `false` otherwise. */ auto findSplit(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) if (isForwardRange!R1 && isForwardRange!R2) { static struct Result(S1, S2) if (isForwardRange!S1 && isForwardRange!S2) { this(S1 pre, S1 separator, S2 post) { asTuple = typeof(asTuple)(pre, separator, post); } void opAssign(typeof(asTuple) rhs) { asTuple = rhs; } Tuple!(S1, S1, S2) asTuple; bool opCast(T : bool)() { return !asTuple[1].empty; } alias asTuple this; } static if (isSomeString!R1 && isSomeString!R2 || (isRandomAccessRange!R1 && hasSlicing!R1 && hasLength!R1 && hasLength!R2)) { auto balance = find!pred(haystack, needle); immutable pos1 = haystack.length - balance.length; immutable pos2 = balance.empty ? pos1 : pos1 + needle.length; return Result!(typeof(haystack[0 .. pos1]), typeof(haystack[pos2 .. haystack.length]))(haystack[0 .. pos1], haystack[pos1 .. pos2], haystack[pos2 .. haystack.length]); } else { import std.range : takeExactly; auto original = haystack.save; auto h = haystack.save; auto n = needle.save; size_t pos1, pos2; while (!n.empty && !h.empty) { if (binaryFun!pred(h.front, n.front)) { h.popFront(); n.popFront(); ++pos2; } else { haystack.popFront(); n = needle.save; h = haystack.save; pos2 = ++pos1; } } return Result!(typeof(takeExactly(original, pos1)), typeof(h))(takeExactly(original, pos1), takeExactly(haystack, pos2 - pos1), h); } } /// Ditto auto findSplitBefore(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) if (isForwardRange!R1 && isForwardRange!R2) { static struct Result(S1, S2) if (isForwardRange!S1 && isForwardRange!S2) { this(S1 pre, S2 post) { asTuple = typeof(asTuple)(pre, post); } void opAssign(typeof(asTuple) rhs) { asTuple = rhs; } Tuple!(S1, S2) asTuple; bool opCast(T : bool)() { return !asTuple[0].empty; } alias asTuple this; } static if (isSomeString!R1 && isSomeString!R2 || (isRandomAccessRange!R1 && hasLength!R1 && hasSlicing!R1 && hasLength!R2)) { auto balance = find!pred(haystack, needle); immutable pos = haystack.length - balance.length; return Result!(typeof(haystack[0 .. pos]), typeof(haystack[pos .. haystack.length]))(haystack[0 .. pos], haystack[pos .. haystack.length]); } else { import std.range : takeExactly; auto original = haystack.save; auto h = haystack.save; auto n = needle.save; size_t pos; while (!n.empty && !h.empty) { if (binaryFun!pred(h.front, n.front)) { h.popFront(); n.popFront(); } else { haystack.popFront(); n = needle.save; h = haystack.save; ++pos; } } return Result!(typeof(takeExactly(original, pos)), typeof(haystack))(takeExactly(original, pos), haystack); } } /// Ditto auto findSplitAfter(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) if (isForwardRange!R1 && isForwardRange!R2) { static struct Result(S1, S2) if (isForwardRange!S1 && isForwardRange!S2) { this(S1 pre, S2 post) { asTuple = typeof(asTuple)(pre, post); } void opAssign(typeof(asTuple) rhs) { asTuple = rhs; } Tuple!(S1, S2) asTuple; bool opCast(T : bool)() { return !asTuple[1].empty; } alias asTuple this; } static if (isSomeString!R1 && isSomeString!R2 || isRandomAccessRange!R1 && hasLength!R1 && hasSlicing!R1 && hasLength!R2) { auto balance = find!pred(haystack, needle); immutable pos = balance.empty ? 0 : haystack.length - balance.length + needle.length; return Result!(typeof(haystack[0 .. pos]), typeof(haystack[pos .. haystack.length]))(haystack[0 .. pos], haystack[pos .. haystack.length]); } else { import std.range : takeExactly; auto original = haystack.save; auto h = haystack.save; auto n = needle.save; size_t pos1, pos2; while (!n.empty) { if (h.empty) { // Failed search return Result!(typeof(takeExactly(original, 0)), typeof(original))(takeExactly(original, 0), original); } if (binaryFun!pred(h.front, n.front)) { h.popFront(); n.popFront(); ++pos2; } else { haystack.popFront(); n = needle.save; h = haystack.save; pos2 = ++pos1; } } return Result!(typeof(takeExactly(original, pos2)), typeof(h))(takeExactly(original, pos2), h); } } /// Returning a subtype of $(REF Tuple, std,typecons) enables /// the following convenient idiom: @safe pure nothrow unittest { // findSplit returns a triplet if (auto split = "dlang-rocks".findSplit("-")) assert(split[2] == "rocks"); } /// @safe pure nothrow unittest { import std.range.primitives : empty; auto a = "Carl Sagan Memorial Station"; auto r = findSplit(a, "Velikovsky"); import std.typecons : isTuple; static assert(isTuple!(typeof(r.asTuple))); static assert(isTuple!(typeof(r))); assert(!r); assert(r[0] == a); assert(r[1].empty); assert(r[2].empty); r = findSplit(a, " "); assert(r[0] == "Carl"); assert(r[1] == " "); assert(r[2] == "Sagan Memorial Station"); auto r1 = findSplitBefore(a, "Sagan"); assert(r1); assert(r1[0] == "Carl "); assert(r1[1] == "Sagan Memorial Station"); auto r2 = findSplitAfter(a, "Sagan"); assert(r2); assert(r2[0] == "Carl Sagan"); assert(r2[1] == " Memorial Station"); } /// Use $(REF only, std,range) to find single elements: @safe pure nothrow unittest { import std.range : only; assert([1, 2, 3, 4].findSplitBefore(only(3))[0] == [1, 2]); } @safe pure nothrow unittest { import std.range.primitives : empty; auto a = [ 1, 2, 3, 4, 5, 6, 7, 8 ]; auto r = findSplit(a, [9, 1]); assert(!r); assert(r[0] == a); assert(r[1].empty); assert(r[2].empty); r = findSplit(a, [3]); assert(r); assert(r[0] == a[0 .. 2]); assert(r[1] == a[2 .. 3]); assert(r[2] == a[3 .. $]); auto r1 = findSplitBefore(a, [9, 1]); assert(r1); assert(r1[0] == a); assert(r1[1].empty); r1 = findSplitBefore(a, [3, 4]); assert(r1); assert(r1[0] == a[0 .. 2]); assert(r1[1] == a[2 .. $]); auto r2 = findSplitAfter(a, [9, 1]); assert(r2); assert(r2[0].empty); assert(r2[1] == a); r2 = findSplitAfter(a, [3, 4]); assert(r2); assert(r2[0] == a[0 .. 4]); assert(r2[1] == a[4 .. $]); } @safe pure nothrow unittest { import std.algorithm.comparison : equal; import std.algorithm.iteration : filter; auto a = [ 1, 2, 3, 4, 5, 6, 7, 8 ]; auto fwd = filter!"a > 0"(a); auto r = findSplit(fwd, [9, 1]); assert(!r); assert(equal(r[0], a)); assert(r[1].empty); assert(r[2].empty); r = findSplit(fwd, [3]); assert(r); assert(equal(r[0], a[0 .. 2])); assert(equal(r[1], a[2 .. 3])); assert(equal(r[2], a[3 .. $])); auto r1 = findSplitBefore(fwd, [9, 1]); assert(r1); assert(equal(r1[0], a)); assert(r1[1].empty); r1 = findSplitBefore(fwd, [3, 4]); assert(r1); assert(equal(r1[0], a[0 .. 2])); assert(equal(r1[1], a[2 .. $])); auto r2 = findSplitAfter(fwd, [9, 1]); assert(r2); assert(r2[0].empty); assert(equal(r2[1], a)); r2 = findSplitAfter(fwd, [3, 4]); assert(r2); assert(equal(r2[0], a[0 .. 4])); assert(equal(r2[1], a[4 .. $])); } @safe pure nothrow @nogc unittest { auto str = "sep,one,sep,two"; auto split = str.findSplitAfter(","); assert(split[0] == "sep,"); split = split[1].findSplitAfter(","); assert(split[0] == "one,"); split = split[1].findSplitBefore(","); assert(split[0] == "sep"); } @safe pure nothrow @nogc unittest { auto str = "sep,one,sep,two"; auto split = str.findSplitBefore(",two"); assert(split[0] == "sep,one,sep"); assert(split[1] == ",two"); split = split[0].findSplitBefore(",sep"); assert(split[0] == "sep,one"); assert(split[1] == ",sep"); split = split[0].findSplitAfter(","); assert(split[0] == "sep,"); assert(split[1] == "one"); } // minCount /** Computes the minimum (respectively maximum) of `range` along with its number of occurrences. Formally, the minimum is a value `x` in `range` such that $(D pred(a, x)) is `false` for all values `a` in `range`. Conversely, the maximum is a value `x` in `range` such that $(D pred(x, a)) is `false` for all values `a` in `range` (note the swapped arguments to `pred`). These functions may be used for computing arbitrary extrema by choosing `pred` appropriately. For corrrect functioning, `pred` must be a strict partial order, i.e. transitive (if $(D pred(a, b) && pred(b, c)) then $(D pred(a, c))) and irreflexive ($(D pred(a, a)) is `false`). The $(LUCKY trichotomy property of inequality) is not required: these algoritms consider elements `a` and `b` equal (for the purpose of counting) if `pred` puts them in the same equivalence class, i.e. $(D !pred(a, b) && !pred(b, a)). Params: pred = The ordering predicate to use to determine the extremum (minimum or maximum). range = The $(REF_ALTTEXT input range, isInputRange, std,range,primitives) to count. Returns: The minimum, respectively maximum element of a range together with the number it occurs in the range. Throws: `Exception` if `range.empty`. */ Tuple!(ElementType!Range, size_t) minCount(alias pred = "a < b", Range)(Range range) if (isInputRange!Range && !isInfinite!Range && is(typeof(binaryFun!pred(range.front, range.front)))) { import std.algorithm.internal : algoFormat; import std.exception : enforce; alias T = ElementType!Range; alias UT = Unqual!T; alias RetType = Tuple!(T, size_t); static assert(is(typeof(RetType(range.front, 1))), algoFormat("Error: Cannot call minCount on a %s, because it is not possible "~ "to copy the result value (a %s) into a Tuple.", Range.stringof, T.stringof)); enforce(!range.empty, "Can't count elements from an empty range"); size_t occurrences = 1; static if (isForwardRange!Range) { Range least = range.save; for (range.popFront(); !range.empty; range.popFront()) { if (binaryFun!pred(least.front, range.front)) { assert(!binaryFun!pred(range.front, least.front), "min/maxPos: predicate must be a strict partial order."); continue; } if (binaryFun!pred(range.front, least.front)) { // change the min least = range.save; occurrences = 1; } else ++occurrences; } return RetType(least.front, occurrences); } else static if (isAssignable!(UT, T) || (!hasElaborateAssign!UT && isAssignable!UT)) { UT v = UT.init; static if (isAssignable!(UT, T)) v = range.front; else v = cast(UT) range.front; for (range.popFront(); !range.empty; range.popFront()) { if (binaryFun!pred(*cast(T*)&v, range.front)) continue; if (binaryFun!pred(range.front, *cast(T*)&v)) { // change the min static if (isAssignable!(UT, T)) v = range.front; else v = cast(UT) range.front; //Safe because !hasElaborateAssign!UT occurrences = 1; } else ++occurrences; } return RetType(*cast(T*)&v, occurrences); } else static if (hasLvalueElements!Range) { import std.algorithm.internal : addressOf; T* p = addressOf(range.front); for (range.popFront(); !range.empty; range.popFront()) { if (binaryFun!pred(*p, range.front)) continue; if (binaryFun!pred(range.front, *p)) { // change the min p = addressOf(range.front); occurrences = 1; } else ++occurrences; } return RetType(*p, occurrences); } else static assert(false, algoFormat("Sorry, can't find the minCount of a %s: Don't know how "~ "to keep track of the smallest %s element.", Range.stringof, T.stringof)); } /// Ditto Tuple!(ElementType!Range, size_t) maxCount(alias pred = "a < b", Range)(Range range) if (isInputRange!Range && !isInfinite!Range && is(typeof(binaryFun!pred(range.front, range.front)))) { return range.minCount!((a, b) => binaryFun!pred(b, a)); } /// @safe unittest { import std.conv : text; import std.typecons : tuple; int[] a = [ 2, 3, 4, 1, 2, 4, 1, 1, 2 ]; // Minimum is 1 and occurs 3 times assert(a.minCount == tuple(1, 3)); // Maximum is 4 and occurs 2 times assert(a.maxCount == tuple(4, 2)); } @system unittest { import std.conv : text; import std.exception : assertThrown; import std.internal.test.dummyrange; int[][] b = [ [4], [2, 4], [4], [4] ]; auto c = minCount!("a[0] < b[0]")(b); assert(c == tuple([2, 4], 1), text(c[0])); //Test empty range assertThrown(minCount(b[$..$])); //test with reference ranges. Test both input and forward. assert(minCount(new ReferenceInputRange!int([1, 2, 1, 0, 2, 0])) == tuple(0, 2)); assert(minCount(new ReferenceForwardRange!int([1, 2, 1, 0, 2, 0])) == tuple(0, 2)); } @system unittest { import std.conv : text; import std.meta : AliasSeq; static struct R(T) //input range { T[] arr; alias arr this; } immutable a = [ 2, 3, 4, 1, 2, 4, 1, 1, 2 ]; R!(immutable int) b = R!(immutable int)(a); assert(minCount(a) == tuple(1, 3)); assert(minCount(b) == tuple(1, 3)); assert(minCount!((ref immutable int a, ref immutable int b) => (a > b))(a) == tuple(4, 2)); assert(minCount!((ref immutable int a, ref immutable int b) => (a > b))(b) == tuple(4, 2)); immutable(int[])[] c = [ [4], [2, 4], [4], [4] ]; assert(minCount!("a[0] < b[0]")(c) == tuple([2, 4], 1), text(c[0])); static struct S1 { int i; } alias IS1 = immutable(S1); static assert( isAssignable!S1); static assert( isAssignable!(S1, IS1)); static struct S2 { int* p; this(ref immutable int i) immutable {p = &i;} this(ref int i) {p = &i;} @property ref inout(int) i() inout {return *p;} bool opEquals(const S2 other) const {return i == other.i;} } alias IS2 = immutable(S2); static assert( isAssignable!S2); static assert(!isAssignable!(S2, IS2)); static assert(!hasElaborateAssign!S2); static struct S3 { int i; void opAssign(ref S3 other) @disable; } static assert(!isAssignable!S3); foreach (Type; AliasSeq!(S1, IS1, S2, IS2, S3)) { static if (is(Type == immutable)) alias V = immutable int; else alias V = int; V one = 1, two = 2; auto r1 = [Type(two), Type(one), Type(one)]; auto r2 = R!Type(r1); assert(minCount!"a.i < b.i"(r1) == tuple(Type(one), 2)); assert(minCount!"a.i < b.i"(r2) == tuple(Type(one), 2)); assert(one == 1 && two == 2); } } /** Iterates the passed range and returns the minimal element. A custom mapping function can be passed to `map`. In other languages this is sometimes called `argmin`. Complexity: O(n) Exactly `n - 1` comparisons are needed. Params: map = custom accessor for the comparison key r = range from which the minimal element will be selected seed = custom seed to use as initial element Returns: The minimal element of the passed-in range. See_Also: $(REF min, std,algorithm,comparison) */ auto minElement(alias map, Range)(Range r) if (isInputRange!Range && !isInfinite!Range) { return extremum!map(r); } /// ditto auto minElement(Range)(Range r) if (isInputRange!Range && !isInfinite!Range) { return extremum(r); } /// ditto auto minElement(alias map, Range, RangeElementType = ElementType!Range) (Range r, RangeElementType seed) if (isInputRange!Range && !isInfinite!Range && !is(CommonType!(ElementType!Range, RangeElementType) == void)) { return extremum!map(r, seed); } /// ditto auto minElement(Range, RangeElementType = ElementType!Range) (Range r, RangeElementType seed) if (isInputRange!Range && !isInfinite!Range && !is(CommonType!(ElementType!Range, RangeElementType) == void)) { return extremum(r, seed); } /// @safe pure unittest { import std.range : enumerate; import std.typecons : tuple; assert([2, 1, 4, 3].minElement == 1); // allows to get the index of an element too assert([5, 3, 7, 9].enumerate.minElement!"a.value" == tuple(1, 3)); // any custom accessor can be passed assert([[0, 4], [1, 2]].minElement!"a[1]" == [1, 2]); // can be seeded int[] arr; assert(arr.minElement(1) == 1); } @safe pure unittest { import std.range : enumerate, iota; // supports mapping assert([3, 4, 5, 1, 2].enumerate.minElement!"a.value" == tuple(3, 1)); assert([5, 2, 4].enumerate.minElement!"a.value" == tuple(1, 2)); // forward ranges assert(iota(1, 5).minElement() == 1); assert(iota(2, 5).enumerate.minElement!"a.value" == tuple(0, 2)); // should work with const const(int)[] immArr = [2, 1, 3]; assert(immArr.minElement == 1); // should work with immutable immutable(int)[] immArr2 = [2, 1, 3]; assert(immArr2.minElement == 1); // with strings assert(["b", "a", "c"].minElement == "a"); // with all dummy ranges import std.internal.test.dummyrange; foreach (DummyType; AllDummyRanges) { DummyType d; assert(d.minElement == 1); assert(d.minElement!(a => a) == 1); } // with empty, but seeded ranges int[] arr; assert(arr.minElement(42) == 42); assert(arr.minElement!(a => a)(42) == 42); } @nogc @safe nothrow pure unittest { static immutable arr = [7, 3, 4, 2, 1, 8]; assert(arr.minElement == 1); static immutable arr2d = [[1, 9], [3, 1], [4, 2]]; assert(arr2d.minElement!"a[1]" == arr2d[1]); } /** Iterates the passed range and returns the maximal element. A custom mapping function can be passed to `map`. In other languages this is sometimes called `argmax`. Complexity: Exactly `n - 1` comparisons are needed. Params: map = custom accessor for the comparison key r = range from which the maximum will be selected seed = custom seed to use as initial element Returns: The maximal element of the passed-in range. See_Also: $(REF max, std,algorithm,comparison) */ auto maxElement(alias map, Range)(Range r) if (isInputRange!Range && !isInfinite!Range) { return extremum!(map, "a > b")(r); } /// ditto auto maxElement(Range)(Range r) if (isInputRange!Range && !isInfinite!Range) { return extremum!`a > b`(r); } /// ditto auto maxElement(alias map, Range, RangeElementType = ElementType!Range) (Range r, RangeElementType seed) if (isInputRange!Range && !isInfinite!Range && !is(CommonType!(ElementType!Range, RangeElementType) == void)) { return extremum!(map, "a > b")(r, seed); } /// ditto auto maxElement(Range, RangeElementType = ElementType!Range) (Range r, RangeElementType seed) if (isInputRange!Range && !isInfinite!Range && !is(CommonType!(ElementType!Range, RangeElementType) == void)) { return extremum!`a > b`(r, seed); } /// @safe pure unittest { import std.range : enumerate; import std.typecons : tuple; assert([2, 1, 4, 3].maxElement == 4); // allows to get the index of an element too assert([2, 1, 4, 3].enumerate.maxElement!"a.value" == tuple(2, 4)); // any custom accessor can be passed assert([[0, 4], [1, 2]].maxElement!"a[1]" == [0, 4]); // can be seeded int[] arr; assert(arr.minElement(1) == 1); } @safe pure unittest { import std.range : enumerate, iota; // supports mapping assert([3, 4, 5, 1, 2].enumerate.maxElement!"a.value" == tuple(2, 5)); assert([5, 2, 4].enumerate.maxElement!"a.value" == tuple(0, 5)); // forward ranges assert(iota(1, 5).maxElement() == 4); assert(iota(2, 5).enumerate.maxElement!"a.value" == tuple(2, 4)); assert(iota(4, 14).enumerate.maxElement!"a.value" == tuple(9, 13)); // should work with const const(int)[] immArr = [2, 3, 1]; assert(immArr.maxElement == 3); // should work with immutable immutable(int)[] immArr2 = [2, 3, 1]; assert(immArr2.maxElement == 3); // with strings assert(["a", "c", "b"].maxElement == "c"); // with all dummy ranges import std.internal.test.dummyrange; foreach (DummyType; AllDummyRanges) { DummyType d; assert(d.maxElement == 10); assert(d.maxElement!(a => a) == 10); } // with empty, but seeded ranges int[] arr; assert(arr.maxElement(42) == 42); assert(arr.maxElement!(a => a)(42) == 42); } @nogc @safe nothrow pure unittest { static immutable arr = [7, 3, 8, 2, 1, 4]; assert(arr.maxElement == 8); static immutable arr2d = [[1, 3], [3, 9], [4, 2]]; assert(arr2d.maxElement!"a[1]" == arr2d[1]); } // minPos /** Computes a subrange of `range` starting at the first occurrence of `range`'s minimum (respectively maximum) and with the same ending as `range`, or the empty range if `range` itself is empty. Formally, the minimum is a value `x` in `range` such that $(D pred(a, x)) is `false` for all values `a` in `range`. Conversely, the maximum is a value `x` in `range` such that $(D pred(x, a)) is `false` for all values `a` in `range` (note the swapped arguments to `pred`). These functions may be used for computing arbitrary extrema by choosing `pred` appropriately. For corrrect functioning, `pred` must be a strict partial order, i.e. transitive (if $(D pred(a, b) && pred(b, c)) then $(D pred(a, c))) and irreflexive ($(D pred(a, a)) is `false`). Params: pred = The ordering predicate to use to determine the extremum (minimum or maximum) element. range = The $(REF_ALTTEXT input range, isInputRange, std,range,primitives) to search. Returns: The position of the minimum (respectively maximum) element of forward range `range`, i.e. a subrange of `range` starting at the position of its smallest (respectively largest) element and with the same ending as `range`. */ Range minPos(alias pred = "a < b", Range)(Range range) if (isForwardRange!Range && !isInfinite!Range && is(typeof(binaryFun!pred(range.front, range.front)))) { static if (hasSlicing!Range && isRandomAccessRange!Range && hasLength!Range) { // Prefer index-based access size_t pos = 0; foreach (i; 1 .. range.length) { if (binaryFun!pred(range[i], range[pos])) { pos = i; } } return range[pos .. range.length]; } else { auto result = range.save; if (range.empty) return result; for (range.popFront(); !range.empty; range.popFront()) { // Note: Unlike minCount, we do not care to find equivalence, so a // single pred call is enough. if (binaryFun!pred(range.front, result.front)) { // change the min result = range.save; } } return result; } } /// Ditto Range maxPos(alias pred = "a < b", Range)(Range range) if (isForwardRange!Range && !isInfinite!Range && is(typeof(binaryFun!pred(range.front, range.front)))) { return range.minPos!((a, b) => binaryFun!pred(b, a)); } /// @safe unittest { int[] a = [ 2, 3, 4, 1, 2, 4, 1, 1, 2 ]; // Minimum is 1 and first occurs in position 3 assert(a.minPos == [ 1, 2, 4, 1, 1, 2 ]); // Maximum is 4 and first occurs in position 2 assert(a.maxPos == [ 4, 1, 2, 4, 1, 1, 2 ]); } @safe unittest { import std.algorithm.comparison : equal; import std.internal.test.dummyrange; int[] a = [ 2, 3, 4, 1, 2, 4, 1, 1, 2 ]; //Test that an empty range works int[] b = a[$..$]; assert(equal(minPos(b), b)); //test with reference range. assert( equal( minPos(new ReferenceForwardRange!int([1, 2, 1, 0, 2, 0])), [0, 2, 0] ) ); } @system unittest { //Rvalue range import std.algorithm.comparison : equal; import std.container : Array; assert(Array!int(2, 3, 4, 1, 2, 4, 1, 1, 2) [] .minPos() .equal([ 1, 2, 4, 1, 1, 2 ])); } @safe unittest { //BUG 9299 immutable a = [ 2, 3, 4, 1, 2, 4, 1, 1, 2 ]; // Minimum is 1 and first occurs in position 3 assert(minPos(a) == [ 1, 2, 4, 1, 1, 2 ]); // Maximum is 4 and first occurs in position 5 assert(minPos!("a > b")(a) == [ 4, 1, 2, 4, 1, 1, 2 ]); immutable(int[])[] b = [ [4], [2, 4], [4], [4] ]; assert(minPos!("a[0] < b[0]")(b) == [ [2, 4], [4], [4] ]); } /** Computes the index of the first occurrence of `range`'s minimum element. Params: pred = The ordering predicate to use to determine the minimum element. range = The $(REF_ALTTEXT input range, isInputRange, std,range,primitives) to search. Complexity: O(n) Exactly `n - 1` comparisons are needed. Returns: The index of the first encounter of the minimum element in `range`. If the `range` is empty, -1 is returned. See_Also: $(REF min, std,algorithm,comparison), $(LREF minCount), $(LREF minElement), $(LREF minPos) */ sizediff_t minIndex(alias pred = "a < b", Range)(Range range) if (isForwardRange!Range && !isInfinite!Range && is(typeof(binaryFun!pred(range.front, range.front)))) { if (range.empty) return -1; sizediff_t minPos = 0; static if (isRandomAccessRange!Range && hasLength!Range) { foreach (i; 1 .. range.length) { if (binaryFun!pred(range[i], range[minPos])) { minPos = i; } } } else { sizediff_t curPos = 0; Unqual!(typeof(range.front)) min = range.front; for (range.popFront(); !range.empty; range.popFront()) { ++curPos; if (binaryFun!pred(range.front, min)) { min = range.front; minPos = curPos; } } } return minPos; } /// @safe pure nothrow unittest { int[] a = [2, 3, 4, 1, 2, 4, 1, 1, 2]; // Minimum is 1 and first occurs in position 3 assert(a.minIndex == 3); // Get maximum index with minIndex assert(a.minIndex!"a > b" == 2); // Range is empty, so return value is -1 int[] b; assert(b.minIndex == -1); // Works with more custom types struct Dog { int age; } Dog[] dogs = [Dog(10), Dog(5), Dog(15)]; assert(dogs.minIndex!"a.age < b.age" == 1); } @safe pure unittest { // should work with const const(int)[] immArr = [2, 1, 3]; assert(immArr.minIndex == 1); // Works for const ranges too const int[] c = [2, 5, 4, 1, 2, 3]; assert(c.minIndex == 3); // should work with immutable immutable(int)[] immArr2 = [2, 1, 3]; assert(immArr2.minIndex == 1); // with strings assert(["b", "a", "c"].minIndex == 1); // infinite range import std.range : cycle; static assert(!__traits(compiles, cycle([1]).minIndex)); // with all dummy ranges import std.internal.test.dummyrange : AllDummyRanges; foreach (DummyType; AllDummyRanges) { static if (isForwardRange!DummyType && !isInfinite!DummyType) { DummyType d; d.arr = [5, 3, 7, 2, 1, 4]; assert(d.minIndex == 4); d.arr = []; assert(d.minIndex == -1); } } } @nogc @safe nothrow pure unittest { static immutable arr = [7, 3, 8, 2, 1, 4]; assert(arr.minIndex == 4); static immutable arr2d = [[1, 3], [3, 9], [4, 2]]; assert(arr2d.minIndex!"a[1] < b[1]" == 2); } /** Computes the index of the first occurrence of `range`'s maximum element. Complexity: O(n) Exactly `n - 1` comparisons are needed. Params: pred = The ordering predicate to use to determine the maximum element. range = The $(REF_ALTTEXT input range, isInputRange, std,range,primitives) to search. Returns: The index of the first encounter of the maximum in `range`. If the `range` is empty, -1 is returned. See_Also: $(REF max, std,algorithm,comparison), $(LREF maxCount), $(LREF maxElement), $(LREF maxPos) */ sizediff_t maxIndex(alias pred = "a < b", Range)(Range range) if (isInputRange!Range && !isInfinite!Range && is(typeof(binaryFun!pred(range.front, range.front)))) { return range.minIndex!((a, b) => binaryFun!pred(b, a)); } /// @safe pure nothrow unittest { // Maximum is 4 and first occurs in position 2 int[] a = [2, 3, 4, 1, 2, 4, 1, 1, 2]; assert(a.maxIndex == 2); // Empty range int[] b; assert(b.maxIndex == -1); // Works with more custom types struct Dog { int age; } Dog[] dogs = [Dog(10), Dog(15), Dog(5)]; assert(dogs.maxIndex!"a.age < b.age" == 1); } @safe pure unittest { // should work with const const(int)[] immArr = [5, 1, 3]; assert(immArr.maxIndex == 0); // Works for const ranges too const int[] c = [2, 5, 4, 1, 2, 3]; assert(c.maxIndex == 1); // should work with immutable immutable(int)[] immArr2 = [2, 1, 3]; assert(immArr2.maxIndex == 2); // with strings assert(["b", "a", "c"].maxIndex == 2); // infinite range import std.range : cycle; static assert(!__traits(compiles, cycle([1]).maxIndex)); // with all dummy ranges import std.internal.test.dummyrange : AllDummyRanges; foreach (DummyType; AllDummyRanges) { static if (isForwardRange!DummyType && !isInfinite!DummyType) { DummyType d; d.arr = [5, 3, 7, 2, 1, 4]; assert(d.maxIndex == 2); d.arr = []; assert(d.maxIndex == -1); } } } @nogc @safe nothrow pure unittest { static immutable arr = [7, 3, 8, 2, 1, 4]; assert(arr.maxIndex == 2); static immutable arr2d = [[1, 3], [3, 9], [4, 2]]; assert(arr2d.maxIndex!"a[1] < b[1]" == 1); } /** Skip over the initial portion of the first given range that matches the second range, or if no second range is given skip over the elements that fullfil pred. Do nothing if there is no match. Params: pred = The predicate that determines whether elements from each respective range match. Defaults to equality $(D "a == b"). */ template skipOver(alias pred = "a == b") { /** r1 = The $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) to move forward. r2 = The $(REF_ALTTEXT input range, isInputRange, std,range,primitives) representing the initial segment of $(D r1) to skip over. e = The element to match. Returns: true if the initial segment of $(D r1) matches $(D r2) or $(D pred) evaluates to true, and $(D r1) has been advanced to the point past this segment; otherwise false, and $(D r1) is left in its original position. */ bool skipOver(R1, R2)(ref R1 r1, R2 r2) if (is(typeof(binaryFun!pred(r1.front, r2.front))) && isForwardRange!R1 && isInputRange!R2) { static if (is(typeof(pred) : string) && pred == "a == b" && is(typeof(r1[0 .. $] == r2) : bool) && is(typeof(r2.length > r1.length) : bool) && is(typeof(r1 = r1[r2.length .. $]))) { if (r2.length > r1.length || r1[0 .. r2.length] != r2) { return false; } r1 = r1[r2.length .. $]; return true; } else { static if (hasLength!R1 && hasLength!R2) { // Shortcut opportunity! if (r2.length > r1.length) return false; } auto r = r1.save; while (!r2.empty && !r.empty && binaryFun!pred(r.front, r2.front)) { r.popFront(); r2.popFront(); } if (r2.empty) r1 = r; return r2.empty; } } /// Ditto bool skipOver(R)(ref R r1) if (isForwardRange!R && ifTestable!(typeof(r1.front), unaryFun!pred)) { if (r1.empty || !unaryFun!pred(r1.front)) return false; do r1.popFront(); while (!r1.empty && unaryFun!pred(r1.front)); return true; } /// Ditto bool skipOver(R, E)(ref R r, E e) if (is(typeof(binaryFun!pred(r.front, e))) && isInputRange!R) { if (r.empty || !binaryFun!pred(r.front, e)) return false; r.popFront(); return true; } } /// @safe unittest { import std.algorithm.comparison : equal; auto s1 = "Hello world"; assert(!skipOver(s1, "Ha")); assert(s1 == "Hello world"); assert(skipOver(s1, "Hell") && s1 == "o world"); string[] r1 = ["abc", "def", "hij"]; dstring[] r2 = ["abc"d]; assert(!skipOver!((a, b) => a.equal(b))(r1, ["def"d])); assert(r1 == ["abc", "def", "hij"]); assert(skipOver!((a, b) => a.equal(b))(r1, r2)); assert(r1 == ["def", "hij"]); import std.ascii : isWhite; import std.range.primitives : empty; auto s2 = "\t\tvalue"; auto s3 = ""; auto s4 = "\t\t\t"; assert(s2.skipOver!isWhite && s2 == "value"); assert(!s3.skipOver!isWhite); assert(s4.skipOver!isWhite && s3.empty); } /// @safe unittest { import std.algorithm.comparison : equal; auto s1 = "Hello world"; assert(!skipOver(s1, 'a')); assert(s1 == "Hello world"); assert(skipOver(s1, 'H') && s1 == "ello world"); string[] r = ["abc", "def", "hij"]; dstring e = "abc"d; assert(!skipOver!((a, b) => a.equal(b))(r, "def"d)); assert(r == ["abc", "def", "hij"]); assert(skipOver!((a, b) => a.equal(b))(r, e)); assert(r == ["def", "hij"]); auto s2 = ""; assert(!s2.skipOver('a')); } /// Partial instantiation @safe unittest { import std.ascii : isWhite; import std.range.primitives : empty; alias whitespaceSkiper = skipOver!isWhite; auto s2 = "\t\tvalue"; auto s3 = ""; auto s4 = "\t\t\t"; assert(whitespaceSkiper(s2) && s2 == "value"); assert(!whitespaceSkiper(s2)); assert(whitespaceSkiper(s4) && s3.empty); } /** Checks whether the given $(REF_ALTTEXT input range, isInputRange, std,range,primitives) starts with (one of) the given needle(s) or, if no needles are given, if its front element fulfils predicate $(D pred). Params: pred = Predicate to use in comparing the elements of the haystack and the needle(s). Mandatory if no needles are given. doesThisStart = The input range to check. withOneOfThese = The needles against which the range is to be checked, which may be individual elements or input ranges of elements. withThis = The single needle to check, which may be either a single element or an input range of elements. Returns: 0 if the needle(s) do not occur at the beginning of the given range; otherwise the position of the matching needle, that is, 1 if the range starts with $(D withOneOfThese[0]), 2 if it starts with $(D withOneOfThese[1]), and so on. In the case where $(D doesThisStart) starts with multiple of the ranges or elements in $(D withOneOfThese), then the shortest one matches (if there are two which match which are of the same length (e.g. $(D "a") and $(D 'a')), then the left-most of them in the argument list matches). In the case when no needle parameters are given, return $(D true) iff front of $(D doesThisStart) fulfils predicate $(D pred). */ uint startsWith(alias pred = "a == b", Range, Needles...)(Range doesThisStart, Needles withOneOfThese) if (isInputRange!Range && Needles.length > 1 && is(typeof(.startsWith!pred(doesThisStart, withOneOfThese[0])) : bool ) && is(typeof(.startsWith!pred(doesThisStart, withOneOfThese[1 .. $])) : uint)) { alias haystack = doesThisStart; alias needles = withOneOfThese; // Make one pass looking for empty ranges in needles foreach (i, Unused; Needles) { // Empty range matches everything static if (!is(typeof(binaryFun!pred(haystack.front, needles[i])) : bool)) { if (needles[i].empty) return i + 1; } } for (; !haystack.empty; haystack.popFront()) { foreach (i, Unused; Needles) { static if (is(typeof(binaryFun!pred(haystack.front, needles[i])) : bool)) { // Single-element if (binaryFun!pred(haystack.front, needles[i])) { // found, but instead of returning, we just stop searching. // This is to account for one-element // range matches (consider startsWith("ab", "a", // 'a') should return 1, not 2). break; } } else { if (binaryFun!pred(haystack.front, needles[i].front)) { continue; } } // This code executed on failure to match // Out with this guy, check for the others uint result = startsWith!pred(haystack, needles[0 .. i], needles[i + 1 .. $]); if (result > i) ++result; return result; } // If execution reaches this point, then the front matches for all // needle ranges, or a needle element has been matched. // What we need to do now is iterate, lopping off the front of // the range and checking if the result is empty, or finding an // element needle and returning. // If neither happens, we drop to the end and loop. foreach (i, Unused; Needles) { static if (is(typeof(binaryFun!pred(haystack.front, needles[i])) : bool)) { // Test has passed in the previous loop return i + 1; } else { needles[i].popFront(); if (needles[i].empty) return i + 1; } } } return 0; } /// Ditto bool startsWith(alias pred = "a == b", R1, R2)(R1 doesThisStart, R2 withThis) if (isInputRange!R1 && isInputRange!R2 && is(typeof(binaryFun!pred(doesThisStart.front, withThis.front)) : bool)) { alias haystack = doesThisStart; alias needle = withThis; static if (is(typeof(pred) : string)) enum isDefaultPred = pred == "a == b"; else enum isDefaultPred = false; //Note: While narrow strings don't have a "true" length, for a narrow string to start with another //narrow string *of the same type*, it must have *at least* as many code units. static if ((hasLength!R1 && hasLength!R2) || (isNarrowString!R1 && isNarrowString!R2 && ElementEncodingType!R1.sizeof == ElementEncodingType!R2.sizeof)) { if (haystack.length < needle.length) return false; } static if (isDefaultPred && isArray!R1 && isArray!R2 && is(Unqual!(ElementEncodingType!R1) == Unqual!(ElementEncodingType!R2))) { //Array slice comparison mode return haystack[0 .. needle.length] == needle; } else static if (isRandomAccessRange!R1 && isRandomAccessRange!R2 && hasLength!R2) { //RA dual indexing mode foreach (j; 0 .. needle.length) { if (!binaryFun!pred(haystack[j], needle[j])) // not found return false; } // found! return true; } else { //Standard input range mode if (needle.empty) return true; static if (hasLength!R1 && hasLength!R2) { //We have previously checked that haystack.length > needle.length, //So no need to check haystack.empty during iteration for ( ; ; haystack.popFront() ) { if (!binaryFun!pred(haystack.front, needle.front)) break; needle.popFront(); if (needle.empty) return true; } } else { for ( ; !haystack.empty ; haystack.popFront() ) { if (!binaryFun!pred(haystack.front, needle.front)) break; needle.popFront(); if (needle.empty) return true; } } return false; } } /// Ditto bool startsWith(alias pred = "a == b", R, E)(R doesThisStart, E withThis) if (isInputRange!R && is(typeof(binaryFun!pred(doesThisStart.front, withThis)) : bool)) { if (doesThisStart.empty) return false; alias predFunc = binaryFun!pred; // auto-decoding special case static if (isNarrowString!R) { // specialize for ASCII as to not change previous behavior if (withThis <= 0x7F) return predFunc(doesThisStart[0], withThis); else return predFunc(doesThisStart.front, withThis); } else { return predFunc(doesThisStart.front, withThis); } } /// Ditto bool startsWith(alias pred, R)(R doesThisStart) if (isInputRange!R && ifTestable!(typeof(doesThisStart.front), unaryFun!pred)) { return !doesThisStart.empty && unaryFun!pred(doesThisStart.front); } /// @safe unittest { import std.ascii : isAlpha; assert("abc".startsWith!(a => a.isAlpha)); assert("abc".startsWith!isAlpha); assert(!"1ab".startsWith!(a => a.isAlpha)); assert(!"".startsWith!(a => a.isAlpha)); import std.algorithm.comparison : among; assert("abc".startsWith!(a => a.among('a', 'b') != 0)); assert(!"abc".startsWith!(a => a.among('b', 'c') != 0)); assert(startsWith("abc", "")); assert(startsWith("abc", "a")); assert(!startsWith("abc", "b")); assert(startsWith("abc", 'a', "b") == 1); assert(startsWith("abc", "b", "a") == 2); assert(startsWith("abc", "a", "a") == 1); assert(startsWith("abc", "ab", "a") == 2); assert(startsWith("abc", "x", "a", "b") == 2); assert(startsWith("abc", "x", "aa", "ab") == 3); assert(startsWith("abc", "x", "aaa", "sab") == 0); assert(startsWith("abc", "x", "aaa", "a", "sab") == 3); import std.typecons : Tuple; alias C = Tuple!(int, "x", int, "y"); assert(startsWith!"a.x == b"([ C(1,1), C(1,2), C(2,2) ], [1, 1])); assert(startsWith!"a.x == b"([ C(1,1), C(2,1), C(2,2) ], [1, 1], [1, 2], [1, 3]) == 2); } @safe unittest { import std.algorithm.iteration : filter; import std.conv : to; import std.meta : AliasSeq; import std.range; foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) { assert(!startsWith(to!S("abc"), 'c')); assert(startsWith(to!S("abc"), 'a', 'c') == 1); assert(!startsWith(to!S("abc"), 'x', 'n', 'b')); assert(startsWith(to!S("abc"), 'x', 'n', 'a') == 3); assert(startsWith(to!S("\uFF28abc"), 'a', '\uFF28', 'c') == 2); foreach (T; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 //Lots of strings assert(startsWith(to!S("abc"), to!T(""))); assert(startsWith(to!S("ab"), to!T("a"))); assert(startsWith(to!S("abc"), to!T("a"))); assert(!startsWith(to!S("abc"), to!T("b"))); assert(!startsWith(to!S("abc"), to!T("b"), "bc", "abcd", "xyz")); assert(startsWith(to!S("abc"), to!T("ab"), 'a') == 2); assert(startsWith(to!S("abc"), to!T("a"), "b") == 1); assert(startsWith(to!S("abc"), to!T("b"), "a") == 2); assert(startsWith(to!S("abc"), to!T("a"), 'a') == 1); assert(startsWith(to!S("abc"), 'a', to!T("a")) == 1); assert(startsWith(to!S("abc"), to!T("x"), "a", "b") == 2); assert(startsWith(to!S("abc"), to!T("x"), "aa", "ab") == 3); assert(startsWith(to!S("abc"), to!T("x"), "aaa", "sab") == 0); assert(startsWith(to!S("abc"), 'a')); assert(!startsWith(to!S("abc"), to!T("sab"))); assert(startsWith(to!S("abc"), 'x', to!T("aaa"), 'a', "sab") == 3); //Unicode assert(startsWith(to!S("\uFF28el\uFF4co"), to!T("\uFF28el"))); assert(startsWith(to!S("\uFF28el\uFF4co"), to!T("Hel"), to!T("\uFF28el")) == 2); assert(startsWith(to!S("日本語"), to!T("日本"))); assert(startsWith(to!S("日本語"), to!T("日本語"))); assert(!startsWith(to!S("日本"), to!T("日本語"))); //Empty assert(startsWith(to!S(""), T.init)); assert(!startsWith(to!S(""), 'a')); assert(startsWith(to!S("a"), T.init)); assert(startsWith(to!S("a"), T.init, "") == 1); assert(startsWith(to!S("a"), T.init, 'a') == 1); assert(startsWith(to!S("a"), 'a', T.init) == 2); }(); } //Length but no RA assert(!startsWith("abc".takeExactly(3), "abcd".takeExactly(4))); assert(startsWith("abc".takeExactly(3), "abcd".takeExactly(3))); assert(startsWith("abc".takeExactly(3), "abcd".takeExactly(1))); foreach (T; AliasSeq!(int, short)) { immutable arr = cast(T[])[0, 1, 2, 3, 4, 5]; //RA range assert(startsWith(arr, cast(int[]) null)); assert(!startsWith(arr, 5)); assert(!startsWith(arr, 1)); assert(startsWith(arr, 0)); assert(startsWith(arr, 5, 0, 1) == 2); assert(startsWith(arr, [0])); assert(startsWith(arr, [0, 1])); assert(startsWith(arr, [0, 1], 7) == 1); assert(!startsWith(arr, [0, 1, 7])); assert(startsWith(arr, [0, 1, 7], [0, 1, 2]) == 2); //Normal input range assert(!startsWith(filter!"true"(arr), 1)); assert(startsWith(filter!"true"(arr), 0)); assert(startsWith(filter!"true"(arr), [0])); assert(startsWith(filter!"true"(arr), [0, 1])); assert(startsWith(filter!"true"(arr), [0, 1], 7) == 1); assert(!startsWith(filter!"true"(arr), [0, 1, 7])); assert(startsWith(filter!"true"(arr), [0, 1, 7], [0, 1, 2]) == 2); assert(startsWith(arr, filter!"true"([0, 1]))); assert(startsWith(arr, filter!"true"([0, 1]), 7) == 1); assert(!startsWith(arr, filter!"true"([0, 1, 7]))); assert(startsWith(arr, [0, 1, 7], filter!"true"([0, 1, 2])) == 2); //Non-default pred assert(startsWith!("a%10 == b%10")(arr, [10, 11])); assert(!startsWith!("a%10 == b%10")(arr, [10, 12])); } } /* (Not yet documented.) Consume all elements from $(D r) that are equal to one of the elements $(D es). */ private void skipAll(alias pred = "a == b", R, Es...)(ref R r, Es es) //if (is(typeof(binaryFun!pred(r1.front, es[0])))) { loop: for (; !r.empty; r.popFront()) { foreach (i, E; Es) { if (binaryFun!pred(r.front, es[i])) { continue loop; } } break; } } @safe unittest { auto s1 = "Hello world"; skipAll(s1, 'H', 'e'); assert(s1 == "llo world"); } /** Interval option specifier for `until` (below) and others. If set to $(D OpenRight.yes), then the interval is open to the right (last element is not included). Otherwise if set to $(D OpenRight.no), then the interval is closed to the right (last element included). */ alias OpenRight = Flag!"openRight"; /** Lazily iterates $(D range) _until the element $(D e) for which $(D pred(e, sentinel)) is true. This is similar to `takeWhile` in other languages. Params: pred = Predicate to determine when to stop. range = The $(REF_ALTTEXT input _range, isInputRange, std,_range,primitives) to iterate over. sentinel = The element to stop at. openRight = Determines whether the element for which the given predicate is true should be included in the resulting range ($(D No.openRight)), or not ($(D Yes.openRight)). Returns: An $(REF_ALTTEXT input _range, isInputRange, std,_range,primitives) that iterates over the original range's elements, but ends when the specified predicate becomes true. If the original range is a $(REF_ALTTEXT forward _range, isForwardRange, std,_range,primitives) or higher, this range will be a forward range. */ Until!(pred, Range, Sentinel) until(alias pred = "a == b", Range, Sentinel) (Range range, Sentinel sentinel, OpenRight openRight = Yes.openRight) if (!is(Sentinel == OpenRight)) { return typeof(return)(range, sentinel, openRight); } /// Ditto Until!(pred, Range, void) until(alias pred, Range) (Range range, OpenRight openRight = Yes.openRight) { return typeof(return)(range, openRight); } /// ditto struct Until(alias pred, Range, Sentinel) if (isInputRange!Range) { private Range _input; static if (!is(Sentinel == void)) private Sentinel _sentinel; private OpenRight _openRight; private bool _done; static if (!is(Sentinel == void)) /// this(Range input, Sentinel sentinel, OpenRight openRight = Yes.openRight) { _input = input; _sentinel = sentinel; _openRight = openRight; _done = _input.empty || openRight && predSatisfied(); } else /// this(Range input, OpenRight openRight = Yes.openRight) { _input = input; _openRight = openRight; _done = _input.empty || openRight && predSatisfied(); } /// @property bool empty() { return _done; } /// @property auto ref front() { assert(!empty); return _input.front; } private bool predSatisfied() { static if (is(Sentinel == void)) return cast(bool) unaryFun!pred(_input.front); else return cast(bool) startsWith!pred(_input, _sentinel); } /// void popFront() { assert(!empty); if (!_openRight) { _done = predSatisfied(); _input.popFront(); _done = _done || _input.empty; } else { _input.popFront(); _done = _input.empty || predSatisfied(); } } static if (isForwardRange!Range) { static if (!is(Sentinel == void)) /// @property Until save() { Until result = this; result._input = _input.save; result._sentinel = _sentinel; result._openRight = _openRight; result._done = _done; return result; } else /// @property Until save() { Until result = this; result._input = _input.save; result._openRight = _openRight; result._done = _done; return result; } } } /// @safe unittest { import std.algorithm.comparison : equal; import std.typecons : No; int[] a = [ 1, 2, 4, 7, 7, 2, 4, 7, 3, 5]; assert(equal(a.until(7), [1, 2, 4])); assert(equal(a.until(7, No.openRight), [1, 2, 4, 7])); } @safe unittest { import std.algorithm.comparison : equal; int[] a = [ 1, 2, 4, 7, 7, 2, 4, 7, 3, 5]; static assert(isForwardRange!(typeof(a.until(7)))); static assert(isForwardRange!(typeof(until!"a == 2"(a, No.openRight)))); assert(equal(a.until(7), [1, 2, 4])); assert(equal(a.until([7, 2]), [1, 2, 4, 7])); assert(equal(a.until(7, No.openRight), [1, 2, 4, 7])); assert(equal(until!"a == 2"(a, No.openRight), [1, 2])); } @system unittest // bugzilla 13171 { import std.algorithm.comparison : equal; import std.range; auto a = [1, 2, 3, 4]; assert(equal(refRange(&a).until(3, No.openRight), [1, 2, 3])); assert(a == [4]); } @safe unittest // Issue 10460 { import std.algorithm.comparison : equal; auto a = [1, 2, 3, 4]; foreach (ref e; a.until(3)) e = 0; assert(equal(a, [0, 0, 3, 4])); } @safe unittest // Issue 13124 { import std.algorithm.comparison : among, equal; auto s = "hello how\nare you"; assert(equal(s.until!(c => c.among!('\n', '\r')), "hello how")); }
D
module utils; import core.time; import std.traits; import rx; import dlangui.core.signals; import dlangui.widgets.widget; ///Wrap a Signal!T as Observable auto asObservable(T)(ref T signal) if (is(T == Signal!U, U) && is(U == interface)) { static if (is(T == Signal!U, U)) { alias return_t = ReturnType!(__traits(getMember, U, __traits(allMembers, U)[0])); alias param_t = ParameterTypeTuple!(__traits(getMember, U, __traits(allMembers, U)[0])); static assert(param_t.length == 1); } static struct LocalObservable { alias ElementType = param_t[0]; this(ref T signal) { _subscribe = (Observer!ElementType o) { auto dg = (ElementType w) { o.put(w); static if (is(return_t == bool)) { return true; } }; signal.connect(dg); return new AnonymousDisposable({ signal.disconnect(dg); }); }; } auto subscribe(U)(U observer) { return _subscribe(observerObject!ElementType(observer)); } Disposable delegate(Observer!ElementType) _subscribe; } return LocalObservable(signal); } struct TimerHandler { CancellationToken token; void delegate() action; } class DlangUIScheduler : Widget, AsyncScheduler { TimerHandler[ulong] _actions; Object _gate = new Object(); ulong _timerId; void start(void delegate() op) { auto id = setTimer(0); synchronized (_gate) { _actions[id] = TimerHandler(null, op); } } CancellationToken schedule(void delegate() op, Duration val) { auto ms = val.total!"msecs"; auto id = setTimer(ms); auto token = new CancellationToken(); synchronized (_gate) { _actions[id] = TimerHandler(token, op); } return token; } override bool onTimer(ulong id) { CancellationToken token; void delegate() action; synchronized (_gate) { auto temp = id in _actions; if (temp) { token = (*temp).token; action = (*temp).action; _actions.remove(id); } else { return false; } } if (token is null || !token.isCanceled) { action(); return true; } return false; } }
D
instance NOV_612_BABO(NPC_DEFAULT) { name[0] = "Бабо"; guild = GIL_NOV; id = 612; voice = 3; flags = 0; npctype = NPCTYPE_MAIN; b_setattributestochapter(self,2); fight_tactic = FAI_HUMAN_COWARD; EquipItem(self,itmw_1h_nov_mace); b_createambientinv(self); b_setnpcvisual(self,MALE,"Hum_Head_Fighter",FACE_N_NORMAL07,BODYTEX_N,itar_nov_l); Mdl_SetModelFatness(self,-1); Mdl_ApplyOverlayMds(self,"Humans_Mage.mds"); b_givenpctalents(self); b_setfightskills(self,30); daily_routine = rtn_start_612; }; func void rtn_start_612() { ta_stand_sweeping(8,0,14,0,"NW_MONASTERY_CORRIDOR_10"); ta_pray_innos_fp(14,0,15,0,"NW_MONASTERY_CHURCH_03"); ta_stand_sweeping(15,0,23,30,"NW_MONASTERY_CORRIDOR_10"); ta_sleep(23,30,8,0,"NW_MONASTERY_NOVICE04_05"); }; func void rtn_train_612() { ta_sleep(23,30,5,0,"NW_MONASTERY_NOVICE04_05"); ta_practice_sword(5,0,7,0,"NW_MONASTERY_TRAIN_02"); ta_stand_sweeping(7,0,14,0,"NW_MONASTERY_CORRIDOR_10"); ta_pray_innos_fp(14,0,15,0,"NW_MONASTERY_CHURCH_03"); ta_stand_sweeping(15,0,23,30,"NW_MONASTERY_CORRIDOR_10"); }; func void rtn_fegen_612() { ta_stand_sweeping(8,0,23,30,"NW_MONASTERY_NOVICE04_02"); ta_stand_sweeping(23,30,8,0,"NW_MONASTERY_NOVICE04_02"); }; func void rtn_favour_612() { ta_rake_fp(8,0,23,30,"NW_MONASTERY_HERB_05"); ta_sleep(23,30,8,0,"NW_MONASTERY_NOVICE04_05"); };
D
var int Zuris_ItemsGiven_Chapter_1; var int Zuris_ItemsGiven_Chapter_2; var int Zuris_ItemsGiven_Chapter_3; var int Zuris_ItemsGiven_Chapter_4; var int Zuris_ItemsGiven_Chapter_5; func void B_GiveTradeInv_Zuris(var C_Npc slf) { if((Kapitel >= 1) && (Zuris_ItemsGiven_Chapter_1 == FALSE)) { CreateInvItems(slf,ItMi_Gold,100); CreateInvItems(slf,ItPo_Mana_01,10); CreateInvItems(slf,ItPo_Health_01,10); CreateInvItems(slf,ItPo_Health_Addon_04,2); CreateInvItems(slf,ItPo_Mana_Addon_04,2); CreateInvItems(slf,ItMi_ApfelTabak,2); CreateInvItems(slf,ItFo_Addon_Pfeffer_01,1); Zuris_ItemsGiven_Chapter_1 = TRUE; }; if((Kapitel >= 2) && (Zuris_ItemsGiven_Chapter_2 == FALSE)) { CreateInvItems(slf,ItMi_Gold,60); CreateInvItems(slf,ItPo_Health_Addon_04,2); CreateInvItems(slf,ItPo_Mana_Addon_04,2); CreateInvItems(slf,ItPo_Mana_01,15); CreateInvItems(slf,ItPo_Mana_02,1); CreateInvItems(slf,ItPo_Health_01,15); CreateInvItems(slf,ItPo_Health_02,2); CreateInvItems(slf,ItMi_ApfelTabak,5); CreateInvItems(slf,ItPo_Perm_STR,1); Zuris_ItemsGiven_Chapter_2 = TRUE; }; if((Kapitel >= 3) && (Zuris_ItemsGiven_Chapter_3 == FALSE)) { CreateInvItems(slf,ItMi_Gold,120); CreateInvItems(slf,ItPo_Health_Addon_04,2); CreateInvItems(slf,ItPo_Mana_Addon_04,2); CreateInvItems(slf,ItPo_Mana_01,25); CreateInvItems(slf,ItPo_Mana_02,3); CreateInvItems(slf,ItPo_Health_01,25); CreateInvItems(slf,ItPo_Health_02,15); CreateInvItems(slf,ItPo_Perm_Mana,1); CreateInvItems(slf,ItPo_Speed,1); Zuris_ItemsGiven_Chapter_3 = TRUE; }; if((Kapitel >= 4) && (Zuris_ItemsGiven_Chapter_4 == FALSE)) { CreateInvItems(slf,ItMi_Gold,220); CreateInvItems(slf,ItPo_Health_Addon_04,3); CreateInvItems(slf,ItPo_Mana_Addon_04,3); CreateInvItems(slf,ItPo_Mana_01,35); CreateInvItems(slf,ItPo_Mana_02,15); CreateInvItems(slf,ItPo_Health_01,35); CreateInvItems(slf,ItPo_Health_02,20); CreateInvItems(slf,ItPo_Health_03,10); CreateInvItems(slf,ItPo_Perm_Mana,1); CreateInvItems(slf,ItPo_Speed,1); Zuris_ItemsGiven_Chapter_4 = TRUE; }; if((Kapitel >= 5) && (Zuris_ItemsGiven_Chapter_5 == FALSE)) { CreateInvItems(slf,ItMi_Gold,321); CreateInvItems(slf,ItPo_Health_Addon_04,5); CreateInvItems(slf,ItPo_Mana_Addon_04,5); CreateInvItems(slf,ItPo_Mana_01,55); CreateInvItems(slf,ItPo_Mana_02,35); CreateInvItems(slf,ItPo_Mana_03,15); CreateInvItems(slf,ItPo_Health_01,55); CreateInvItems(slf,ItPo_Health_02,30); CreateInvItems(slf,ItPo_Health_03,20); CreateInvItems(slf,ItPo_Perm_Health,1); CreateInvItems(slf,ItPo_Speed,1); Zuris_ItemsGiven_Chapter_5 = TRUE; }; };
D
// Copyright Ferdinand Majerech 2010 - 2011. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) ///Line emitter particle system. module scene.lineemitter; @safe import std.math; import scene.actor; import scene.particleemitter; import scene.scenemanager; import physics.physicsbody; import video.videodriver; import math.vector2; import color; import util.factory; /** * Particle emitter that emits lines. * * Emitted particles gradually blend color during their lifetime, * from specified start color to specified end color. */ class LineEmitter : ParticleEmitter { invariant() { assert(line_length_ > 0.0, "LineEmitter line length must be greater than 0"); assert(line_width_ > 0.0, "LineEmitter line width must be greater than 0"); assert(emit_velocity_ != Vector2f(0.0, 0.0), "Can't emit particles with zero velocity"); } protected: ///Length of line particles. float line_length_ = 8.0f; ///Width of line particles. float line_width_ = 2.0f; ///Color of particles at the beginning of their life. Color start_color_ = Color.white; ///Color of particles at the end of their life. Color end_color_ = rgba!"FFFFFF00"; public: ///Set length of the line particles. @property final void line_length(in float length){line_length_ = length;} ///Set width of the line particles. @property final void line_width(in float width){line_width_ = width;} ///Set color the particles have at the beginning of their lifetimes. @property final void start_color(in Color color){start_color_ = color;} ///Set color the particles have at the end of their lifetimes. @property final void end_color(in Color color){end_color_ = color;} protected: /** * Construct a LineEmitter. * * Params: physics_body = Physics body of the emitter. * owner = Actor to attach the emitter to. * If null, the emitter is independent. * life_time = Life time of the emitter in seconds. * If negative, lifetime is indefinite. * particle_life = Life time of particles emitted. * emit_frequency = Frequency to emit particles at in particles per second. * emit_velocity = Base velocity of particles emitted. * angle_variation = Variation of angle of emit velocity in radians. * line_length = Length of lines emitted in pixels. * line_width = Width of lines emitted in pixels. * start_color = Color at the beginning of particle lifetime. * end_color = Color at the end of particle lifetime. */ this(PhysicsBody physics_body, Actor owner, in real life_time, in real particle_life, in real emit_frequency, in Vector2f emit_velocity, in real angle_variation, in float line_length, in float line_width, in Color start_color, in Color end_color) { line_length_ = line_length; line_width_ = line_width; start_color_ = start_color; end_color_ = end_color; super(physics_body, owner, life_time, particle_life, emit_frequency, emit_velocity, angle_variation); } override void draw(VideoDriver driver) { driver.line_aa = true; driver.line_width = line_width_; Color color; //draw particles foreach(ref p; particles_) { color = end_color_.interpolated(start_color_, p.timer.age_relative(game_time_)); //determine line from particle velocity //note that we assume that particle velocity is never zero, //otherwise normalization would break driver.draw_line(p.position, p.position + p.velocity.normalized * line_length_, color, color); } driver.line_width = 1.0f; driver.line_aa = false; } } /** * Base class for factories producing LineEmitter or derived classes. * * Params: line_width = Width of lines emitted in pixels. * Default; 1.0 * start_color = Color at the beginning of particle lifetime. * Default; Color.white * end_color = Color at the end of particle lifetime. * Default; Color.black */ abstract class LineEmitterFactoryBase(T) : ParticleEmitterFactory!T { mixin(generate_factory("float $ line_width $ 1", "Color $ start_color $ Color.white", "Color $ end_color $ Color.black")); ///Return physics body constructed from factory parameters. Used by produce(). protected PhysicsBody physics_body() { return new PhysicsBody(null, position_, velocity_, 10.0); } } /** * Factory producing line emitters. * * Params: line_length = Length of the lines emitted in pixels. * Default; 5.0 */ class LineEmitterFactory : LineEmitterFactoryBase!(LineEmitter) { mixin(generate_factory("float $ line_length $ 5.0")); public override LineEmitter produce(SceneManager manager) { return new_actor(manager, new LineEmitter(physics_body, owner_, life_time_, particle_life_, emit_frequency_, emit_velocity_, angle_variation_, line_length_, line_width_, start_color_, end_color_)); } }
D
/** BSON serialization and value handling. Copyright: © 2012 RejectedSoftware e.K. License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. Authors: Sönke Ludwig */ module vibe.data.bson; public import vibe.data.json; import vibe.core.log; import std.algorithm; import std.array; import std.base64; import std.bitmanip; import std.conv; import std.datetime; import std.exception; import std.range; import std.traits; alias immutable(ubyte)[] bdata_t; /** Represents a BSON value. */ struct Bson { /// Represents the type of a BSON value enum Type : ubyte { end = 0x00, /// End marker - should never occur explicitly double_ = 0x01, /// A 64-bit floating point value string = 0x02, /// A UTF-8 string object = 0x03, /// An object aka. dictionary of string to Bson array = 0x04, /// An array of BSON values binData = 0x05, /// Raw binary data (ubyte[]) undefined = 0x06, /// Deprecated objectID = 0x07, /// BSON Object ID (96-bit) bool_ = 0x08, /// Boolean value date = 0x09, /// Date value (UTC) null_ = 0x0A, /// Null value regex = 0x0B, /// Regular expression dbRef = 0x0C, /// Deprecated code = 0x0D, /// JaveScript code symbol = 0x0E, /// Symbol/variable name codeWScope = 0x0F, /// JavaScript code with scope int_ = 0x10, /// 32-bit integer timestamp = 0x11, /// Timestamp value long_ = 0x12, /// 64-bit integer minKey = 0xff, /// Internal value maxKey = 0x7f, /// Internal value End = end, /// Compatibility alias - will be deprecated soon. Double = double_, /// Compatibility alias - will be deprecated soon. String = string, /// Compatibility alias - will be deprecated soon. Object = object, /// Compatibility alias - will be deprecated soon. Array = array, /// Compatibility alias - will be deprecated soon. BinData = binData, /// Compatibility alias - will be deprecated soon. Undefined = undefined, /// Compatibility alias - will be deprecated soon. ObjectID = objectID, /// Compatibility alias - will be deprecated soon. Bool = bool_, /// Compatibility alias - will be deprecated soon. Date = date, /// Compatibility alias - will be deprecated soon. Null = null_, /// Compatibility alias - will be deprecated soon. Regex = regex, /// Compatibility alias - will be deprecated soon. DBRef = dbRef, /// Compatibility alias - will be deprecated soon. Code = code, /// Compatibility alias - will be deprecated soon. Symbol = symbol, /// Compatibility alias - will be deprecated soon. CodeWScope = codeWScope, /// Compatibility alias - will be deprecated soon. Int = int_, /// Compatibility alias - will be deprecated soon. Timestamp = timestamp, /// Compatibility alias - will be deprecated soon. Long = long_, /// Compatibility alias - will be deprecated soon. MinKey = minKey, /// Compatibility alias - will be deprecated soon. MaxKey = maxKey /// Compatibility alias - will be deprecated soon. } /// Returns a new, empty Bson value of type Object. static @property Bson emptyObject() { return Bson(cast(Bson[string])null); } /// Returns a new, empty Bson value of type Object. static @property Bson emptyArray() { return Bson(cast(Bson[])null); } /// Compatibility alias - will be deprecated soon. alias EmptyObject = emptyObject; /// Compatibility alias - will be deprecated soon. alias EmptyArray = emptyArray; private { Type m_type = Type.undefined; bdata_t m_data; } /** Creates a new BSON value using raw data. A slice of the first bytes of 'data' is stored, containg the data related to the value. An exception is thrown if 'data' is too short. */ this(Type type, bdata_t data) { m_type = type; m_data = data; final switch(type){ case Type.end: m_data = null; break; case Type.double_: m_data = m_data[0 .. 8]; break; case Type.string: m_data = m_data[0 .. 4 + fromBsonData!int(m_data)]; break; case Type.object: m_data = m_data[0 .. fromBsonData!int(m_data)]; break; case Type.array: m_data = m_data[0 .. fromBsonData!int(m_data)]; break; case Type.binData: m_data = m_data[0 .. 5 + fromBsonData!int(m_data)]; break; case Type.undefined: m_data = null; break; case Type.objectID: m_data = m_data[0 .. 12]; break; case Type.bool_: m_data = m_data[0 .. 1]; break; case Type.date: m_data = m_data[0 .. 8]; break; case Type.null_: m_data = null; break; case Type.regex: auto tmp = m_data; tmp.skipCString(); tmp.skipCString(); m_data = m_data[0 .. $ - tmp.length]; break; case Type.dbRef: m_data = m_data[0 .. 0]; assert(false, "Not implemented."); case Type.code: m_data = m_data[0 .. 4 + fromBsonData!int(m_data)]; break; case Type.symbol: m_data = m_data[0 .. 4 + fromBsonData!int(m_data)]; break; case Type.codeWScope: m_data = m_data[0 .. 0]; assert(false, "Not implemented."); case Type.int_: m_data = m_data[0 .. 4]; break; case Type.timestamp: m_data = m_data[0 .. 8]; break; case Type.long_: m_data = m_data[0 .. 8]; break; case Type.minKey: m_data = null; break; case Type.maxKey: m_data = null; break; } } /** Initializes a new BSON value from the given D type. */ this(double value) { opAssign(value); } /// ditto this(string value, Type type = Type.string) { assert(type == Type.string || type == Type.code || type == Type.symbol); opAssign(value); m_type = type; } /// ditto this(in Bson[string] value) { opAssign(value); } /// ditto this(in Bson[] value) { opAssign(value); } /// ditto this(in BsonBinData value) { opAssign(value); } /// ditto this(in BsonObjectID value) { opAssign(value); } /// ditto this(bool value) { opAssign(value); } /// ditto this(in BsonDate value) { opAssign(value); } /// ditto this(typeof(null)) { opAssign(null); } /// ditto this(in BsonRegex value) { opAssign(value); } /// ditto this(int value) { opAssign(value); } /// ditto this(in BsonTimestamp value) { opAssign(value); } /// ditto this(long value) { opAssign(value); } /// ditto this(in Json value) { opAssign(value); } /** Assigns a D type to a BSON value. */ void opAssign(in Bson other) { m_data = other.m_data; m_type = other.m_type; } /// ditto void opAssign(double value) { m_data = toBsonData(value).idup; m_type = Type.double_; } /// ditto void opAssign(string value) { import std.utf; debug std.utf.validate(value); auto app = appender!bdata_t(); app.put(toBsonData(cast(int)value.length+1)); app.put(cast(bdata_t)value); app.put(cast(ubyte)0); m_data = app.data; m_type = Type.string; } /// ditto void opAssign(in Bson[string] value) { auto app = appender!bdata_t(); foreach( k, ref v; value ){ app.put(cast(ubyte)v.type); putCString(app, k); app.put(v.data); } auto dapp = appender!bdata_t(); dapp.put(toBsonData(cast(int)app.data.length+5)); dapp.put(app.data); dapp.put(cast(ubyte)0); m_data = dapp.data; m_type = Type.object; } /// ditto void opAssign(in Bson[] value) { auto app = appender!bdata_t(); foreach( i, ref v; value ){ app.put(v.type); putCString(app, to!string(i)); app.put(v.data); } auto dapp = appender!bdata_t(); dapp.put(toBsonData(cast(int)app.data.length+5)); dapp.put(app.data); dapp.put(cast(ubyte)0); m_data = dapp.data; m_type = Type.array; } /// ditto void opAssign(in BsonBinData value) { auto app = appender!bdata_t(); app.put(toBsonData(cast(int)value.rawData.length)); app.put(value.type); app.put(value.rawData); m_data = app.data; m_type = Type.binData; } /// ditto void opAssign(in BsonObjectID value) { m_data = value.m_bytes.idup; m_type = Type.objectID; } /// ditto void opAssign(bool value) { m_data = [value ? 0x01 : 0x00]; m_type = Type.bool_; } /// ditto void opAssign(in BsonDate value) { m_data = toBsonData(value.m_time).idup; m_type = Type.date; } /// ditto void opAssign(typeof(null)) { m_data = null; m_type = Type.null_; } /// ditto void opAssign(in BsonRegex value) { auto app = appender!bdata_t(); putCString(app, value.expression); putCString(app, value.options); m_data = app.data; m_type = type.regex; } /// ditto void opAssign(int value) { m_data = toBsonData(value).idup; m_type = Type.int_; } /// ditto void opAssign(in BsonTimestamp value) { m_data = toBsonData(value.m_time).idup; m_type = Type.timestamp; } /// ditto void opAssign(long value) { m_data = toBsonData(value).idup; m_type = Type.long_; } /// ditto void opAssign(in Json value) { auto app = appender!bdata_t(); m_type = writeBson(app, value); m_data = app.data; } /** Returns the BSON type of this value. */ @property Type type() const { return m_type; } bool isNull() const { return m_type == Type.null_; } /** Returns the raw data representing this BSON value (not including the field name and type). */ @property bdata_t data() const { return m_data; } /** Converts the BSON value to a D value. If the BSON type of the value does not match the D type, an exception is thrown. */ T opCast(T)() const { return get!T(); } /// ditto @property T get(T)() const { static if( is(T == double) ){ checkType(Type.double_); return fromBsonData!double(m_data); } else static if( is(T == string) ){ checkType(Type.string, Type.code, Type.symbol); return cast(string)m_data[4 .. 4+fromBsonData!int(m_data)-1]; } else static if( is(Unqual!T == Bson[string]) || is(Unqual!T == const(Bson)[string]) ){ checkType(Type.object); Bson[string] ret; auto d = m_data[4 .. $]; while( d.length > 0 ){ auto tp = cast(Type)d[0]; if( tp == Type.end ) break; d = d[1 .. $]; auto key = skipCString(d); auto value = Bson(tp, d); d = d[value.data.length .. $]; ret[key] = value; } return cast(T)ret; } else static if( is(Unqual!T == Bson[]) || is(Unqual!T == const(Bson)[]) ){ checkType(Type.array); Bson[] ret; auto d = m_data[4 .. $]; while( d.length > 0 ){ auto tp = cast(Type)d[0]; if( tp == Type.end ) break; auto key = skipCString(d); // should be '0', '1', ... auto value = Bson(tp, d); d = d[value.data.length .. $]; ret ~= value; } return cast(T)ret; } else static if( is(T == BsonBinData) ){ checkType(Type.binData); auto size = fromBsonData!int(m_data); auto type = cast(BsonBinData.Type)m_data[4]; return BsonBinData(type, m_data[5 .. 5+size]); } else static if( is(T == BsonObjectID) ){ checkType(Type.objectID); return BsonObjectID(m_data[0 .. 12]); } else static if( is(T == bool) ){ checkType(Type.bool_); return m_data[0] != 0; } else static if( is(T == BsonDate) ){ checkType(Type.date); return BsonDate(fromBsonData!long(m_data)); } else static if( is(T == BsonRegex) ){ checkType(Type.regex); auto d = m_data; auto expr = skipCString(d); auto options = skipCString(d); return BsonRegex(expr, options); } else static if( is(T == int) ){ checkType(Type.int_); return fromBsonData!int(m_data); } else static if( is(T == BsonTimestamp) ){ checkType(Type.timestamp); return BsonTimestamp(fromBsonData!long(m_data)); } else static if( is(T == long) ){ checkType(Type.long_); return fromBsonData!long(m_data); } else static if( is(T == Json) ){ pragma(msg, "Bson.get!Json() and Bson.opCast!Json() will soon be removed. Please use Bson.toJson() instead."); return this.toJson(); } else static assert(false, "Cannot cast "~typeof(this).stringof~" to '"~T.stringof~"'."); } /** Returns the native type for this BSON if it matches the current runtime type. If the runtime type does not match the given native type, the 'def' parameter is returned instead. */ inout(T) opt(T)(T def = T.init) inout { if( isNull() ) return def; try def = cast(T)this; catch( Exception e ) {} return def; } /** Returns the length of a BSON value of type String, Array, Object or BinData. */ @property size_t length() const { switch( m_type ){ default: enforce(false, "Bson objects of type "~to!string(m_type)~" do not have a length field."); break; case Type.string, Type.code, Type.symbol: return (cast(string)this).length; case Type.array: return (cast(const(Bson)[])this).length; // TODO: optimize! case Type.object: return (cast(const(Bson)[string])this).length; // TODO: optimize! case Type.binData: assert(false); //return (cast(BsonBinData)this).length; break; } assert(false); } /** Converts a given JSON value to the corresponding BSON value. */ static Bson fromJson(in Json value) { auto app = appender!bdata_t(); auto tp = writeBson(app, value); return Bson(tp, app.data); } /** Converts a BSON value to a JSON value. All BSON types that cannot be exactly represented as JSON, will be converted to a string. */ Json toJson() const { switch( this.type ){ default: assert(false); case Bson.Type.double_: return Json(get!double()); case Bson.Type.string: return Json(get!string()); case Bson.Type.object: Json[string] ret; foreach( k, v; get!(Bson[string])() ) ret[k] = v.toJson(); return Json(ret); case Bson.Type.array: auto ret = new Json[this.length]; foreach( i, v; get!(Bson[])() ) ret[i] = v.toJson(); return Json(ret); case Bson.Type.binData: return Json(cast(string)Base64.encode(get!BsonBinData.rawData)); case Bson.Type.objectID: return Json(get!BsonObjectID().toString()); case Bson.Type.bool_: return Json(get!bool()); case Bson.Type.date: return Json(get!BsonDate.toString()); case Bson.Type.null_: return Json(null); case Bson.Type.regex: assert(false, "TODO"); case Bson.Type.dbRef: assert(false, "TODO"); case Bson.Type.code: return Json(get!string()); case Bson.Type.symbol: return Json(get!string()); case Bson.Type.codeWScope: assert(false, "TODO"); case Bson.Type.int_: return Json(get!int()); case Bson.Type.timestamp: return Json(get!BsonTimestamp().m_time); case Bson.Type.long_: return Json(get!long()); } } /** Returns a string representation of this BSON value in JSON format. */ string toString() { return toJson().toString(); } /** Allows accessing fields of a BSON object using []. Returns a null value if the specified field does not exist. */ inout(Bson) opIndex(string idx) inout { foreach( string key, v; this ) if( key == idx ) return v; return Bson(null); } /// ditto void opIndexAssign(T)(T value, string idx){ auto newcont = appender!bdata_t(); checkType(Type.object); auto d = m_data[4 .. $]; while( d.length > 0 ){ auto tp = cast(Type)d[0]; if( tp == Type.end ) break; d = d[1 .. $]; auto key = skipCString(d); auto val = Bson(tp, d); d = d[val.data.length .. $]; if( key != idx ){ // copy to new array newcont.put(cast(ubyte)tp); putCString(newcont, key); newcont.put(val.data); } } static if( is(T == Bson) ) alias value bval; else auto bval = Bson(value); newcont.put(cast(ubyte)bval.type); putCString(newcont, idx); newcont.put(bval.data); auto newdata = appender!bdata_t(); newdata.put(toBsonData(cast(uint)(newcont.data.length + 5))); newdata.put(newcont.data); newdata.put(cast(ubyte)0); m_data = newdata.data; } /** Allows index based access of a BSON array value. Returns a null value if the index is out of bounds. */ inout(Bson) opIndex(size_t idx) inout { foreach( size_t i, v; this ) if( i == idx ) return v; return Bson(null); } /** Allows foreach iterating over BSON objects and arrays. Note that although D requires to provide a 'ref' argument for opApply, in-place editing of the array/object fields is not possible. Any modification attempty will work on a temporary, even if the loop variable is declared 'ref'. */ int opApply(int delegate(ref Bson obj) del) const { checkType(Type.array, Type.object); if( m_type == Type.array ){ foreach( size_t idx, v; this ) if( auto ret = del(v) ) return ret; return 0; } else { foreach( string idx, v; this ) if( auto ret = del(v) ) return ret; return 0; } } /// ditto int opApply(int delegate(ref size_t idx, ref Bson obj) del) const { checkType(Type.array); auto d = m_data[4 .. $]; size_t i = 0; while( d.length > 0 ){ auto tp = cast(Type)d[0]; if( tp == Type.end ) break; d = d[1 .. $]; skipCString(d); auto value = Bson(tp, d); d = d[value.data.length .. $]; auto icopy = i; if( auto ret = del(icopy, value) ) return ret; i++; } return 0; } /// ditto int opApply(int delegate(ref string idx, ref Bson obj) del) const { checkType(Type.object); auto d = m_data[4 .. $]; while( d.length > 0 ){ auto tp = cast(Type)d[0]; if( tp == Type.end ) break; d = d[1 .. $]; auto key = skipCString(d); auto value = Bson(tp, d); d = d[value.data.length .. $]; if( auto ret = del(key, value) ) return ret; } return 0; } /** Allows to access existing fields of a JSON object using dot syntax. Returns a null value for non-existent fields. */ @property inout(Bson) opDispatch(string prop)() inout { return opIndex(prop); } /// ditto @property void opDispatch(string prop, T)(T val) { opIndexAssign(val, prop); } /// bool opEquals(ref const Bson other) const { if( m_type != other.m_type ) return false; return m_data == other.m_data; } /// ditto bool opEquals(const Bson other) const { if( m_type != other.m_type ) return false; return m_data == other.m_data; } private void checkType(in Type[] valid_types...) const { foreach( t; valid_types ) if( m_type == t ) return; throw new Exception("BSON value is type '"~to!string(m_type)~"', expected to be one of "~to!string(valid_types)); } } /** Represents a BSON binary data value (Bson.Type.binData). */ struct BsonBinData { enum Type : ubyte { generic = 0x00, function_ = 0x01, binaryOld = 0x02, uuid = 0x03, md5 = 0x05, userDefined = 0x80, Generic = generic, /// Compatibility alias - will be deprecated soon Function = function_, /// Compatibility alias - will be deprecated soon BinaryOld = binaryOld, /// Compatibility alias - will be deprecated soon UUID = uuid, /// Compatibility alias - will be deprecated soon MD5 = md5, /// Compatibility alias - will be deprecated soon UserDefined = userDefined, /// Compatibility alias - will be deprecated soon } private { Type m_type; bdata_t m_data; } this(Type type, immutable(ubyte)[] data) { m_type = type; m_data = data; } @property Type type() const { return m_type; } @property bdata_t rawData() const { return m_data; } } /** Represents a BSON object id (Bson.Type.binData). */ struct BsonObjectID { private { ubyte[12] m_bytes; static int ms_pid = -1; static uint ms_inc = 0; static uint MACHINE_ID = 0; } /** Constructs a new object ID from the given raw byte array. */ this( in ubyte[] bytes ){ assert(bytes.length == 12); m_bytes[] = bytes[]; } /** Creates an on object ID from a string in standard hexa-decimal form. */ static BsonObjectID fromString(string str) { assert(str.length == 24, "BSON Object ID string s must be 24 characters."); BsonObjectID ret = void; uint b = 0; foreach( i, ch; str ){ ubyte n; if( ch >= '0' && ch <= '9' ) n = cast(ubyte)(ch - '0'); else if( ch >= 'a' && ch <= 'f' ) n = cast(ubyte)(ch - 'a' + 10); else if( ch >= 'A' && ch <= 'F' ) n = cast(ubyte)(ch - 'F' + 10); else assert(false, "Not a valid hex string."); b <<= 4; b += n; if( i % 8 == 7 ){ auto j = i / 8; ret.m_bytes[j*4 .. (j+1)*4] = toBigEndianData(b)[]; b = 0; } } return ret; } /// ditto alias fromString fromHexString; /** Generates a unique object ID. */ static BsonObjectID generate() { import std.datetime; import std.process; import std.random; if( ms_pid == -1 ) ms_pid = getpid(); if( MACHINE_ID == 0 ) MACHINE_ID = uniform(0, 0xffffff); auto unixTime = Clock.currTime(UTC()).toUnixTime(); BsonObjectID ret = void; ret.m_bytes[0 .. 4] = toBigEndianData(cast(uint)unixTime)[]; ret.m_bytes[4 .. 7] = toBsonData(MACHINE_ID)[0 .. 3]; ret.m_bytes[7 .. 9] = toBsonData(cast(ushort)ms_pid)[]; ret.m_bytes[9 .. 12] = toBigEndianData(ms_inc++)[1 .. 4]; return ret; } /** Creates a pseudo object ID that matches the given date. This kind of ID can be useful to query a database for items in a certain date interval using their ID. This works using the property of standard BSON object IDs that they store their creation date as part of the ID. Note that this date part is only 32-bit wide and is limited to the same timespan as a 32-bit Unix timestamp. */ static BsonObjectID createDateID(in SysTime date) { BsonObjectID ret; ret.m_bytes[0 .. 4] = toBigEndianData(cast(uint)date.toUnixTime())[]; return ret; } /** Returns true for any non-zero ID. */ @property bool valid() const { foreach( b; m_bytes ) if( b != 0 ) return true; return false; } /** Extracts the time/date portion of the object ID. For IDs created using the standard generation algorithm or using createDateID this will return the associated time stamp. */ @property SysTime timeStamp() { ubyte[4] tm = m_bytes[0 .. 4]; return SysTime(unixTimeToStdTime(bigEndianToNative!uint(tm))); } /** Allows for relational comparison of different IDs. */ int opCmp(ref const BsonObjectID other) const { import core.stdc.string; return memcmp(m_bytes.ptr, other.m_bytes.ptr, m_bytes.length); } /** Converts the ID to its standard hexa-decimal string representation. */ string toString() const { enum hexdigits = "0123456789abcdef"; auto ret = new char[24]; foreach( i, b; m_bytes ){ ret[i*2+0] = hexdigits[(b >> 4) & 0x0F]; ret[i*2+1] = hexdigits[b & 0x0F]; } return cast(immutable)ret; } ubyte[] opCast() { return m_bytes; } } /** Represents a BSON date value (Bson.Type.date). BSON date values are stored in UNIX time format, counting the number of milliseconds from 1970/01/01. */ struct BsonDate { private long m_time; // milliseconds since UTC unix epoch /** Constructs a BsonDate from the given date value. The time-zone independent Date and DateTime types are assumed to be in the local time zone and converted to UTC if tz is left to null. */ this(in Date date, immutable TimeZone tz = null) { this(SysTime(date, tz)); } /// ditto this(in DateTime date, immutable TimeZone tz = null) { this(SysTime(date, tz)); } /// ditto this(in SysTime date) { this(fromStdTime(date.stdTime()).m_time); } /** Constructs a BsonDate from the given UNIX time. unix_time needs to be given in milliseconds from 1970/01/01. This is the native storage format for BsonDate. */ this(long unix_time) { m_time = unix_time; } /** Constructs a BsonDate from the given date/time string in ISO extended format. */ static BsonDate fromString(string iso_ext_string) { return BsonDate(SysTime.fromISOExtString(iso_ext_string)); } /** Constructs a BsonDate from the given date/time in standard time as defined in std.datetime. */ static BsonDate fromStdTime(long std_time) { enum zero = unixTimeToStdTime(0); return BsonDate((std_time - zero) / 10_000L); } /** The raw unix time value. This is the native storage/transfer format of a BsonDate. */ @property long value() const { return m_time; } /// ditto @property void value(long v) { m_time = v; } /** Returns the date formatted as ISO extended format. */ string toString() const { return toSysTime().toISOExtString(); } /* Converts to a SysTime. */ SysTime toSysTime() const { auto zero = unixTimeToStdTime(0); return SysTime(zero + m_time * 10_000L, UTC()); } /** Allows relational and equality comparisons. */ bool opEquals(ref const BsonDate other) const { return m_time == other.m_time; } /// ditto int opCmp(ref const BsonDate other) const { if( m_time == other.m_time ) return 0; if( m_time < other.m_time ) return -1; else return 1; } } /** Represents a BSON timestamp value (Bson.Type.timestamp) */ struct BsonTimestamp { private long m_time; this( long time ){ m_time = time; } } /** Represents a BSON regular expression value (Bson.Type.regex). */ struct BsonRegex { private { string m_expr; string m_options; } this(string expr, string options) { m_expr = expr; m_options = options; } @property string expression() const { return m_expr; } @property string options() const { return m_options; } } /** Serializes the given value to BSON. The following types of values are supported: $(DL $(DT Bson) $(DD Used as-is) $(DT Json) $(DD Converted to BSON) $(DT BsonBinData) $(DD Converted to Bson.Type.binData) $(DT BsonObjectID) $(DD Converted to Bson.Type.objectID) $(DT BsonDate) $(DD Converted to Bson.Type.date) $(DT BsonTimestamp) $(DD Converted to Bson.Type.timestamp) $(DT BsonRegex) $(DD Converted to Bson.Type.regex) $(DT null) $(DD Converted to Bson.Type.null_) $(DT bool) $(DD Converted to Bson.Type.bool_) $(DT float, double) $(DD Converted to Bson.Type.double_) $(DT short, ushort, int, uint, long, ulong) $(DD Converted to Bson.Type.long_) $(DT string) $(DD Converted to Bson.Type.string) $(DT ubyte[]) $(DD Converted to Bson.Type.binData) $(DT T[]) $(DD Converted to Bson.Type.array) $(DT T[string]) $(DD Converted to Bson.Type.object) $(DT struct) $(DD Converted to Bson.Type.object) $(DT class) $(DD Converted to Bson.Type.object or Bson.Type.null_) ) All entries of an array or an associative array, as well as all R/W properties and all fields of a struct/class are recursively serialized using the same rules. Fields ending with an underscore will have the last underscore stripped in the serialized output. This makes it possible to use fields with D keywords as their name by simply appending an underscore. The following methods can be used to customize the serialization of structs/classes: --- Bson toBson() const; static T fromBson(Bson src); Json toJson() const; static T fromJson(Json src); string toString() const; static T fromString(string src); --- The methods will have to be defined in pairs. The first pair that is implemented by the type will be used for serialization (i.e. toBson overrides toJson). */ Bson serializeToBson(T)(T value) { version (VibeOldSerialization) { return serializeToBsonOld(value); } else { return serialize!BsonSerializer(value); } } /// private Bson serializeToBsonOld(T)(T value) { alias Unqual!T Unqualified; static if (is(Unqualified == Bson)) return value; else static if (is(Unqualified == Json)) return Bson.fromJson(value); else static if (is(Unqualified == BsonBinData)) return Bson(value); else static if (is(Unqualified == BsonObjectID)) return Bson(value); else static if (is(Unqualified == BsonDate)) return Bson(value); else static if (is(Unqualified == BsonTimestamp)) return Bson(value); else static if (is(Unqualified == BsonRegex)) return Bson(value); else static if (is(Unqualified == DateTime)) return Bson(BsonDate(value, UTC())); else static if (is(Unqualified == SysTime)) return Bson(BsonDate(value)); else static if (is(Unqualified == Date)) return Bson(BsonDate(value, UTC())); else static if (is(Unqualified == typeof(null))) return Bson(null); else static if (is(Unqualified == bool)) return Bson(value); else static if (is(Unqualified == float)) return Bson(cast(double)value); else static if (is(Unqualified == double)) return Bson(value); else static if (is(Unqualified : int)) return Bson(cast(int)value); else static if (is(Unqualified : long)) return Bson(cast(long)value); else static if (is(Unqualified : string)) return Bson(value); else static if (is(Unqualified : const(ubyte)[])) return Bson(BsonBinData(BsonBinData.Type.generic, value.idup)); else static if (isArray!T) { auto ret = new Bson[value.length]; foreach (i; 0 .. value.length) ret[i] = serializeToBson(value[i]); return Bson(ret); } else static if (isAssociativeArray!T) { Bson[string] ret; alias KeyType!T TK; foreach (key, value; value) { static if(is(TK == string)) { ret[key] = serializeToBson(value); } else static if (is(TK == enum)) { ret[to!string(key)] = serializeToBson(value); } else static if (isStringSerializable!(TK)) { ret[key.toString()] = serializeToBson(value); } else static assert("AA key type %s not supported for BSON serialization."); } return Bson(ret); } else static if (isBsonSerializable!Unqualified) { return value.toBson(); } else static if (isJsonSerializable!Unqualified) { return Bson.fromJson(value.toJson()); } else static if (isStringSerializable!Unqualified) { return Bson(value.toString()); } else static if (is(Unqualified == struct)) { Bson[string] ret; foreach (m; __traits(allMembers, T)) { static if (isRWField!(Unqualified, m)) { auto mv = __traits(getMember, value, m); ret[underscoreStrip(m)] = serializeToBson(mv); } } return Bson(ret); } else static if (is(Unqualified == class)) { if (value is null) return Bson(null); Bson[string] ret; foreach (m; __traits(allMembers, T)) { static if (isRWField!(Unqualified, m)) { auto mv = __traits(getMember, value, m); ret[underscoreStrip(m)] = serializeToBson(mv); } } return Bson(ret); } else { static assert(false, "Unsupported type '"~T.stringof~"' for BSON serialization."); } } /** Deserializes a BSON value into the destination variable. The same types as for serializeToBson() are supported and handled inversely. */ void deserializeBson(T)(ref T dst, Bson src) { dst = deserializeBson!T(src); } /// ditto T deserializeBson(T)(Bson src) { version (VibeOldSerialization) { return deserializeBsonOld!T(src); } else { return deserialize!(BsonSerializer, T)(src); } } /// private T deserializeBsonOld(T)(Bson src) { static if (is(T == Bson)) return src; else static if (is(T == Json)) return src.toJson(); else static if (is(T == BsonBinData)) return cast(T)src; else static if (is(T == BsonObjectID)) return cast(T)src; else static if (is(T == BsonDate)) return cast(T)src; else static if (is(T == BsonTimestamp)) return cast(T)src; else static if (is(T == BsonRegex)) return cast(T)src; else static if (is(T == SysTime)) return src.get!BsonDate().toSysTime(); else static if (is(T == DateTime)) return cast(DateTime)src.get!BsonDate().toSysTime(); else static if (is(T == Date)) return cast(Date)src.get!BsonDate().toSysTime(); else static if (is(T == typeof(null))) return null; else static if (is(T == bool)) return cast(bool)src; else static if (is(T == float)) return cast(double)src; else static if (is(T == double)) return cast(double)src; else static if (is(T : int)) return cast(T)cast(int)src; else static if (is(T : long)) return cast(T)cast(long)src; else static if (is(T : string)) return cast(T)(cast(string)src); else static if (is(T : const(ubyte)[])) return cast(T)src.get!BsonBinData.rawData.dup; else static if (isArray!T) { alias typeof(T.init[0]) TV; auto ret = new Unqual!TV[src.length]; foreach (size_t i, v; cast(Bson[])src) ret[i] = deserializeBson!(Unqual!TV)(v); return ret; } else static if (isAssociativeArray!T) { alias typeof(T.init.values[0]) TV; alias KeyType!T TK; Unqual!TV[TK] dst; foreach (string key, value; src) { static if (is(TK == string)) { dst[key] = deserializeBson!(Unqual!TV)(value); } else static if (is(TK == enum)) { dst[to!(TK)(key)] = deserializeBson!(Unqual!TV)(value); } else static if (isStringSerializable!TK) { auto dsk = TK.fromString(key); dst[dsk] = deserializeBson!(Unqual!TV)(value); } else static assert("AA key type %s not supported for BSON serialization."); } return dst; } else static if (isBsonSerializable!T) { return T.fromBson(src); } else static if (isJsonSerializable!T) { return T.fromJson(src.toJson()); } else static if (isStringSerializable!T) { return T.fromString(cast(string)src); } else static if (is(T == struct)) { T dst; foreach (m; __traits(allMembers, T)) { static if (isRWPlainField!(T, m) || isRWField!(T, m)) { alias typeof(__traits(getMember, dst, m)) TM; debug enforce(!src[underscoreStrip(m)].isNull() || is(TM == class) || isPointer!TM || is(TM == typeof(null)), "Missing field '"~underscoreStrip(m)~"'."); __traits(getMember, dst, m) = deserializeBson!TM(src[underscoreStrip(m)]); } } return dst; } else static if (is(T == class)) { if (src.isNull()) return null; auto dst = new T; foreach (m; __traits(allMembers, T)) { static if (isRWPlainField!(T, m) || isRWField!(T, m)) { alias typeof(__traits(getMember, dst, m)) TM; __traits(getMember, dst, m) = deserializeBson!TM(src[underscoreStrip(m)]); } } return dst; } else static if (isPointer!T) { if (src.type == Bson.Type.null_) return null; alias typeof(*T.init) TD; dst = new TD; *dst = deserializeBson!TD(src); return dst; } else { static assert(false, "Unsupported type '"~T.stringof~"' for BSON serialization."); } } unittest { import std.stdio; enum Foo : string { k = "test" } enum Boo : int { l = 5 } static struct S { float a; double b; bool c; int d; string e; byte f; ubyte g; long h; ulong i; float[] j; Foo k; Boo l;} immutable S t = {1.5, -3.0, true, int.min, "Test", -128, 255, long.min, ulong.max, [1.1, 1.2, 1.3], Foo.k, Boo.l,}; S u; deserializeBson(u, serializeToBson(t)); assert(t.a == u.a); assert(t.b == u.b); assert(t.c == u.c); assert(t.d == u.d); assert(t.e == u.e); assert(t.f == u.f); assert(t.g == u.g); assert(t.h == u.h); assert(t.i == u.i); assert(t.j == u.j); assert(t.k == u.k); assert(t.l == u.l); } unittest { assert(uint.max == serializeToBson(uint.max).deserializeBson!uint); assert(ulong.max == serializeToBson(ulong.max).deserializeBson!ulong); } unittest { assert(deserializeBson!SysTime(serializeToBson(SysTime(0))) == SysTime(0)); assert(deserializeBson!SysTime(serializeToBson(SysTime(0, UTC()))) == SysTime(0, UTC())); assert(deserializeBson!Date(serializeToBson(Date.init)) == Date.init); assert(deserializeBson!Date(serializeToBson(Date(2001, 1, 1))) == Date(2001, 1, 1)); } unittest { static struct A { int value; static A fromJson(Json val) { return A(val.get!int); } Json toJson() const { return Json(value); } Bson toBson() { return Bson(); } } static assert(!isStringSerializable!A && isJsonSerializable!A && !isBsonSerializable!A); static assert(!isStringSerializable!(const(A)) && !isJsonSerializable!(const(A)) && !isBsonSerializable!(const(A))); assert(serializeToBson(const A(123)) == Bson(123)); assert(serializeToBson(A(123)) == Bson(123)); static struct B { int value; static B fromBson(Bson val) { return B(val.get!int); } Bson toBson() const { return Bson(value); } Json toJson() { return Json(); } } static assert(!isStringSerializable!B && !isJsonSerializable!B && isBsonSerializable!B); static assert(!isStringSerializable!(const(B)) && !isJsonSerializable!(const(B)) && !isBsonSerializable!(const(B))); assert(serializeToBson(const B(123)) == Bson(123)); assert(serializeToBson(B(123)) == Bson(123)); static struct C { int value; static C fromString(string val) { return C(val.to!int); } string toString() const { return value.to!string; } Json toJson() { return Json(); } } static assert(isStringSerializable!C && !isJsonSerializable!C && !isBsonSerializable!C); static assert(!isStringSerializable!(const(C)) && !isJsonSerializable!(const(C)) && !isBsonSerializable!(const(C))); assert(serializeToBson(const C(123)) == Bson("123")); assert(serializeToBson(C(123)) == Bson("123")); static struct D { int value; string toString() { return ""; } } static assert(!isStringSerializable!D && !isJsonSerializable!D && !isBsonSerializable!D); static assert(!isStringSerializable!(const(D)) && !isJsonSerializable!(const(D)) && !isBsonSerializable!(const(D))); assert(serializeToBson(const D(123)) == serializeToBson(["value": 123])); assert(serializeToBson(D(123)) == serializeToBson(["value": 123])); } unittest { static struct E { ubyte[4] bytes; ubyte[] more; } auto e = E([1, 2, 3, 4], [5, 6]); auto eb = serializeToBson(e); assert(eb.bytes.type == Bson.Type.binData); assert(eb.more.type == Bson.Type.binData); assert(e == deserializeBson!E(eb)); } unittest { static class C { int a; private int _b; @property int b() const { return _b; } @property void b(int v) { _b = v; } @property int test() const { return 10; } void test2() {} } C c = new C; c.a = 1; c.b = 2; C d; deserializeBson(d, serializeToBson(c)); assert(c.a == d.a); assert(c.b == d.b); } unittest { static struct C { int value; static C fromString(string val) { return C(val.to!int); } string toString() const { return value.to!string; } } enum Color { Red, Green, Blue } { static class T { string[Color] enumIndexedMap; string[C] stringableIndexedMap; this() { enumIndexedMap = [ Color.Red : "magenta", Color.Blue : "deep blue" ]; stringableIndexedMap = [ C(42) : "forty-two" ]; } } T original = new T; original.enumIndexedMap[Color.Green] = "olive"; T other; deserializeBson(other, serializeToBson(original)); assert(serializeToBson(other) == serializeToBson(original)); } { static struct S { string[Color] enumIndexedMap; string[C] stringableIndexedMap; } S original; original.enumIndexedMap = [ Color.Red : "magenta", Color.Blue : "deep blue" ]; original.enumIndexedMap[Color.Green] = "olive"; original.stringableIndexedMap = [ C(42) : "forty-two" ]; S other; deserializeBson(other, serializeToBson(original)); assert(serializeToBson(other) == serializeToBson(original)); } } /** Serializes to an in-memory BSON representation. See_Also: vibe.data.serialization.serialize, vibe.data.serialization.deserialize, serializeToBson, deserializeBson */ struct BsonSerializer { private { Appender!(ubyte[]) m_dst; size_t[] m_compositeStack; Bson.Type m_type = Bson.Type.null_; Bson m_inputData; string m_entryName; size_t m_entryIndex = size_t.max; } this(Bson input) { m_inputData = input; } @disable this(this); template isSupportedValueType(T) { enum isSupportedValueType = is(typeof(getBsonTypeID(T.init))); } // // serialization // Bson getSerializedResult() { auto ret = Bson(m_type, cast(immutable)m_dst.data); m_dst = appender!(ubyte[]); m_type = Bson.Type.null_; return ret; } void beginWriteDictionary(T)() { writeCompositeEntryHeader(Bson.Type.object); m_compositeStack ~= m_dst.data.length; m_dst.put(toBsonData(cast(int)0)); } void endWriteDictionary(T)() { m_dst.put(Bson.Type.end); auto sh = m_compositeStack[$-1]; m_compositeStack.length--; m_dst.data[sh .. sh + 4] = toBsonData(cast(uint)(m_dst.data.length - sh))[]; } void beginWriteDictionaryEntry(T)(string name) { m_entryName = name; } void endWriteDictionaryEntry(T)(string name) {} void beginWriteArray(T)(size_t) { writeCompositeEntryHeader(Bson.Type.array); m_compositeStack ~= m_dst.data.length; m_dst.put(toBsonData(cast(int)0)); } void endWriteArray(T)() { endWriteDictionary!T(); } void beginWriteArrayEntry(T)(size_t idx) { m_entryIndex = idx; } void endWriteArrayEntry(T)(size_t idx) {} void writeValue(T)(T value) { writeCompositeEntryHeader(getBsonTypeID(value)); static if (is(T == Bson)) { m_dst.put(value.data); } else static if (is(T == Json)) { m_dst.put(Bson(value).data); } // FIXME: use .writeBsonValue else static if (is(T == typeof(null))) {} else static if (is(T == string)) { m_dst.put(toBsonData(cast(uint)value.length+1)); m_dst.putCString(value); } else static if (is(T == BsonBinData)) { m_dst.put(toBsonData(cast(int)value.rawData.length)); m_dst.put(value.type); m_dst.put(value.rawData); } else static if (is(T == BsonObjectID)) { m_dst.put(value.m_bytes[]); } else static if (is(T == BsonDate)) { m_dst.put(toBsonData(value.m_time)); } else static if (is(T == SysTime)) { m_dst.put(toBsonData(BsonDate(value).m_time)); } else static if (is(T == BsonRegex)) { m_dst.putCString(value.expression); m_dst.putCString(value.options); } else static if (is(T == BsonTimestamp)) { m_dst.put(toBsonData(value.m_time)); } else static if (is(T == bool)) { m_dst.put(cast(ubyte)(value ? 0x01 : 0x00)); } else static if (is(T : int)) { m_dst.put(toBsonData(cast(int)value)); } else static if (is(T : long)) { m_dst.put(toBsonData(value)); } else static if (is(T : double)) { m_dst.put(toBsonData(cast(double)value)); } else static if (isBsonSerializable!T) m_dst.put(value.toBson().data); else static if (isJsonSerializable!T) m_dst.put(Bson(value.toJson()).data); else static if (is(T : const(ubyte)[])) { writeValue(BsonBinData(BsonBinData.Type.generic, value.idup)); } else static assert(false, "Unsupported type: " ~ T.stringof); } private void writeCompositeEntryHeader(Bson.Type tp) { if (!m_compositeStack.length) { assert(m_type == Bson.Type.null_, "Overwriting root item."); m_type = tp; } if (m_entryName) { m_dst.put(tp); m_dst.putCString(m_entryName); m_entryName = null; } else if (m_entryIndex != size_t.max) { import std.format; m_dst.put(tp); static struct Wrapper { Appender!(ubyte[])* app; void put(char ch) { (*app).put(ch); } void put(in char[] str) { (*app).put(cast(ubyte[])str); } } auto wr = Wrapper(&m_dst); wr.formattedWrite("%d\0", m_entryIndex); m_entryIndex = size_t.max; } } // // deserialization // void readDictionary(T)(scope void delegate(string) entry_callback) { enforce(m_inputData.type == Bson.Type.object, "Expected object instead of "~m_inputData.type.to!string()); auto old = m_inputData; foreach (string name, value; old) { m_inputData = value; entry_callback(name); } m_inputData = old; } void readArray(T)(scope void delegate(size_t) size_callback, scope void delegate() entry_callback) { enforce(m_inputData.type == Bson.Type.array, "Expected array instead of "~m_inputData.type.to!string()); auto old = m_inputData; foreach (value; old) { m_inputData = value; entry_callback(); } m_inputData = old; } T readValue(T)() { static if (is(T == Bson)) return m_inputData; else static if (is(T == Json)) return m_inputData.toJson(); else static if (is(T == bool)) return m_inputData.get!bool(); else static if (is(T == uint)) return cast(T)m_inputData.get!int(); else static if (is(T : int)) return m_inputData.get!int().to!T; else static if (is(T : long)) return cast(T)m_inputData.get!long(); else static if (is(T : double)) return cast(T)m_inputData.get!double(); else static if (is(T == SysTime)) { // support legacy behavior to serialize as string if (m_inputData.type == Bson.Type.string) return SysTime.fromISOExtString(m_inputData.get!string); else return m_inputData.get!BsonDate().toSysTime(); } else static if (isBsonSerializable!T) return T.fromBson(readValue!Bson); else static if (isJsonSerializable!T) return T.fromJson(readValue!Bson.toJson()); else static if (is(T : const(ubyte)[])) { auto ret = m_inputData.get!BsonBinData.rawData; static if (isStaticArray!T) return cast(T)ret[0 .. T.length]; else static if (is(T : immutable(char)[])) return ret; else return cast(T)ret.dup; } else return m_inputData.get!T(); } bool tryReadNull() { if (m_inputData.type == Bson.Type.null_) return true; return false; } private static Bson.Type getBsonTypeID(T, bool accept_ao = false)(T value) { Bson.Type tp; static if (is(T == Bson)) tp = value.type; else static if (is(T == Json)) tp = jsonTypeToBsonType(value.type); else static if (is(T == typeof(null))) tp = Bson.Type.null_; else static if (is(T == string)) tp = Bson.Type.string; else static if (is(T == BsonBinData)) tp = Bson.Type.binData; else static if (is(T == BsonObjectID)) tp = Bson.Type.objectID; else static if (is(T == BsonDate)) tp = Bson.Type.date; else static if (is(T == SysTime)) tp = Bson.Type.date; else static if (is(T == BsonRegex)) tp = Bson.Type.regex; else static if (is(T == BsonTimestamp)) tp = Bson.Type.timestamp; else static if (is(T == bool)) tp = Bson.Type.bool_; else static if (is(T : int)) tp = Bson.Type.int_; else static if (is(T : long)) tp = Bson.Type.long_; else static if (is(T : double)) tp = Bson.Type.double_; else static if (isBsonSerializable!T) tp = value.toBson().type; // FIXME: this is highly inefficient else static if (isJsonSerializable!T) tp = jsonTypeToBsonType(value.toJson().type); // FIXME: this is highly inefficient else static if (is(T : const(ubyte)[])) tp = Bson.Type.binData; else static if (accept_ao && isArray!T) tp = Bson.Type.array; else static if (accept_ao && isAssociativeArray!T) tp = Bson.Type.object; else static if (accept_ao && (is(T == class) || is(T == struct))) tp = Bson.Type.object; else static assert(false, "Unsupported type: " ~ T.stringof); return tp; } } private Bson.Type jsonTypeToBsonType(Json.Type tp) { static immutable Bson.Type[Json.Type.max+1] JsonIDToBsonID = [ Bson.Type.undefined, Bson.Type.null_, Bson.Type.bool_, Bson.Type.int_, Bson.Type.double_, Bson.Type.string, Bson.Type.array, Bson.Type.object ]; return JsonIDToBsonID[tp]; } private Bson.Type writeBson(R)(ref R dst, in Json value) if( isOutputRange!(R, ubyte) ) { final switch(value.type){ case Json.Type.undefined: return Bson.Type.undefined; case Json.Type.null_: return Bson.Type.null_; case Json.Type.bool_: dst.put(cast(ubyte)(cast(bool)value ? 0x01 : 0x00)); return Bson.Type.bool_; case Json.Type.int_: auto v = cast(long)value; if( v >= int.min && v <= int.max ){ dst.put(toBsonData(cast(int)v)); return Bson.Type.int_; } dst.put(toBsonData(v)); return Bson.Type.long_; case Json.Type.float_: dst.put(toBsonData(cast(double)value)); return Bson.Type.double_; case Json.Type.string: dst.put(toBsonData(cast(uint)value.length+1)); dst.put(cast(bdata_t)cast(string)value); dst.put(cast(ubyte)0); return Bson.Type.string; case Json.Type.array: auto app = appender!bdata_t(); foreach( size_t i, ref const Json v; value ){ app.put(cast(ubyte)(jsonTypeToBsonType(v.type))); putCString(app, to!string(i)); writeBson(app, v); } dst.put(toBsonData(cast(int)(app.data.length + int.sizeof + 1))); dst.put(app.data); dst.put(cast(ubyte)0); return Bson.Type.array; case Json.Type.object: auto app = appender!bdata_t(); foreach( string k, ref const Json v; value ){ app.put(cast(ubyte)(jsonTypeToBsonType(v.type))); putCString(app, k); writeBson(app, v); } dst.put(toBsonData(cast(int)(app.data.length + int.sizeof + 1))); dst.put(app.data); dst.put(cast(ubyte)0); return Bson.Type.object; } } unittest { Json jsvalue = parseJsonString("{\"key\" : \"Value\"}"); assert(serializeToBson(jsvalue).toJson() == jsvalue); jsvalue = parseJsonString("{\"key\" : [{\"key\" : \"Value\"}, {\"key2\" : \"Value2\"}] }"); assert(serializeToBson(jsvalue).toJson() == jsvalue); jsvalue = parseJsonString("[ 1 , 2 , 3]"); assert(serializeToBson(jsvalue).toJson() == jsvalue); } private string skipCString(ref bdata_t data) { auto idx = data.countUntil(0); enforce(idx >= 0, "Unterminated BSON C-string."); auto ret = data[0 .. idx]; data = data[idx+1 .. $]; return cast(string)ret; } private void putCString(R)(R dst, string str) { dst.put(cast(bdata_t)str); dst.put(cast(ubyte)0); } ubyte[] toBsonData(T)(T v) { /*static T tmp; tmp = nativeToLittleEndian(v); return cast(ubyte[])((&tmp)[0 .. 1]);*/ if (__ctfe) return nativeToLittleEndian(v).dup; else { static ubyte[T.sizeof] ret; ret = nativeToLittleEndian(v); return ret; } } T fromBsonData(T)(in ubyte[] v) { assert(v.length >= T.sizeof); //return (cast(T[])v[0 .. T.sizeof])[0]; ubyte[T.sizeof] vu = v[0 .. T.sizeof]; return littleEndianToNative!T(vu); } ubyte[] toBigEndianData(T)(T v) { if (__ctfe) return nativeToBigEndian(v).dup; else { static ubyte[T.sizeof] ret; ret = nativeToBigEndian(v); return ret; } } private string underscoreStrip(string field_name) pure { if( field_name.length < 1 || field_name[$-1] != '_' ) return field_name; else return field_name[0 .. $-1]; } /// private package template isBsonSerializable(T) { enum isBsonSerializable = is(typeof(T.init.toBson()) == Bson) && is(typeof(T.fromBson(Bson())) == T); }
D
(Greek mythology) brother of Prometheus
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/_winioctl.d) */ module core.sys.windows.winioctl; version (Windows): @system: // FIXME: check types of some constants private import core.sys.windows.basetyps, core.sys.windows.windef; enum size_t HIST_NO_OF_BUCKETS = 24, HISTOGRAM_BUCKET_SIZE = HISTOGRAM_BUCKET.sizeof, DISK_HISTOGRAM_SIZE = DISK_HISTOGRAM.sizeof; alias DWORD DEVICE_TYPE; enum : DEVICE_TYPE { FILE_DEVICE_BEEP = 1, FILE_DEVICE_CD_ROM, FILE_DEVICE_CD_ROM_FILE_SYSTEM, FILE_DEVICE_CONTROLLER, FILE_DEVICE_DATALINK, FILE_DEVICE_DFS, FILE_DEVICE_DISK, FILE_DEVICE_DISK_FILE_SYSTEM, FILE_DEVICE_FILE_SYSTEM, FILE_DEVICE_INPORT_PORT, FILE_DEVICE_KEYBOARD, FILE_DEVICE_MAILSLOT, FILE_DEVICE_MIDI_IN, FILE_DEVICE_MIDI_OUT, FILE_DEVICE_MOUSE, FILE_DEVICE_MULTI_UNC_PROVIDER, FILE_DEVICE_NAMED_PIPE, FILE_DEVICE_NETWORK, FILE_DEVICE_NETWORK_BROWSER, FILE_DEVICE_NETWORK_FILE_SYSTEM, FILE_DEVICE_NULL, FILE_DEVICE_PARALLEL_PORT, FILE_DEVICE_PHYSICAL_NETCARD, FILE_DEVICE_PRINTER, FILE_DEVICE_SCANNER, FILE_DEVICE_SERIAL_MOUSE_PORT, FILE_DEVICE_SERIAL_PORT, FILE_DEVICE_SCREEN, FILE_DEVICE_SOUND, FILE_DEVICE_STREAMS, FILE_DEVICE_TAPE, FILE_DEVICE_TAPE_FILE_SYSTEM, FILE_DEVICE_TRANSPORT, FILE_DEVICE_UNKNOWN, FILE_DEVICE_VIDEO, FILE_DEVICE_VIRTUAL_DISK, FILE_DEVICE_WAVE_IN, FILE_DEVICE_WAVE_OUT, FILE_DEVICE_8042_PORT, FILE_DEVICE_NETWORK_REDIRECTOR, FILE_DEVICE_BATTERY, FILE_DEVICE_BUS_EXTENDER, FILE_DEVICE_MODEM, FILE_DEVICE_VDM, FILE_DEVICE_MASS_STORAGE, FILE_DEVICE_SMB, FILE_DEVICE_KS, FILE_DEVICE_CHANGER, FILE_DEVICE_SMARTCARD, FILE_DEVICE_ACPI, FILE_DEVICE_DVD, FILE_DEVICE_FULLSCREEN_VIDEO, FILE_DEVICE_DFS_FILE_SYSTEM, FILE_DEVICE_DFS_VOLUME, FILE_DEVICE_SERENUM, FILE_DEVICE_TERMSRV, FILE_DEVICE_KSEC // = 57 } enum { METHOD_BUFFERED, METHOD_IN_DIRECT, METHOD_OUT_DIRECT, METHOD_NEITHER } enum { FILE_ANY_ACCESS, FILE_SPECIAL_ACCESS = 0, FILE_READ_ACCESS, FILE_WRITE_ACCESS } /* Bit pattern: * tttttttt tttttttt aaffffff ffffffmm */ /+ #define CTL_CODE(t, f, m, a) (((t)<<16)|((a)<<14)|((f)<<2)|(m)) +/ template CTL_CODE_T(DEVICE_TYPE t, uint f, uint m, uint a) { enum DWORD CTL_CODE_T = (t << 16) | (a << 14) | (f << 2) | m; } DEVICE_TYPE DEVICE_TYPE_FROM_CTL_CODE(DWORD c) { return (c & 0xFFFF0000) >> 16; } enum DEVICE_TYPE IOCTL_STORAGE_BASE = FILE_DEVICE_MASS_STORAGE, IOCTL_DISK_BASE = FILE_DEVICE_DISK, IOCTL_VOLUME_BASE = 'V'; enum : DWORD { IOCTL_STORAGE_CHECK_VERIFY = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_STORAGE_CHECK_VERIFY2 = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_STORAGE_MEDIA_REMOVAL = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_STORAGE_EJECT_MEDIA = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_STORAGE_LOAD_MEDIA = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_STORAGE_LOAD_MEDIA2 = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_STORAGE_RESERVE = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_STORAGE_RELEASE = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_STORAGE_FIND_NEW_DEVICES = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_STORAGE_EJECTION_CONTROL = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_STORAGE_MCN_CONTROL = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_STORAGE_GET_MEDIA_TYPES = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_STORAGE_GET_MEDIA_TYPES_EX = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_STORAGE_RESET_BUS = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_STORAGE_RESET_DEVICE = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_STORAGE_GET_DEVICE_NUMBER = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_STORAGE_PREDICT_FAILURE = CTL_CODE_T!(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_GET_DRIVE_GEOMETRY = CTL_CODE_T!(IOCTL_DISK_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_GET_PARTITION_INFO = CTL_CODE_T!(IOCTL_DISK_BASE, 1, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_SET_PARTITION_INFO = CTL_CODE_T!(IOCTL_DISK_BASE, 2, METHOD_BUFFERED, FILE_READ_ACCESS|FILE_WRITE_ACCESS), IOCTL_DISK_GET_DRIVE_LAYOUT = CTL_CODE_T!(IOCTL_DISK_BASE, 3, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_SET_DRIVE_LAYOUT = CTL_CODE_T!(IOCTL_DISK_BASE, 4, METHOD_BUFFERED, FILE_READ_ACCESS|FILE_WRITE_ACCESS), IOCTL_DISK_VERIFY = CTL_CODE_T!(IOCTL_DISK_BASE, 5, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_FORMAT_TRACKS = CTL_CODE_T!(IOCTL_DISK_BASE, 6, METHOD_BUFFERED, FILE_READ_ACCESS|FILE_WRITE_ACCESS), IOCTL_DISK_REASSIGN_BLOCKS = CTL_CODE_T!(IOCTL_DISK_BASE, 7, METHOD_BUFFERED, FILE_READ_ACCESS|FILE_WRITE_ACCESS), IOCTL_DISK_PERFORMANCE = CTL_CODE_T!(IOCTL_DISK_BASE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_IS_WRITABLE = CTL_CODE_T!(IOCTL_DISK_BASE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_LOGGING = CTL_CODE_T!(IOCTL_DISK_BASE, 10, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_FORMAT_TRACKS_EX = CTL_CODE_T!(IOCTL_DISK_BASE, 11, METHOD_BUFFERED, FILE_READ_ACCESS|FILE_WRITE_ACCESS), IOCTL_DISK_HISTOGRAM_STRUCTURE = CTL_CODE_T!(IOCTL_DISK_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_HISTOGRAM_DATA = CTL_CODE_T!(IOCTL_DISK_BASE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_HISTOGRAM_RESET = CTL_CODE_T!(IOCTL_DISK_BASE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_REQUEST_STRUCTURE = CTL_CODE_T!(IOCTL_DISK_BASE, 15, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_REQUEST_DATA = CTL_CODE_T!(IOCTL_DISK_BASE, 16, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_GET_PARTITION_INFO_EX = CTL_CODE_T!(IOCTL_DISK_BASE, 0x12, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_SET_PARTITION_INFO_EX = CTL_CODE_T!(IOCTL_DISK_BASE, 0x13, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS), IOCTL_DISK_GET_DRIVE_LAYOUT_EX = CTL_CODE_T!(IOCTL_DISK_BASE, 0x14, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_SET_DRIVE_LAYOUT_EX = CTL_CODE_T!(IOCTL_DISK_BASE, 0x15, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS), IOCTL_DISK_CREATE_DISK = CTL_CODE_T!(IOCTL_DISK_BASE, 0x16, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS), IOCTL_DISK_GET_LENGTH_INFO = CTL_CODE_T!(IOCTL_DISK_BASE, 0x17, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_PERFORMANCE_OFF = CTL_CODE_T!(IOCTL_DISK_BASE, 0x18, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_GET_DRIVE_GEOMETRY_EX = CTL_CODE_T!(IOCTL_DISK_BASE, 0x28, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_GROW_PARTITION = CTL_CODE_T!(IOCTL_DISK_BASE, 0x34, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS), IOCTL_DISK_GET_CACHE_INFORMATION = CTL_CODE_T!(IOCTL_DISK_BASE, 0x35, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_SET_CACHE_INFORMATION = CTL_CODE_T!(IOCTL_DISK_BASE, 0x36, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS), IOCTL_DISK_DELETE_DRIVE_LAYOUT = CTL_CODE_T!(IOCTL_DISK_BASE, 0x40, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS), IOCTL_DISK_UPDATE_PROPERTIES = CTL_CODE_T!(IOCTL_DISK_BASE, 0x50, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_CHECK_VERIFY = CTL_CODE_T!(IOCTL_DISK_BASE, 0x200, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_MEDIA_REMOVAL = CTL_CODE_T!(IOCTL_DISK_BASE, 0x201, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_EJECT_MEDIA = CTL_CODE_T!(IOCTL_DISK_BASE, 0x202, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_LOAD_MEDIA = CTL_CODE_T!(IOCTL_DISK_BASE, 0x203, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_RESERVE = CTL_CODE_T!(IOCTL_DISK_BASE, 0x204, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_RELEASE = CTL_CODE_T!(IOCTL_DISK_BASE, 0x205, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_FIND_NEW_DEVICES = CTL_CODE_T!(IOCTL_DISK_BASE, 0x206, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_REMOVE_DEVICE = CTL_CODE_T!(IOCTL_DISK_BASE, 0x207, METHOD_BUFFERED, FILE_READ_ACCESS), IOCTL_DISK_GET_MEDIA_TYPES = CTL_CODE_T!(IOCTL_DISK_BASE, 0x300, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_DISK_UPDATE_DRIVE_SIZE = CTL_CODE_T!(IOCTL_DISK_BASE, 0x0032, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS), IOCTL_SERIAL_LSRMST_INSERT = CTL_CODE_T!(FILE_DEVICE_SERIAL_PORT, 31, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS = CTL_CODE_T!(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS), IOCTL_VOLUME_IS_CLUSTERED = CTL_CODE_T!(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_LOCK_VOLUME = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_UNLOCK_VOLUME = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_DISMOUNT_VOLUME = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_MOUNT_DBLS_VOLUME = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 13, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_GET_COMPRESSION = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_SET_COMPRESSION = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, FILE_READ_DATA|FILE_WRITE_DATA), FSCTL_READ_COMPRESSION = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 17, METHOD_NEITHER, FILE_READ_DATA), FSCTL_WRITE_COMPRESSION = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 18, METHOD_NEITHER, FILE_WRITE_DATA), FSCTL_GET_NTFS_VOLUME_DATA = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 25, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_GET_VOLUME_BITMAP = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, FILE_ANY_ACCESS), FSCTL_GET_RETRIEVAL_POINTERS = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 28, METHOD_NEITHER, FILE_ANY_ACCESS), FSCTL_MOVE_FILE = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_GET_REPARSE_POINT = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_SET_REPARSE_POINT = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_DELETE_REPARSE_POINT = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_ANY_ACCESS), FSCTL_SET_SPARSE = CTL_CODE_T!(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS), } enum : BYTE { PARTITION_ENTRY_UNUSED, PARTITION_FAT_12, PARTITION_XENIX_1, PARTITION_XENIX_2, PARTITION_FAT_16, PARTITION_EXTENDED, PARTITION_HUGE, PARTITION_IFS, // = 0x07 PARTITION_FAT32 = 0x0B, PARTITION_FAT32_XINT13 = 0x0C, PARTITION_XINT13 = 0x0E, PARTITION_XINT13_EXTENDED = 0x0F, PARTITION_PREP = 0x41, PARTITION_LDM = 0x42, PARTITION_UNIX = 0x63 } enum BYTE PARTITION_NTFT = 0x80, VALID_NTFT = 0xC0; enum { SERIAL_LSRMST_ESCAPE, SERIAL_LSRMST_LSR_DATA, SERIAL_LSRMST_LSR_NODATA, SERIAL_LSRMST_MST } enum { DISK_LOGGING_START, DISK_LOGGING_STOP, DISK_LOGGING_DUMP, DISK_BINNING } alias WORD BAD_TRACK_NUMBER; alias WORD* PBAD_TRACK_NUMBER; enum BIN_TYPES { RequestSize, RequestLocation } struct BIN_RANGE { LARGE_INTEGER StartValue; LARGE_INTEGER Length; } alias BIN_RANGE* PBIN_RANGE; struct BIN_COUNT { BIN_RANGE BinRange; DWORD BinCount; } alias BIN_COUNT* PBIN_COUNT; struct BIN_RESULTS { DWORD NumberOfBins; BIN_COUNT _BinCounts; BIN_COUNT* BinCounts() return { return &_BinCounts; } } alias BIN_RESULTS* PBIN_RESULTS; enum PARTITION_STYLE { PARTITION_STYLE_MBR, PARTITION_STYLE_GPT, PARTITION_STYLE_RAW } struct CREATE_DISK_GPT { GUID DiskId; DWORD MaxPartitionCount; } alias CREATE_DISK_GPT* PCREATE_DISK_GPT; struct CREATE_DISK_MBR { DWORD Signature; } alias CREATE_DISK_MBR* PCREATE_DISK_MBR; struct CREATE_DISK { PARTITION_STYLE PartitionStyle; union { CREATE_DISK_MBR Mbr; CREATE_DISK_GPT Gpt; } } alias CREATE_DISK* PCREATE_DISK; enum DISK_CACHE_RETENTION_PRIORITY { EqualPriority, KeepPrefetchedData, KeepReadData } struct DISK_CACHE_INFORMATION { BOOLEAN ParametersSavable; BOOLEAN ReadCacheEnabled; BOOLEAN WriteCacheEnabled; DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority; DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority; WORD DisablePrefetchTransferLength; BOOLEAN PrefetchScalar; union { struct _ScalarPrefetch { WORD Minimum; WORD Maximum; WORD MaximumBlocks; } _ScalarPrefetch ScalarPrefetch; struct _BlockPrefetch { WORD Minimum; WORD Maximum; } _BlockPrefetch BlockPrefetch; } } alias DISK_CACHE_INFORMATION* PDISK_CACHE_INFORMATION; enum DETECTION_TYPE { DetectNone, DetectInt13, DetectExInt13 } struct DISK_INT13_INFO { WORD DriveSelect; DWORD MaxCylinders; WORD SectorsPerTrack; WORD MaxHeads; WORD NumberDrives; } alias DISK_INT13_INFO* PDISK_INT13_INFO; struct DISK_EX_INT13_INFO { WORD ExBufferSize; WORD ExFlags; DWORD ExCylinders; DWORD ExHeads; DWORD ExSectorsPerTrack; DWORD64 ExSectorsPerDrive; WORD ExSectorSize; WORD ExReserved; } alias DISK_EX_INT13_INFO* PDISK_EX_INT13_INFO; struct DISK_DETECTION_INFO { DWORD SizeOfDetectInfo; DETECTION_TYPE DetectionType; DISK_INT13_INFO Int13; DISK_EX_INT13_INFO ExInt13; } alias DISK_DETECTION_INFO* PDISK_DETECTION_INFO; enum MEDIA_TYPE { Unknown, F5_1Pt2_512, F3_1Pt44_512, F3_2Pt88_512, F3_20Pt8_512, F3_720_512, F5_360_512, F5_320_512, F5_320_1024, F5_180_512, F5_160_512, RemovableMedia, FixedMedia, F3_120M_512, F3_640_512, F5_640_512, F5_720_512, F3_1Pt2_512, F3_1Pt23_1024, F5_1Pt23_1024, F3_128Mb_512, F3_230Mb_512, F8_256_128, F3_200Mb_512, F3_240M_512, F3_32M_512 } alias MEDIA_TYPE* PMEDIA_TYPE; struct DISK_GEOMETRY { LARGE_INTEGER Cylinders; MEDIA_TYPE MediaType; DWORD TracksPerCylinder; DWORD SectorsPerTrack; DWORD BytesPerSector; } alias DISK_GEOMETRY* PDISK_GEOMETRY; struct DISK_GEOMETRY_EX { DISK_GEOMETRY Geometry; LARGE_INTEGER DiskSize; BYTE _Data; BYTE* Data() return { return &_Data; } } alias DISK_GEOMETRY_EX* PDISK_GEOMETRY_EX; struct DISK_GROW_PARTITION { DWORD PartitionNumber; LARGE_INTEGER BytesToGrow; } alias DISK_GROW_PARTITION* PDISK_GROW_PARTITION; struct DISK_PARTITION_INFO { DWORD SizeOfPartitionInfo; PARTITION_STYLE PartitionStyle; union { //struct { DWORD Signature; //} Mbr; //struct { GUID DiskId; //} Gpt; } } alias DISK_PARTITION_INFO* PDISK_PARTITION_INFO; struct DISK_PERFORMANCE { LARGE_INTEGER BytesRead; LARGE_INTEGER BytesWritten; LARGE_INTEGER ReadTime; LARGE_INTEGER WriteTime; DWORD ReadCount; DWORD WriteCount; DWORD QueueDepth; } alias DISK_PERFORMANCE* PDISK_PERFORMANCE; struct DISK_RECORD { LARGE_INTEGER ByteOffset; LARGE_INTEGER StartTime; LARGE_INTEGER EndTime; PVOID VirtualAddress; DWORD NumberOfBytes; BYTE DeviceNumber; BOOLEAN ReadRequest; } alias DISK_RECORD* PDISK_RECORD; struct DISK_LOGGING { BYTE Function; PVOID BufferAddress; DWORD BufferSize; } alias DISK_LOGGING* PDISK_LOGGING; struct DISKQUOTA_USER_INFORMATION { LONGLONG QuotaUsed; LONGLONG QuotaThreshold; LONGLONG QuotaLimit; } alias DISKQUOTA_USER_INFORMATION* PDISKQUOTA_USER_INFORMATION; struct FORMAT_PARAMETERS { MEDIA_TYPE MediaType; DWORD StartCylinderNumber; DWORD EndCylinderNumber; DWORD StartHeadNumber; DWORD EndHeadNumber; } alias FORMAT_PARAMETERS* PFORMAT_PARAMETERS; struct FORMAT_EX_PARAMETERS { MEDIA_TYPE MediaType; DWORD StartCylinderNumber; DWORD EndCylinderNumber; DWORD StartHeadNumber; DWORD EndHeadNumber; WORD FormatGapLength; WORD SectorsPerTrack; WORD _SectorNumber; WORD* SectorNumber() return { return &_SectorNumber; } } alias FORMAT_EX_PARAMETERS* PFORMAT_EX_PARAMETERS; struct GET_LENGTH_INFORMATION { LARGE_INTEGER Length; } struct HISTOGRAM_BUCKET { DWORD Reads; DWORD Writes; } alias HISTOGRAM_BUCKET* PHISTOGRAM_BUCKET; struct DISK_HISTOGRAM { LARGE_INTEGER DiskSize; LARGE_INTEGER Start; LARGE_INTEGER End; LARGE_INTEGER Average; LARGE_INTEGER AverageRead; LARGE_INTEGER AverageWrite; DWORD Granularity; DWORD Size; DWORD ReadCount; DWORD WriteCount; PHISTOGRAM_BUCKET Histogram; } alias DISK_HISTOGRAM* PDISK_HISTOGRAM; struct DISK_EXTENT { DWORD DiskNumber; LARGE_INTEGER StartingOffset; LARGE_INTEGER ExtentLength; } alias DISK_EXTENT* PDISK_EXTENT; struct VOLUME_DISK_EXTENTS { DWORD NumberOfDiskExtents; DISK_EXTENT _Extents; DISK_EXTENT* Extents() return { return &_Extents; } } alias VOLUME_DISK_EXTENTS* PVOLUME_DISK_EXTENTS; struct PARTITION_INFORMATION { LARGE_INTEGER StartingOffset; LARGE_INTEGER PartitionLength; DWORD HiddenSectors; DWORD PartitionNumber; BYTE PartitionType; BOOLEAN BootIndicator; BOOLEAN RecognizedPartition; BOOLEAN RewritePartition; } alias PARTITION_INFORMATION* PPARTITION_INFORMATION; struct DRIVE_LAYOUT_INFORMATION { DWORD PartitionCount; DWORD Signature; PARTITION_INFORMATION _PartitionEntry; PARTITION_INFORMATION* PartitionEntry() return { return &_PartitionEntry; } } alias DRIVE_LAYOUT_INFORMATION* PDRIVE_LAYOUT_INFORMATION; struct DRIVE_LAYOUT_INFORMATION_GPT { GUID DiskId; LARGE_INTEGER StartingUsableOffset; LARGE_INTEGER UsableLength; ULONG MaxPartitionCount; } alias DRIVE_LAYOUT_INFORMATION_GPT* PDRIVE_LAYOUT_INFORMATION_GPT; struct DRIVE_LAYOUT_INFORMATION_MBR { ULONG Signature; } alias DRIVE_LAYOUT_INFORMATION_MBR* PDRIVE_LAYOUT_INFORMATION_MBR; struct PARTITION_INFORMATION_MBR { BYTE PartitionType; BOOLEAN BootIndicator; BOOLEAN RecognizedPartition; DWORD HiddenSectors; } struct PARTITION_INFORMATION_GPT { GUID PartitionType; GUID PartitionId; DWORD64 Attributes; WCHAR[36] Name = 0; } struct PARTITION_INFORMATION_EX { PARTITION_STYLE PartitionStyle; LARGE_INTEGER StartingOffset; LARGE_INTEGER PartitionLength; DWORD PartitionNumber; BOOLEAN RewritePartition; union { PARTITION_INFORMATION_MBR Mbr; PARTITION_INFORMATION_GPT Gpt; } } struct DRIVE_LAYOUT_INFORMATION_EX { DWORD PartitionStyle; DWORD PartitionCount; union { DRIVE_LAYOUT_INFORMATION_MBR Mbr; DRIVE_LAYOUT_INFORMATION_GPT Gpt; } PARTITION_INFORMATION_EX _PartitionEntry; PARTITION_INFORMATION_EX* PartitionEntry() return { return &_PartitionEntry; } } alias DRIVE_LAYOUT_INFORMATION_EX* PDRIVE_LAYOUT_INFORMATION_EX; struct MOVE_FILE_DATA { HANDLE FileHandle; LARGE_INTEGER StartingVcn; LARGE_INTEGER StartingLcn; DWORD ClusterCount; } alias MOVE_FILE_DATA* PMOVE_FILE_DATA; struct PERF_BIN { DWORD NumberOfBins; DWORD TypeOfBin; BIN_RANGE _BinsRanges; BIN_RANGE* BinsRanges() return { return &_BinsRanges; } } alias PERF_BIN* PPERF_BIN; struct PREVENT_MEDIA_REMOVAL { BOOLEAN PreventMediaRemoval; } alias PREVENT_MEDIA_REMOVAL* PPREVENT_MEDIA_REMOVAL; struct RETRIEVAL_POINTERS_BUFFER { DWORD ExtentCount; LARGE_INTEGER StartingVcn; // In MinGW, this is declared as struct { ... } Extents[1]; struct Extent { LARGE_INTEGER NextVcn; LARGE_INTEGER Lcn; } Extent _Extents; Extent* Extents() return { return &_Extents; } } alias RETRIEVAL_POINTERS_BUFFER* PRETRIEVAL_POINTERS_BUFFER; struct REASSIGN_BLOCKS { WORD Reserved; WORD Count; DWORD _BlockNumber; DWORD* BlockNumber() return { return &_BlockNumber; } } alias REASSIGN_BLOCKS* PREASSIGN_BLOCKS; struct SET_PARTITION_INFORMATION { BYTE PartitionType; } alias SET_PARTITION_INFORMATION* PSET_PARTITION_INFORMATION; struct STARTING_LCN_INPUT_BUFFER { LARGE_INTEGER StartingLcn; } alias STARTING_LCN_INPUT_BUFFER* PSTARTING_LCN_INPUT_BUFFER; struct STARTING_VCN_INPUT_BUFFER { LARGE_INTEGER StartingVcn; } alias STARTING_VCN_INPUT_BUFFER* PSTARTING_VCN_INPUT_BUFFER; struct VERIFY_INFORMATION { LARGE_INTEGER StartingOffset; DWORD Length; } alias VERIFY_INFORMATION* PVERIFY_INFORMATION; struct VOLUME_BITMAP_BUFFER { LARGE_INTEGER StartingLcn; LARGE_INTEGER BitmapSize; BYTE _Buffer; BYTE* Buffer() return { return &_Buffer; } } alias VOLUME_BITMAP_BUFFER* PVOLUME_BITMAP_BUFFER; struct NTFS_VOLUME_DATA_BUFFER { LARGE_INTEGER VolumeSerialNumber; LARGE_INTEGER NumberSectors; LARGE_INTEGER TotalClusters; LARGE_INTEGER FreeClusters; LARGE_INTEGER TotalReserved; DWORD BytesPerSector; DWORD BytesPerCluster; DWORD BytesPerFileRecordSegment; DWORD ClustersPerFileRecordSegment; LARGE_INTEGER MftValidDataLength; LARGE_INTEGER MftStartLcn; LARGE_INTEGER Mft2StartLcn; LARGE_INTEGER MftZoneStart; LARGE_INTEGER MftZoneEnd; } alias NTFS_VOLUME_DATA_BUFFER* PNTFS_VOLUME_DATA_BUFFER; bool IsRecognizedPartition(BYTE t) { return ((t & PARTITION_NTFT) && ((t & (-1 - VALID_NTFT)) == PARTITION_FAT_12 || (t & (-1 - VALID_NTFT)) == PARTITION_FAT_16 || (t & (-1 - VALID_NTFT)) == PARTITION_IFS || (t & (-1 - VALID_NTFT)) == PARTITION_HUGE || (t & (-1 - VALID_NTFT)) == PARTITION_FAT32 || (t & (-1 - VALID_NTFT)) == PARTITION_FAT32_XINT13 || (t & (-1 - VALID_NTFT)) == PARTITION_XINT13)) || (t & (-1 - PARTITION_NTFT)) == PARTITION_FAT_12 || (t & (-1 - PARTITION_NTFT)) == PARTITION_FAT_16 || (t & (-1 - PARTITION_NTFT)) == PARTITION_IFS || (t & (-1 - PARTITION_NTFT)) == PARTITION_HUGE || (t & (-1 - PARTITION_NTFT)) == PARTITION_FAT32 || (t & (-1 - PARTITION_NTFT)) == PARTITION_FAT32_XINT13 || (t & (-1 - PARTITION_NTFT)) == PARTITION_XINT13; } bool IsContainerPartition(BYTE t) { return ((t & PARTITION_NTFT) && ((t & (-1 - VALID_NTFT)) == PARTITION_EXTENDED || (t & (-1 - VALID_NTFT)) == PARTITION_XINT13_EXTENDED)) || (t & (-1 - PARTITION_NTFT)) == PARTITION_EXTENDED || (t & (-1 - PARTITION_NTFT)) == PARTITION_XINT13_EXTENDED; }
D
module os.win.tlb.msscriptcontrol; private import os.win.com.core; enum ScriptControlStates { Initialized = 0x00000000, Connected = 0x00000001, } interface IScriptProcedure : IDispatch { mixin(uuid("70841c73-067d-11d0-95d8-00a02463ab28")); int get_Name(out wchar* pbstrName); int get_NumArgs(out int pcArgs); int get_HasReturnValue(out short pfHasReturnValue); } interface IScriptProcedureCollection : IDispatch { mixin(uuid("70841c71-067d-11d0-95d8-00a02463ab28")); int get__NewEnum(out IUnknown ppenumProcedures); int get_Item(VARIANT Index, out IScriptProcedure ppdispProcedure); int get_Count(out int plCount); } interface IScriptModule : IDispatch { mixin(uuid("70841c70-067d-11d0-95d8-00a02463ab28")); int get_Name(out wchar* pbstrName); int get_CodeObject(out IDispatch ppdispObject); int get_Procedures(out IScriptProcedureCollection ppdispProcedures); int AddCode(wchar* Code); int Eval(wchar* Expression, out VARIANT pvarResult); int ExecuteStatement(wchar* Statement); int Run(wchar* ProcedureName, wchar* Parameters, out VARIANT pvarResult); } interface IScriptModuleCollection : IDispatch { mixin(uuid("70841c6f-067d-11d0-95d8-00a02463ab28")); int get__NewEnum(out IUnknown ppenumContexts); int get_Item(VARIANT Index, out IScriptModule ppmod); int get_Count(out int plCount); int Add(wchar* Name, VARIANT* ObjectParam, out IScriptModule ppmod); } interface IScriptError : IDispatch { mixin(uuid("70841c78-067d-11d0-95d8-00a02463ab28")); int get_Number(out int plNumber); int get_Source(out wchar* pbstrSource); int get_Description(out wchar* pbstrDescription); int get_HelpFile(out wchar* pbstrHelpFile); int get_HelpContext(out int plHelpContext); int get_Text(out wchar* pbstrText); int get_Line(out int plLine); int get_Column(out int plColumn); int Clear(); } interface IScriptControl : IDispatch { mixin(uuid("0e59f1d3-1fbe-11d0-8ff2-00a0d10038bc")); int get_Language(out wchar* pbstrLanguage); int put_Language(wchar* pbstrLanguage); int get_State(out ScriptControlStates pssState); int put_State(ScriptControlStates pssState); int put_SitehWnd(int phwnd); int get_SitehWnd(out int phwnd); int get_Timeout(out int plMilleseconds); int put_Timeout(int plMilleseconds); int get_AllowUI(out short pfAllowUI); int put_AllowUI(short pfAllowUI); int get_UseSafeSubset(out short pfUseSafeSubset); int put_UseSafeSubset(short pfUseSafeSubset); int get_Modules(out IScriptModuleCollection ppmods); int get_Error(out IScriptError ppse); int get_CodeObject(out IDispatch ppdispObject); int get_Procedures(out IScriptProcedureCollection ppdispProcedures); int _AboutBox(); int AddObject(wchar* Name, IDispatch ObjectParam, short AddMembers); int Reset(); int AddCode(wchar* Code); int Eval(wchar* Expression, out VARIANT pvarResult); int ExecuteStatement(wchar* Statement); int Run(wchar* ProcedureName, wchar* Parameters, out VARIANT pvarResult); } interface DScriptControlSource : IDispatch { mixin(uuid("8b167d60-8605-11d0-abcb-00a0c90fffc0")); /+void Error();+/ /+void Timeout();+/ } abstract final class ScriptControl { mixin(uuid("0e59f1d5-1fbe-11d0-8ff2-00a0d10038bc")); mixin Interfaces!(IScriptControl); } const wchar* GlobalModule = "Global"; const int NoTimeout = 0xFFFFFFFF;
D
module mach.io.file.traverse; private: import mach.error : errno, ErrnoException, SysErrorException; import mach.text.cstring : tocstring, fromcstring; import mach.text.utf : utf8encode; import mach.range.asarray : asarray; import mach.io.file.attributes : Attributes; import mach.io.file.common; import mach.io.file.exceptions; import mach.io.file.path : Path; public: /// Exception thrown when listing or traversing a directory fails. class FileListDirException: FileException{ string path; this(string path, Throwable next = null, size_t line = __LINE__, string file = __FILE__){ super("Failure listing files in directory \"" ~ path ~ "\".", next, line, file); this.path = path; } } /// Get a range for enumerating the files in a directory. auto listdir(in string path){ return ListDirRange(path); } /// Get a range for traversing all the files and subdirectories in a directory. /// Accepts a template argument determining whether the traversal is depth-first /// or breadth-first. auto traversedir(TraverseDirMode mode = TraverseDirMode.DepthFirst)(in string path){ return TraverseDirRange!mode(path); } struct ListDirRange{ /// The directory being listed. string path; /// Whether to include "." and ".." in the output. bool skipdots = true; string toString() const{ return this.path; } version(Windows){ import std.datetime : FILETIMEToSysTime; // TODO: Don't depend on this import core.sys.windows.winbase; import core.sys.windows.winnt; /// https://msdn.microsoft.com/en-us/library/windows/desktop/aa365740(v=vs.85).aspx static struct Entry{ string listpath; WIN32_FIND_DATAW finddata; @property auto attributes() const{ return Attributes(this.finddata.dwFileAttributes); } @property bool isfile() const{ return this.attributes.isfile; } @property bool isdir() const{ return this.attributes.isdir; } @property bool islink() const{ return this.attributes.islink; } @property auto creationtime() const{ return FILETIMEToSysTime(&this.finddata.ftCreationTime); } @property auto accesstime() const{ return FILETIMEToSysTime(&this.finddata.ftLastAccessTime); } @property auto writetime() const{ return FILETIMEToSysTime(&this.finddata.ftLastWriteTime); } @property auto size() const{ return ( (this.finddata.nFileSizeHigh * (DWORD.max + ulong(1))) + this.finddata.nFileSizeLow ); } @property string name() const{ return this.finddata.cFileName.ptr.fromcstring.utf8encode.asarray!(immutable char); } @property Path path() const{ return Path(this.listpath ~ "/" ~ this.name); } @property bool isdots() const{ return ( this.finddata.cFileName[0 .. 2] == ".\0"w || this.finddata.cFileName[0 .. 3] == "..\0"w ); } } WinHandle handle; WIN32_FIND_DATAW finddata; bool isempty = false; this(string path){ this.path = path; this.handle = FindFirstFileW((path ~ "\\*.*").tocstring!wchar, &this.finddata); if(this.handle == INVALID_HANDLE_VALUE){ throw new FileListDirException(path, new SysErrorException); } if(this.skipdots && this.front.isdots) this.popFront(); } @property bool empty() const{ return this.isempty; } @property auto front() in{assert(!this.empty);} body{ return Entry(this.path, this.finddata); } void popFront() in{assert(!this.empty);} body{ auto result = FindNextFile(this.handle, &this.finddata); if(!result){ if(GetLastError() == ERROR_NO_MORE_FILES){ this.isempty = true; FindClose(this.handle); }else{ throw new FileListDirException(path, new SysErrorException); } }else{ if(this.skipdots && this.front.isdots) this.popFront(); } } }else{ import core.sys.posix.dirent; DIR* handle; dirent* current; /// http://pubs.opengroup.org/onlinepubs/009695399/functions/readdir_r.html static struct Entry{ static if(is(typeof(dirent.d_fileno))){ alias FileNo = typeof(dirent.d_fileno); static private auto getdirentfileno(in dirent* entry){ return entry.d_fileno; } }else static if(is(typeof(dirent.d_ino))){ alias FileNo = typeof(dirent.d_ino); static private auto getdirentfileno(in dirent* entry){ return entry.d_ino; } }else{ static assert(false, "Unsupported platform."); } string listpath; FileNo d_fileno; typeof(dirent.d_type) d_type; string entryname; this(string listpath, dirent* entry){ this.listpath = listpath; // This memory is liable to be overwritten later, so dup it now. this.d_fileno = this.getdirentfileno(entry); this.d_type = entry.d_type; // TODO: This will not work on Solaris because of a different // representation of file name in the dirent struct. // See http://stackoverflow.com/a/563411/4099022 static if(is(typeof({size_t x = entry.d_namlen;}))){ // Optimization available on most posix platforms this.entryname = entry.d_name[0 .. entry.d_namlen].idup; }else{ this.entryname = entry.d_name.fromcstring; } } @property auto fileno() const{ return this.d_fileno; } @property bool isfile() const{ return this.d_type == DT_REG; } @property bool isdir() const{ return this.d_type == DT_DIR; } @property bool islink() const{ return this.d_type == DT_LNK; } @property string name() const{ return this.entryname; } @property Path path() const{ return Path(this.listpath ~ "/" ~ this.name); } @property bool isdots() const{ return this.entryname == "." || this.entryname == ".."; } } this(string path){ this.path = path; this.handle = opendir(path.tocstring!char); if(this.handle is null){ throw new FileListDirException(path, new ErrnoException); }else{ this.nextFront(); } } @property bool empty() const{ return this.current is null; } @property auto front() in{assert(!this.empty);} body{ return Entry(this.path, this.current); } void popFront() in{assert(!this.empty);} body{ this.nextFront(); } private void nextFront() in{assert(this.handle !is null);} body{ // According to readdir docs, setting errno and checking after the // readdir call is the only way to reliably distinguish between EOF // and an an error having occurred, when readdir returns null. errno = 0; this.current = readdir(this.handle); ErrnoException.check( "Failure listing directory \"" ~ this.path ~ "\"." ); if(this.current !is null){ if(this.skipdots && ( this.current.d_name[0 .. 2] == ".\0" || this.current.d_name[0 .. 3] == "..\0" )){ this.nextFront(); } }else{ closedir(this.handle); } } } } static enum TraverseDirMode{ DepthFirst, BreadthFirst } struct TraverseDirRange(TraverseDirMode mode = TraverseDirMode.DepthFirst){ import mach.collect : LinkedList; alias Mode = TraverseDirMode; /// The directory being traversed. string path; /// If set, the traversal will follow symbolic links. bool traverselinks = true; static if(mode is Mode.DepthFirst){ ListDirRange*[] dirstack; }else{ LinkedList!(ListDirRange*)* dirstack; } static struct Entry{ string traversepath; ListDirRange.Entry listentry; alias listentry this; } this(string path){ this.path = path; this.initdirstack(path); } /// Initialize the stack of directory list ranges. private void initdirstack(in string path){ static if(mode is Mode.BreadthFirst){ this.dirstack = new LinkedList!(ListDirRange*)(); } this.pushdir(path); } /// Append a new path to the stack of directories to list. private void pushdir(in string path){ auto dir = new ListDirRange(path); if(!dir.empty){ static if(mode is Mode.DepthFirst){ this.dirstack ~= dir; }else{ this.dirstack.append(dir); } } } /// Remove the current path from the directory list stack. /// When depth-first, this is the most recently pushed item. /// When breadth-first, this is the oldest pushed item. private void popdir() in{assert(!this.empty);} body{ static if(mode is Mode.DepthFirst){ this.dirstack.length -= 1; }else{ this.dirstack.removefront; } } /// Get the current directory being listed. /// When depth-first, this is the most recently pushed item. /// When breadth-first, this is the oldest pushed item. private auto currentdir() in{assert(!this.empty);} body{ static if(mode is Mode.DepthFirst){ return this.dirstack[$-1]; }else{ return this.dirstack.front; } } /// Get whether all entries in the directory have been traversed. @property bool empty() const{ static if(mode is Mode.DepthFirst){ return this.dirstack.length == 0; }else{ return this.dirstack.empty; } } /// Get the file path at the front of the range. @property auto front() in{assert(!this.empty);} body{ return Entry(this.path, this.currentdir.front); } /// Pop the front file path and continue traversal of the directory tree. void popFront() in{assert(!this.empty);} body{ auto addpath = ""; if(this.currentdir.front.isdir && ( this.traverselinks || !this.currentdir.front.islink )){ addpath = this.currentdir.front.path; } this.currentdir.popFront(); if(this.currentdir.empty) this.popdir(); if(addpath != "") this.pushdir(addpath); } } private version(unittest){ import mach.range : filter, asarray; enum string TestPath = Path(__FILE_FULL_PATH__).directory ~ "/traverse"; struct Entry{ string path; bool isdir = false; } } /// Directory listing unittest { auto expected = [ Entry(TestPath ~ "/dir", true), Entry(TestPath ~ "/a.txt"), Entry(TestPath ~ "/b.txt"), Entry(TestPath ~ "/c"), Entry(TestPath ~ "/readme.txt"), Entry(TestPath ~ "/unicodeツ.txt"), ]; auto files = listdir(TestPath).asarray; assert(files.length == expected.length); foreach(entry; expected){ auto file = files.filter!(f => f.path == entry.path).asarray; assert(file.length == 1); assert(file[0].isdir == entry.isdir); } } /// Directory traversal unittest { auto expected = [ Entry(TestPath ~ "/dir", true), Entry(TestPath ~ "/a.txt"), Entry(TestPath ~ "/b.txt"), Entry(TestPath ~ "/c"), Entry(TestPath ~ "/readme.txt"), Entry(TestPath ~ "/unicodeツ.txt"), Entry(TestPath ~ "/dir/d.txt"), Entry(TestPath ~ "/dir/nesteddir", true), Entry(TestPath ~ "/dir/nesteddir/deep.txt", true), Entry(TestPath ~ "/dir/nesteddir/deep.txt/deeper.txt", false), ]; void TestTraverse(TraverseDirMode mode)(){ auto files = traversedir!mode(TestPath).asarray; assert(files.length == expected.length); foreach(entry; expected){ auto file = files.filter!(f => f.path == entry.path).asarray; assert(file.length == 1); assert(file[0].isdir == entry.isdir); } } // Depth-first TestTraverse!(TraverseDirMode.DepthFirst)(); // Breadth-first TestTraverse!(TraverseDirMode.BreadthFirst)(); }
D
/* Copyright © 2020, Luna Nielsen Distributed under the 2-Clause BSD License, see LICENSE file. Authors: Luna Nielsen */ module game.boards.solitaire.tilegen; import game.boards.solitaire; import engine; import game; import game.tiles; import std.random; import std.conv; /** Generation mode */ enum GenMode { /** Randomly selects the next tile to be generated */ Random, /** Cycles over the tiles in the roster */ Cycles } /** Generates tiles for Solitaire Mahjong Generation rules: + Each tile has to be generated in pairs + Tiles have to follow the max amount in their set */ class TileGenerator { private: TileType currentType; int[TileType] generatedCount; int genIndex; void setNextType(GenMode mode) { TileType newType; bool valid = true; do { if (mode == GenMode.Random) { newType = cast(TileType)uniform(0, TileType.SuitsAndBonusCount-1); } else { newType = cast(TileType)((cast(int)currentType+1)%(TileType.SuitsAndBonusCount-1)); } if (newType !in generatedCount) break; int counter = 0; valid = true; // Get the max count use for the tile if (newType <= TileType.Dot9) counter = cast(int)TileTypeCount.Dots; else if (newType <= TileType.Bam9) counter = cast(int)TileTypeCount.Bams; else if (newType <= TileType.Crak9) counter = cast(int)TileTypeCount.Craks; else if (newType <= TileType.WhiteDragon) counter = cast(int)TileTypeCount.Dragons; else if (newType <= TileType.NorthWind) counter = cast(int)TileTypeCount.Winds; else if (newType <= TileType.Bamboo) counter = cast(int)TileTypeCount.Flowers; else if (newType <= TileType.Winter) counter = cast(int)TileTypeCount.Seasons; else valid = false; // If it's not a valid use set valid to false. if(generatedCount[newType] >= counter) valid = false; if (!valid) { AppLog.info("debug", "%s already exists too much", to!string(newType)); } } while (!valid); // Update the type currentType = newType; } public: /** Does nothing rn other than instantiate this object */ this() { } /** Gets the next tile type */ TileType getNext() { // Generate and find next pair if we're on an uneven generation step if (genIndex == 1) { TileType curType = currentType; generatedCount[currentType]++; setNextType(GenMode.Cycles); genIndex = 0; return curType; } // We're on an even step just get the next tile genIndex++; generatedCount[currentType]++; return currentType; } /** Clear the generator's internal state */ void clear() { generatedCount.clear(); } }
D
module ppl4.ParseState; import ppl4.all; final class ParseState { private: int pos; Token[] tokens; public: Module mod; this(Module mod, Token[] tokens) { this.mod = mod; this.tokens = tokens; } Token peek(int i = 0) { if(pos+i < 0) return NO_TOKEN; if(pos+i >= tokens.length) return NO_TOKEN; return tokens[pos+i]; } auto next(int n = 1) { foreach(i; 0..n) { move(); } return this; } TokenKind kind() { return peek().kind; } string text() { return peek().text; } int line() { return peek().line; } int column() { return peek().column; } bool isKind(TokenKind k) { return kind() == k; } bool isNotKind(TokenKind k) { return kind() != k; } bool isOneOf(TokenKind[] kinds...) { auto kk = kind(); foreach(k; kinds) { if(kk==k) return true; } return false; } bool isNotOneOf(TokenKind[] kinds...) { return !isOneOf(kinds); } bool isEOF() { return pos >= tokens.length; } bool isNewLine() { if(pos==0) return false; return line() > tokens[pos-1].line; } auto skip(TokenKind k) { if(kind() != k) { syntaxError(this); } return next(); } auto trySkip(TokenKind k) { if(kind() == k) next(); return this; } auto skip(string kw) { if(text() != kw) { syntaxError(this); } return next(); } void expectOneOf(TokenKind[] kinds...) { auto kk = kind(); foreach(k; kinds) { if(kk==k) return; } //throw new Error(""); syntaxError(this, "Expected one of %s".format(kinds)); } private: void move() { pos++; } /** * @return Tokens on the previous line */ Token[] getPrevLineTokens() { int prevLine = line() - 1; if(prevLine < 0) return null; auto offset = pos-1; int start = int.max, end=int.min; while(offset >= 0) { auto line = tokens[offset].line; if(line == prevLine) { start = minOf(start, offset); end = maxOf(end, offset); } else if(line < prevLine) break; offset--; } if(start!=int.max) { return tokens[start..end+1]; } return null; } }
D
instance PAL_202_Albrecht(Npc_Default) { name[0] = "Albrecht"; guild = GIL_PAL; id = 202; voice = 3; flags = 0; npcType = npctype_main; B_SetAttributesToChapter(self,5); fight_tactic = FAI_HUMAN_MASTER; EquipItem(self,ItMw_1h_Pal_Sword); B_CreateAmbientInv(self); B_SetNpcVisual(self,MALE,"Hum_Head_Fighter",Face_P_Tough_Rodriguez,BodyTex_P,ItAr_PAl_H); Mdl_SetModelFatness(self,1.5); Mdl_ApplyOverlayMds(self,"Humans_Militia.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,80); daily_routine = Rtn_Start_202; }; func void Rtn_Start_202() { TA_Read_Bookstand(8,0,23,0,"NW_CITY_ALBRECHT"); TA_Read_Bookstand(23,0,8,0,"NW_CITY_ALBRECHT"); };
D
/++ Initialization, termination, and registration of D libraries in Godot +/ module godot.d.register; import std.format; import std.meta, std.traits; import std.experimental.allocator, std.experimental.allocator.mallocator; import core.stdc.stdlib : malloc, free; import godot.d.meta; import godot.d.script; import godot.d.wrap; import godot.d.udas; import godot.d.reference; import godot.core, godot.c; import godot.gdnativelibrary; alias GodotInitOptions = const(godot_gdnative_init_options*); alias GodotTerminateOptions = const(godot_gdnative_terminate_options*); /++ Pass this enum to GodotNativeInit and GodotNativeTerminate to skip D runtime initialization/termination. +/ enum NoDRuntime; /++ This mixin will generate the GDNative C interface functions for this D library. Pass to it a name string for the library, followed by the GodotScript types to register, functions to call, and other options to configure Godot-D. The symbolPrefix must match the GDNativeLibrary's symbolPrefix in Godot. D runtime will be initialized and terminated, unless you pass $(D NoDRuntime). Functions taking GodotInitOptions or no arguments will be called at init. Functions taking GodotTerminateOptions will be called at termination. Example: --- import godot, godot.node; class TestClass : GodotScript!Node { } mixin GodotNativeLibrary!( "testlib", TestClass, (GodotInitOptions o){ print("Initialized"); }, (GodotTerminateOptions o){ print("Terminated"); } ); --- +/ mixin template GodotNativeLibrary(string symbolPrefix, Args...) { private static import godot.c; private static import godot.gdnativelibrary; private import godot.d.reference; private __gshared Ref!(godot.gdnativelibrary.GDNativeLibrary) _GODOT_library; private __gshared void* _GODOT_library_handle; /// HACK: empty main to force the compiler to add emulated TLS. version(Android) void main() { } pragma(mangle, symbolPrefix~"gdnative_init") export extern(C) static void godot_gdnative_init(godot.c.godot_gdnative_init_options* options) { import godot.c.api; import godot.d.reference; import std.meta, std.traits; import core.runtime : Runtime; static if(staticIndexOf!(NoDRuntime, Args) == -1) Runtime.initialize(); godot_gdnative_api_struct_init(options.api_struct); import core.exception : assertHandler; assertHandler = (options.in_editor) ? (&godotAssertHandlerEditorDebug) : (&godotAssertHandlerCrash); *cast(typeof(options.gd_native_library)*)&_GODOT_library = options.gd_native_library; _GODOT_library.reference(); foreach(Arg; Args) { static if(is(Arg)) { } // is type else static if( isCallable!Arg ) { static if( is(typeof(Arg())) ) Arg(); else static if( is(typeof(Arg(options))) ) Arg(options); } else static if(Arg == NoDRuntime) { } else { static assert(0, "Unrecognized argument <"~Arg.stringof~"> passed to GodotNativeLibrary"); } } } pragma(mangle, symbolPrefix~"nativescript_init") export extern(C) static void godot_nativescript_init(void* handle) { import std.meta, std.traits; import godot.d.register : register; _GODOT_library_handle = handle; foreach(Arg; Args) { static if(is(Arg)) // is type { static assert(is(Arg == class) && extendsGodotBaseClass!Arg, fullyQualifiedName!Arg ~ " is not a D class that extends a Godot class!"); register!Arg(_GODOT_library_handle, _GODOT_library); } else static if( isCallable!Arg ) { } else static if(Arg == NoDRuntime) { } else { static assert(0, "Unrecognized argument <"~Arg.stringof~"> passed to GodotNativeLibrary"); } } } pragma(mangle, symbolPrefix~"gdnative_terminate") export extern(C) static void godot_gdnative_terminate(godot.c.godot_gdnative_terminate_options* options) { import std.meta, std.traits; import godot.d.script : NativeScriptTemplate; foreach(Arg; Args) { static if(is(Arg)) // is type { NativeScriptTemplate!Arg.unref(); } else static if(isCallable!Arg) { static if(is(typeof(Arg(options)))) Arg(options); } else static if(Arg == NoDRuntime) { } else { static assert(0, "Unrecognized argument <"~Arg.stringof~"> passed to GodotNativeLibrary"); } } _GODOT_library.unref(); import core.runtime : Runtime; static if(staticIndexOf!(NoDRuntime, Args) == -1) Runtime.terminate(); } } private extern(C) godot_variant _GODOT_nop(godot_object o, void* methodData, void* userData, int numArgs, godot_variant** args) { godot_variant n; _godot_api.godot_variant_new_nil(&n); return n; } /++ Register a class and all its $(D @GodotMethod) member functions into Godot. +/ void register(T)(void* handle, GDNativeLibrary lib) if(is(T == class)) { import godot.c; import godot.object, godot.resource; import godot.d; static import godot.nativescript; static if(BaseClassesTuple!T.length == 2) // base class is GodotScript; use owner { alias Base = typeof(T.owner); alias baseName = Base._GODOT_internal_name; } else // base class is another D script { alias Base = BaseClassesTuple!T[0]; static if(hasUDA!(Base, Rename)) enum immutable(char*) baseName = TemplateArgsOf!( getUDAs!(Base, Rename)[0])[0]; else enum immutable(char*) baseName = fullyQualifiedName!Base; } static if(hasUDA!(T, Rename)) enum immutable(char*) name = TemplateArgsOf!( getUDAs!(T, Rename)[0])[0]; else enum immutable(char*) name = fullyQualifiedName!T; auto icf = godot_instance_create_func(&createFunc!T, null, null); auto idf = godot_instance_destroy_func(&destroyFunc!T, null, null); static if(hasUDA!(T, Tool)) _godot_nativescript_api.godot_nativescript_register_tool_class(handle, name, baseName, icf, idf); else _godot_nativescript_api.godot_nativescript_register_class(handle, name, baseName, icf, idf); if(GDNativeVersion.hasNativescript!(1, 1)) { _godot_nativescript_api.godot_nativescript_set_type_tag(handle, name, NativeScriptTag!T.tag); } else // register a no-op function that indicates this is a D class { godot_instance_method md; md.method = &_GODOT_nop; md.free_func = null; _godot_nativescript_api.godot_nativescript_register_method(handle, name, "_GDNATIVE_D_typeid", godot_method_attributes.init, md); } static foreach(mf; godotMethods!T) {{ godot_method_attributes ma; static if(is( getUDAs!(mf, Method)[0] )) ma.rpc_type = godot_method_rpc_mode .GODOT_METHOD_RPC_MODE_DISABLED; else { ma.rpc_type = cast(godot_method_rpc_mode)(getUDAs!(mf, Method)[0].rpcMode); } godot_instance_method md; static if(godotName!mf == "_ready" && onReadyFieldNames!T.length) { md.method = &OnReadyWrapper!T.callOnReady; } else md.method = &MethodWrapper!(T, mf).callMethod; md.free_func = null; char[godotName!mf.length+1] mfn = void; mfn[0..godotName!mf.length] = godotName!mf[]; mfn[$-1] = '\0'; _godot_nativescript_api.godot_nativescript_register_method(handle, name, mfn.ptr, ma, md); }} // OnReady when there is no _ready method static if(staticIndexOf!("_ready", staticMap!(godotName, godotMethods!T)) == -1 && onReadyFieldNames!T.length) { enum ma = godot_method_attributes.init; godot_instance_method md; md.method = &OnReadyWrapper!T.callOnReady; _godot_nativescript_api.godot_nativescript_register_method(handle, name, "_ready", ma, md); } static foreach(sName; godotSignals!T) {{ alias s = Alias!(mixin("T."~sName)); static assert(hasStaticMember!(T, sName), "Signal declaration "~fullyQualifiedName!s ~" must be static. Otherwise it would take up memory in every instance of "~T.stringof); godot_signal gs; (*cast(String*)&gs.name) = String(godotName!s); gs.num_args = Parameters!s.length; static if(Parameters!s.length) { godot_signal_argument[Parameters!s.length] args; gs.args = args.ptr; } foreach(pi, P; Parameters!s) { static assert(Variant.compatible!P, fullyQualifiedName!s~" parameter "~pi.text~" \"" ~ParameterIdentifierTuple!s[pi]~"\": type "~P.stringof~" is incompatible with Godot"); (*cast(String*)&args[pi].name) = (ParameterIdentifierTuple!s[pi].length) ? String(ParameterIdentifierTuple!s[pi]) : (String(P.stringof) ~ String("Arg") ~ Variant(pi).as!String); args[pi].type = Variant.variantTypeOf!P; args[pi].usage = cast(godot_property_usage_flags)Property.Usage.defaultUsage; } _godot_nativescript_api.godot_nativescript_register_signal(handle, name, &gs); }} enum bool matchName(string p, alias a) = (godotName!a == p); static foreach(pName; godotPropertyNames!T) {{ alias getterMatches = Filter!(ApplyLeft!(matchName, pName), godotPropertyGetters!T); static assert(getterMatches.length <= 1); /// TODO: error message alias setterMatches = Filter!(ApplyLeft!(matchName, pName), godotPropertySetters!T); static assert(setterMatches.length <= 1); godot_property_set_func sf; godot_property_get_func gf; godot_property_attributes attr; static if(getterMatches.length) alias P = NonRef!(ReturnType!(getterMatches[0])); else alias P = Parameters!(setterMatches[0])[0]; static assert(!is(P : Ref!U, U)); /// TODO: proper Ref handling enum Variant.Type vt = extractPropertyVariantType!(getterMatches, setterMatches); attr.type = cast(godot_int)vt; enum Property uda = extractPropertyUDA!(getterMatches, setterMatches); attr.rset_type = cast(godot_method_rpc_mode)uda.rpcMode; attr.hint = cast(godot_property_hint)uda.hint; static if(vt == Variant.Type.object && extends!(P, Resource)) { attr.hint |= godot_property_hint.GODOT_PROPERTY_HINT_RESOURCE_TYPE; } static if(uda.hintString.length) _godot_api.godot_string_parse_utf8( &attr.hint_string, uda.hintString.ptr); else { static if(vt == Variant.Type.object) { _godot_api.godot_string_parse_utf8(&attr.hint_string, GodotClass!P._GODOT_internal_name); } else _godot_api.godot_string_new(&attr.hint_string); } attr.usage = cast(godot_property_usage_flags)(uda.usage | Property.Usage.scriptVariable); Variant defval; enum gDef = getterMatches.length && hasUDA!(getterMatches[0], DefaultValue); enum sDef = getterMatches.length && hasUDA!(setterMatches[0], DefaultValue); static if(gDef || sDef) { static if(gDef) alias defExprSeq = TemplateArgsOf!(getUDAs!(getterMatches[0], DefaultValue)[0]); else alias defExprSeq = TemplateArgsOf!(getUDAs!(setterMatches[0], DefaultValue)[0]); defval = defExprSeq[0]; } else static if( is(typeof( { P p; } )) ) // use type's default value { static if(isFloatingPoint!P) { // Godot doesn't support NaNs. Initialize properties to 0.0 instead. defval = 0.0; } else defval = P.init; } else { /// FIXME: call default constructor function defval = null; } attr.default_value = defval._godot_variant; static if(getterMatches.length) { alias GetWrapper = MethodWrapper!(T, getterMatches[0]); gf.get_func = &GetWrapper.callPropertyGet; gf.free_func = null; } else { gf.get_func = &emptyGetter; } static if(setterMatches.length) { alias SetWrapper = MethodWrapper!(T, setterMatches[0]); sf.set_func = &SetWrapper.callPropertySet; sf.free_func = null; } else { sf.set_func = &emptySetter; } char[pName.length+1] pn = void; pn[0..pName.length] = pName[]; pn[$-1] = '\0'; _godot_nativescript_api.godot_nativescript_register_property(handle, name, pn.ptr, &attr, sf, gf); }} static foreach(pName; godotPropertyVariableNames!T) {{ import std.string; godot_property_set_func sf; godot_property_get_func gf; godot_property_attributes attr; alias P = typeof(mixin("T."~pName)); enum Variant.Type vt = Variant.variantTypeOf!P; attr.type = cast(godot_int)vt; alias udas = getUDAs!(mixin("T."~pName), Property); enum Property uda = is(udas[0]) ? Property.init : udas[0]; attr.rset_type = cast(godot_method_rpc_mode)uda.rpcMode; attr.hint = cast(godot_property_hint)uda.hint; static if(vt == Variant.Type.object && is(GodotClass!P : Resource)) { attr.hint |= godot_property_hint.GODOT_PROPERTY_HINT_RESOURCE_TYPE; } static if(uda.hintString.length) _godot_api.godot_string_parse_utf8( &attr.hint_string, uda.hintString.ptr); else { static if(vt == Variant.Type.object) { _godot_api.godot_string_parse_utf8(&attr.hint_string, GodotClass!P._GODOT_internal_name); } else _godot_api.godot_string_new(&attr.hint_string); } attr.usage = cast(godot_property_usage_flags)uda.usage | cast(godot_property_usage_flags)Property.Usage.scriptVariable; static if(hasUDA!(mixin("T."~pName), DefaultValue)) { alias defExprSeq = TemplateArgsOf!(getUDAs!(mixin("T."~pName), DefaultValue)[0]); Variant defval = defExprSeq[0]; } else static if( is(typeof( { P p; } )) ) { import std.math : isNaN; static if(isFloatingPoint!P && (mixin("T."~pName).init).isNaN) { // Godot doesn't support NaNs. Initialize properties to 0.0 instead. Variant defval = P(0.0); } else Variant defval = (mixin("T."~pName)).init; } else { /// FIXME: call default constructor function Variant defval = null; } attr.default_value = defval._godot_variant; alias Wrapper = VariableWrapper!(T, pName); { gf.method_data = null; gf.get_func = &Wrapper.callPropertyGet; gf.free_func = null; } { sf.method_data = null; sf.set_func = &Wrapper.callPropertySet; sf.free_func = null; } char[pName.length+1] pn = void; pn[0..pName.length] = pName[]; pn[$-1] = '\0'; _godot_nativescript_api.godot_nativescript_register_property(handle, name, pn.ptr, &attr, sf, gf); }} godot.d.script.NativeScriptTemplate!T = memnew!(godot.nativescript.NativeScript); godot.d.script.NativeScriptTemplate!T.setLibrary(lib); godot.d.script.NativeScriptTemplate!T.setClassName(String(name)); }
D
<?xml version="1.0" encoding="ASCII" standalone="no"?> <di:SashWindowsMngr xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmi:version="2.0"> <pageList> <availablePage> <emfPageIdentifier href="VAR_11_BeT-3885536161.notation#_copSALmGEeKQQp7P9cQvNQ"/> </availablePage> </pageList> <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> <windows> <children xsi:type="di:TabFolder"> <children> <emfPageIdentifier href="VAR_11_BeT-3885536161.notation#_copSALmGEeKQQp7P9cQvNQ"/> </children> </children> </windows> </sashModel> </di:SashWindowsMngr>
D
module ast.c_bind; // Optimized for GL.h and SDL.h; may not work for others!! import ast.base, ast.modules, ast.structure, ast.casting, ast.static_arrays, ast.externs, ast.tuples: AstTuple = Tuple; import tools.compat, tools.functional, alloc; alias asmfile.startsWith startsWith; string buf; string readStream(InputStream IS) { if (!buf) buf = new char[16384]; int reslen; ubyte[16384] buffer; int i; do { i = IS.read(buffer); if (i < 0) throw new Exception(Format("Read error: ", i)); while (buf.length < reslen + i) buf.length = cast(int) (buf.length * 2); buf[reslen .. reslen + i] = cast(string) buffer[0 .. i]; reslen += i; } while (i); auto res = buf[0 .. reslen]; buf = buf[reslen .. $]; return res; } // defines string readback(string) version(Windows) { import std.c.windows.windows; extern(System) { bool CreatePipe(HANDLE*, HANDLE*, SECURITY_ATTRIBUTES*, int size); bool SetHandleInformation(HANDLE, int mask, int flags); const HANDLE_FLAG_INHERIT = 0x01; struct PROCESS_INFORMATION { HANDLE hProcess, hThread; DWORD dwProcessId, dwThreadId; } struct STARTUPINFOA { DWORD cb; LPSTR lpReserved, lpDesktop, lpTitle; DWORD dwX, dwY, dwXSize, dwYSize, dwXCountChars, dwYCountChars, dwFillAttribute, dwFlags; WORD wShowWindow, cbReserved2; PBYTE lpReserved2; HANDLE hStdInput, hStdOutput, hStdError; } alias STARTUPINFOA STARTUPINFO; const STARTF_USESTDHANDLES = 256; const CREATE_NO_WINDOW = 0x08000000; BOOL CreateProcessA(LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, PVOID, LPCSTR, STARTUPINFOA*, PROCESS_INFORMATION*); } extern(C) int _open_osfhandle(HANDLE, int = 0); string readback(string cmd) { SECURITY_ATTRIBUTES attr; attr.nLength = SECURITY_ATTRIBUTES.sizeof; attr.bInheritHandle = true; attr.lpSecurityDescriptor = null; HANDLE[2] fd; if (!CreatePipe(&fd[0], &fd[1], &attr, 0)) fail("Couldn't create pipe"); if (!SetHandleInformation(fd[0], HANDLE_FLAG_INHERIT, 0)) fail("Couldn't set pipe to noinherit"); PROCESS_INFORMATION procinfo; STARTUPINFO startinfo; startinfo.cb = STARTUPINFO.sizeof; startinfo.hStdError = fd[1]; startinfo.hStdOutput = fd[1]; startinfo.hStdInput = cast(HANDLE) 0; startinfo.dwFlags |= STARTF_USESTDHANDLES; auto succ = CreateProcessA(null, toStringz(cmd), null, null, true, /* inherit handles */ CREATE_NO_WINDOW, null, null, &startinfo, &procinfo); if (!succ) fail(Format("Couldn't create process '", cmd, "'")); CloseHandle(fd[1]); CloseHandle(procinfo.hProcess); CloseHandle(procinfo.hThread); scope fs = new CFile(fdopen(_open_osfhandle(fd[0]), "r"), FileMode.In); return readStream(fs); } } else { extern(C) { int pipe(int*); int close(int); } string readback(string cmd) { // logln("> ", cmd); int[2] fd; // read end, write end if (-1 == pipe(fd.ptr)) throw new Exception(Format("Can't open pipe! ")); scope(exit) close(fd[0]); auto cmdstr = Format(cmd, " >&", fd[1], " &"); system(toStringz(cmdstr)); close(fd[1]); scope fs = new CFile(fdopen(fd[0], "r"), FileMode.In); return readStream(fs); } } import ast.aliasing, ast.pointer, ast.fun, ast.namespace, ast.int_literal, ast.fold, ast.opers; import tools.time; class LateType : IType { string name; IType me; void delegate() tryResolve; this(string n) { name = n; } string toString() { if (!me) return Format("(LateType (", name, "), unresolved)"); return Format("(LateType ", me, ")"); } void needMe() { if (!me) tryResolve(); if (!me) throw new Exception(Format("Couldn't resolve ", this)); me = resolveType(me); } override { int size() { needMe; return me.size; } ubyte[] initval() { needMe; return me.initval; } bool isPointerLess() { needMe; return me.isPointerLess(); } bool isComplete() { return !!me; } // TODO: ?? int opEquals(IType it) { auto lt = fastcast!(LateType) (it); if (lt && name == lt.name) return true; needMe; it = resolveType(it); return it is me || it == me; } string mangle() { needMe; return me.mangle(); } IType proxyType() { needMe; return me; } } } const c_tree_expr = "tree.expr" " >tree.expr.vardecl >tree.expr.type_stringof >tree.expr.type_mangleof" " >tree.expr.classid >tree.expr.iter >tree.expr.iter_range" " >tree.expr.new >tree.expr.eval >tree.expr.cast >tree.expr.veccon" " >tree.expr.cast_explicit_default >tree.expr.cast_convert" " >tree.expr.scoped >tree.expr.stringex >tree.expr.dynamic_class_cast" " >tree.expr.properties >tree.expr.veccon"; const c_tree_expr_matcher = matchrule_static(c_tree_expr); TLS!(Expr delegate(ref string)) specialCallback; static this() { New(specialCallback); } bool parsingCHeader() { auto ns = namespace(); while (ns) { auto mns = ns.get!(MiniNamespace); if (!mns) return false; if (mns.id == "parse_header") return true; ns = mns.sup; } return false; } void parseHeader(string filename, string src) { auto start_time = sec(); string[] newsrc_list; int newsrc_length; void addSrc(string text) { newsrc_list ~= text; newsrc_length += text.length; } bool inEnum; string[] buffer; void flushBuffer() { foreach (def; buffer) { addSrc(def); addSrc(";"); } buffer = null; } while (src.length) { string line = src.slice("\n"); // special handling for fenv.h; shuffle #defines past the enum if (line.startsWith("enum")) inEnum = true; if (line.startsWith("}")) { inEnum = false; addSrc(line); flushBuffer; continue; } if (line.startsWith("#define")) { if (inEnum) buffer ~= line; else { addSrc(line); addSrc(";"); } } if (line.startsWith("#")) continue; addSrc(line); addSrc(" "); } auto newsrc = new char[newsrc_length]; int i; foreach (text; newsrc_list) { newsrc[i .. i+text.length] = text; i += text.length; } delete newsrc_list; // no need to remove comments; the preprocessor already did that auto statements = newsrc.split(";") /map/ &strip; // mini parser Named[string] cache; auto myNS = new MiniNamespace("parse_header"); myNS.sup = namespace(); myNS.internalMode = true; namespace.set(myNS); scope(exit) namespace.set(myNS.sup); void add(string name, Named n) { if (myNS.lookup(name)) { return; } // duplicate definition. meh. auto ea = fastcast!(ExprAlias)~ n; if (ea) { if (!gotImplicitCast(ea.base, (IType it) { return !fastcast!(AstTuple) (it); })) { logln("Weird thing ", ea); fail; } } // logln("add ", name, " <- ", n); myNS._add(name, fastcast!(Object)~ n); if (auto ns = fastcast!(Namespace) (n)) ns.sup = null; // lol cache[name] = n; } void delegate()[] resolves; scope(success) foreach (dg; resolves) dg(); IType matchSimpleType(ref string text) { bool accept(string s) { auto t2 = text; while (s.length) { string part1, part2; if (!s.gotIdentifier(part1)) return false; if (!t2.gotIdentifier(part2)) return false; if (part1 != part2) return false; s = s.strip(); } text = t2; return true; } text = text.mystripl(); if (auto rest = text.startsWith("...")) { text = rest; return Single!(Variadic); } if (text.startsWith("(")) return null; // shortcut bool unsigned; if (accept("_Bool")) return Single!(Char); if (accept("unsigned")) unsigned = true; else accept("signed"); if (accept("long")) { if (accept("int")) return Single!(SysInt); if (accept("long")) { accept("int"); return Single!(Long); } return unsigned?Single!(SizeT):Single!(SysInt); } if (accept("int")) return Single!(SysInt); if (accept("short")) { accept("int"); return Single!(Short); } if (accept("char")) return Single!(Char); if (unsigned) return Single!(SysInt); if (accept("void")) return Single!(Void); if (accept("float")) return Single!(Float); if (accept("double")) return Single!(Double); if (accept("struct")) { string name; if (!text.gotIdentifier(name)) return Single!(Void); if (auto p = name in cache) return fastcast!(IType)~ *p; else { auto lt = new LateType(name); auto dg = stuple(lt, name, &cache) /apply/ delegate void(LateType lt, string name, typeof(cache)* cachep) { if (auto p = name in *cachep) { lt.me = fastcast!(IType)~ *p; if (auto al = fastcast!(TypeAlias) (lt.me)) if (al.base is lt) { logln("CIRCULAR TYPE: ", name); fail; } } else { // logln(name, " didn't resolve in time"); // fail; lt.me = Single!(Void); } }; lt.tryResolve = dg; resolves ~= dg; return lt; } } string id; if (!text.gotIdentifier(id)) return null; if (auto p = id in cache) return fastcast!(IType) (*p); if (auto ty = fastcast!(IType) (namespace().lookup(id, true))) { if (auto n = fastcast!(Named) (ty)) cache[id] = n; return ty; } return null; } IType matchType(ref string text) { text.accept("const"); text.accept("__const"); if (auto ty = matchSimpleType(text)) { while (text.accept("*")) { auto p = new Pointer(Single!(SysInt)); p.target = ty; // manually initialize to skip forcedConvert so we give late types more time to resolve ty = p; } return ty; } else return null; } IType matchParam(ref string text) { auto t2 = text; IType ty = matchType(t2); if (!ty) return null; text = t2; text.accept("__restrict"); text.accept("__const"); string id; gotIdentifier(text, id); if (auto sa = fastcast!(StaticArray)~ resolveType(ty)) { ty = new Pointer(sa.elemType); } redo:if (text.startsWith("[")) { ty = new Pointer(ty); text.slice("]"); goto redo; } text.accept(","); return ty; } Stuple!(string[], string)[string] macros; bool[char*] loopbreaker; // recursion loop avoidance, lol bool readCExpr(ref string source, ref Expr res) { source = mystripl(source); if (!source.length) return false; auto s2 = source; // fairly obvious what this is if (source.endsWith("_TYPE") || s2.matchType()) return false; int i; s2 = source; { IType ty; auto s3 = s2; if (s2.accept("(") && (ty = matchType(s2), ty) && s2.accept(")") && readCExpr(s2, res)) { IType alt; if (Single!(Char) == ty) alt = Single!(Byte); // same type in C res = foldex(forcedConvert(res)); // res = reinterpret_cast(ty, res); if (!gotImplicitCast(res, ty, (IType it) { return test(it == ty || alt && it == alt); })) return false; source = s2; return true; } s2 = s3; } if (s2.accept("'")) { // char if (!s2.length) return false; auto ch = s2[0..1]; s2 = s2[1 .. $]; if (!s2.accept("'")) return false; res = reinterpret_cast(Single!(Char), new DataExpr(cast(ubyte[]) ch)); source = s2; return true; } if (s2.gotInt(i)) { if (auto rest = s2.startsWith("U")) s2 = rest; // TODO if (s2.accept("LL")) return false; // long long s2.accept("L"); if (!s2.length /* special handling for separators */ || s2.startsWith(",") || s2.startsWith(")")) { res = new IntExpr(i); source = s2; return true; } } s2 = source; if (s2.startsWith("__PRI")) return false; // no chance to parse s2 = source; string ident; if (s2.gotIdentifier(ident) && !s2.length) { // float science notation constants if (ident.length > 2) { if (ident[0] == 'e' || ident[0] == 'E') if (ident[1] == '+' || ident[1] == '-') return false; if (ident[0] == '1' && (ident[1] == 'e' || ident[1] == 'E')) if (ident[2] == '+' || ident[2] == '-') return false; } if (auto p = ident in cache) { if (auto ex = fastcast!(Expr)~ *p) { res = ex; source = null; return true; } return false; } // logln("IDENT ", ident); } if (auto tup = ident in macros) { auto backup = s2; auto args = tup._0, str = tup._1; // logln("macro parse for ", ident, " on ", s2); if (!s2.accept("(")) return false; Object[] objs; while (true) { Expr ex; if (readCExpr(s2, ex)) objs ~= fastcast!(Object) (ex); else if (auto ty = matchType(s2)) objs ~= fastcast!(Object) (ty); else { // logln("macro arg fail ", s2); return false; } if (!s2.accept(",")) break; } if (!s2.accept(")")) { // logln("fail 2 on ", s2); return false; } if (objs.length != args.length) { // logln("length fail"); return false; } auto myNS2 = new MiniNamespace("parse_macro"); myNS2.sup = namespace(); myNS2.internalMode = true; namespace.set(myNS2); scope(exit) namespace.set(myNS2.sup); foreach (k, arg; objs) { // logln(args[k], " -> ", arg); myNS2._add(args[k], arg); } // pushCache; // scope(exit) popCache; scope(exit) str = str.dup; // faster because string is small if (!readCExpr(str, res)) { // logln("macro fail ", str); return false; } opt(res); // logln(ident, " -- ", backup, " (args ", tup._0, ", str ", tup._1, ") => ", objs, " => ", res); source = s2; return true; } s2 = source; if (s2.startsWith("__attribute__ ((")) s2 = s2.between("))", ""); // logln(" @ '", source, "'"); s2 = s2.mystripl(); if (!s2.length) return false; auto old_dg = *specialCallback(); Expr callback(ref string text) { auto tp = text.ptr; if (tp in loopbreaker) return null; loopbreaker[tp] = true; scope(exit) loopbreaker.remove(tp); Expr res; if (readCExpr(text, res)) return res; if (old_dg) if (auto res = old_dg(text)) return res; return null; } *specialCallback() = &callback; scope(exit) *specialCallback() = old_dg; try res = fastcast!(Expr) (parsecon.parse(s2, mixin(c_tree_expr_matcher))); catch (Exception ex) return false; // no biggie if (!res) return false; source = s2; return true; } while (statements.length) { auto stmt = statements.take(), start = stmt; stmt.accept("__extension__"); if (stmt.accept("#define")) { if (stmt.accept("__")) continue; // internal string id; Expr ex; if (!stmt.gotIdentifier(id)) goto giveUp; if (!stmt.strip().length) continue; // ignore this kind of #define. // logln("parse expr ", stmt, "; id '", id, "'"); auto backup = stmt; if (!gotIntExpr(stmt, ex) || stmt.strip().length) { stmt = backup; string[] macroArgs; bool isMacroParams(ref string s) { auto s2 = s; // NOT accept(): spacing matters! // it's only a macro if the () comes directly after the name! if (!s2.startsWith("(")) return false; s2 = s2[1..$]; while (true) { string id; if (!s2.gotIdentifier(id)) break; macroArgs ~= id; if (!s2.accept(",")) break; } if (!s2.accept(")")) return false; s = s2; return true; } if (isMacroParams(stmt)) { macros[id] = stuple(macroArgs, stmt); // logln("macro: ", id, " (", macroArgs, ") => ", stmt); continue; } // logln("full-parse ", stmt, " | ", start); // muahaha try { try { if (!readCExpr(stmt, ex) || stmt.strip().length) { goto alternative; } } catch (Exception ex) goto alternative; if (false) { alternative: if (!readCExpr(stmt, ex)) goto giveUp; } } catch (Exception ex) goto giveUp; // On Error Fuck You } auto ea = fastalloc!(ExprAlias)(ex, id); // logln("got ", ea); add(id, ea); continue; } bool isTypedef; if (stmt.accept("typedef")) isTypedef = true; if (stmt.accept("enum")) { auto entries = stmt.between("{", "}").split(","); Expr cur = mkInt(0); Named[] elems; foreach (entry; entries) { // logln("> ", entry); entry = entry.replace("(unsigned long)", ""); // hack string id; if (!gotIdentifier(entry, id)) { stmt = entry; goto giveUp; } if (entry.accept("=")) { Expr ex; if (!readCExpr(entry, ex) || entry.strip().length) { // logln("--", entry); goto giveUp; } cur = foldex(ex); } elems ~= new ExprAlias(cur, id); cur = foldex(lookupOp("+", cur, mkInt(1))); } // logln("Got from enum: ", elems); stmt = stmt.between("}", ""); string name; if (stmt.strip().length && (!gotIdentifier(stmt, name) || stmt.strip().length)) { // logln("fail on '", stmt, "'"); goto giveUp; } foreach (elem; elems) add(elem.getIdentifier(), elem); if (name) add(name, new TypeAlias(Single!(SysInt), name)); continue; } bool isUnion; { auto st2 = stmt; if (st2.accept("struct") || (st2.accept("union") && (isUnion = true, true))) { string ident; gotIdentifier(st2, ident); if (st2.accept("{")) { auto startstr = st2; auto st = new Structure(ident); // st.minAlign = 4; st.isUnion = isUnion; const debugStructs = false; while (true) { static if (debugStructs) logln(ident, ">", st2); if (st2.startsWith("#define")) goto skip; auto ty = matchType(st2); // logln("for ", ident, ", match type @", st2, " = ", ty); if (!ty) { if (isUnion) { static if (debugStructs) logln("WARN incomplete union: experimental code!"); goto skip; } else { static if (debugStructs) logln("type failed"); goto giveUp1; } } while (true) { auto pos = st2.find("sizeof"); if (pos == -1) break; auto block = st2[pos .. $].between("(", ")"); auto sty = matchType(block); if (!sty) { static if (debugStructs) logln("sizeof loop match failed"); goto giveUp1; } auto translated = Format(sty.size); st2 = st2[0 .. pos] ~ translated ~ st2[pos .. $].between(")", ""); // logln("st2 => ", st2); } while (true) { auto atpos = st2.find("__attribute__"); if (atpos == -1) break; st2 = st2[0..atpos] ~ st2[atpos .. $].between("))", ""); } string name3; auto st3 = st2; Expr size; st3 = st3.replace("(int)", ""); // hax if (gotIdentifier(st3, name3) && st3.accept("[") && readCExpr(st3, size) && st3.accept("]")) { redo: size = foldex(size); if (fastcast!(AstTuple)~ size.valueType()) { // unwrap "(foo)" logln("at ", st2.nextText(), ":"); logln("unwrap ", (cast(Object) size).classinfo.name, " ", size); size = (fastcast!(StructLiteral)~ (fastcast!(RCE)~ size).from) .exprs[$-1]; goto redo; } auto ie = fastcast!(IntExpr)~ size; // logln("size: ", size); if (!ie) { static if (debugStructs) logln("size ie cast failed"); goto giveUp1; } new RelMember(name3, new StaticArray(ty, ie.num), st); // logln("rest: ", st3); if (st3.strip().length) { static if (debugStructs) logln("left over ", st3, ", failed"); goto giveUp1; } goto skip; } // logln(">> ", st2); if (st2.find("(") != -1) { if (st2.accept("(") && st2.accept("*")) { string name; if (!gotIdentifier(st2, name)) { static if (debugStructs) logln("fail in fp ", st2); goto giveUp1; } ty = Single!(Pointer, Single!(Void)); st2 = name; } else { // alias to void for now. add(ident, new TypeAlias(Single!(Void), ident)); static if (debugStructs) logln("can't handle the ", st2, ". fail. "); goto giveUp1; // can't handle yet } } foreach (var; st2.split(",")) { if (Single!(Void) == ty) { static if (debugStructs) logln("void base type at ", startstr, ". fail. "); goto giveUp1; } new RelMember(var.strip(), ty, st); } skip: st2 = statements.take(); if (st2.accept("}")) break; } IType ty = st; while (st2.accept("*")) { ty = new Pointer(ty); } auto name = st2.strip(); if (!name.length) name = ident; if (!st.name.length) st.name = name; add(name, new TypeAlias(ty, name)); if (ident && ident != name) // neat doesn't have a separate struct namespace, so add it to regular one add(ident, new TypeAlias(ty, ident)); continue; giveUp1: static if (debugStructs) logln("give up on struct ", ident, " at ", st2); while (true) { // logln("stmt: ", st2, " in ", startstr); st2 = statements.take(); if (st2.accept("}")) { static if (debugStructs) logln("info ", st2); break; } } // logln(">>> ", st2); continue; } } } if (isTypedef) { auto target = matchType(stmt); string name; if (!target) goto giveUp; if (stmt.accept("{")) { while (true) { stmt = statements.take(); if (stmt.accept("}")) break; } } if (!gotIdentifier(stmt, name)) { auto st2 = stmt; if (!st2.accept("(") || !st2.accept("*") || !gotIdentifier(st2, name) || !st2.accept(")")) goto giveUp; // function pointer if (!st2.accept("(")) goto giveUp; Argument[] args; do { auto partype = matchType(st2); string parname; st2.gotIdentifier(parname); args ~= Argument(partype); } while (st2.accept(",")); if (!st2.accept(")")) goto giveUp; // logln("get function pointer named ", name, " (ret ", target, ") , params ", args, " @", st2); target = new FunctionPointer(target, args); stmt = st2; } string typename = name; if (matchSimpleType(typename) && !typename.strip().length) { // logln("Skip type ", name, " for duplicate. "); continue; } Expr size; redo2: auto st3 = stmt; if (st3.accept("[") && readCExpr(st3, size) && st3.accept("]")) { redo3: size = foldex(size); // unwrap "(bar)" again if (fastcast!(AstTuple)~ size.valueType()) { size = (fastcast!(StructLiteral)~ (fastcast!(RCE)~ size).from).exprs[$-1]; goto redo3; } if (!fastcast!(IntExpr) (size)) goto giveUp; target = new StaticArray(target, (fastcast!(IntExpr)~ size).num); stmt = st3; goto redo2; } if (stmt.accept("[")) goto giveUp; if (stmt.length) { auto st4 = stmt; if (st4.accept("__attribute__") && st4.accept("((") && st4.accept("__mode__") && st4.accept("(")) { if (Single!(SysInt) == resolveType(target)) { if (st4.accept("__QI__") && st4.accept(")") && st4.accept("))")) { stmt = st4; target = Single!(Byte); } else if (st4.accept("__HI__") && st4.accept(")") && st4.accept("))")) { stmt = st4; target = Single!(Short); } else if (st4.accept("__SI__") && st4.accept(")") && st4.accept("))")) { stmt = st4; // int already } else if (st4.accept("__DI__") && st4.accept(")") && st4.accept("))")) { stmt = st4; target = Single!(Long); } } } if (stmt.strip().length) { // logln("LEFTOVER: ", stmt); // logln("(target ", target, " = ", name, ")"); goto giveUp; } } if (auto proxy = fastcast!(LateType) (target)) if (proxy.name == name) target = Single!(Void); // would set up a loop .. produce _something_ auto ta = new TypeAlias(target, name); cache[name] = ta; continue; } bool useStdcall; void eatAttribute(ref string s) { retry: s = s.strip(); if (auto rest = s.startsWith("__attribute__")) { if (rest.between("((", "))") == "__stdcall__") useStdcall = true; s = rest.between(") ", ""); goto retry; } } stmt.accept("extern"); stmt.eatAttribute(); if (auto ret = stmt.matchType()) { stmt.eatAttribute(); string name; bool funptr_mode; if (!gotIdentifier(stmt, name)) { if (stmt.accept("*")) funptr_mode = true; // this is apparently valid syntax :o if (!stmt.accept("(") || !gotIdentifier(stmt, name) || !stmt.accept(")")) { goto giveUp; } } if (!stmt.accept("(")) { // weird, but, nope. // while (stmt.accept("[]")) ret = new Pointer(ret); if (stmt.accept("[]") && !stmt.length) { add(name, new ExprAlias(reinterpret_cast(new Pointer(ret), new RefExpr(new ExternCGlobVar(ret, name))), name)); continue; } if (!stmt.length) { add(name, new ExternCGlobVar(ret, name)); continue; } // logln("MEEP ", name, ", '", stmt, "'"); goto giveUp; } IType[] args; // logln(name, "@ ", stmt, ", get types"); while (true) { if (auto ty = matchParam(stmt)) args ~= ty; else break; } if (!stmt.accept(")")) goto giveUp; if (args.length == 1 && Single!(Void) == args[0]) args = null; // C is stupid. foreach (ref arg; args) if (Single!(Short) == resolveType(arg)) arg = Single!(SysInt); if (funptr_mode) { auto fptype = new FunctionPointer; fptype.ret = ret; fptype.args = args /map/ (IType it) { return Argument(it); }; fptype.stdcall = useStdcall; auto ec = new ExternCGlobVar(fptype, name); add(name, ec); } else { auto fun = new Function; fun.name = name; fun.extern_c = true; fun.type = new FunctionType; fun.type.ret = ret; fun.type.params = args /map/ (IType it) { return Argument(it); }; fun.type.stdcall = useStdcall; fun.sup = null; add(name, fun); } continue; } giveUp:; // logln("Gave up on |", stmt, "| ", start); } auto ns = myNS.sup; foreach (key, value; cache) { if (ns.lookup(key)) { // logln("Skip ", key, " as duplicate. "); continue; } // logln("Add ", value); ns.add(key, value); } // logSmart!(false)("# Got ", cache.length, " definitions from ", filename, " in ", sec() - start_time, "s. "); } void performCImport(string name) { // prevent injection attacks foreach (ch; name) if (!(ch in Range['a'..'z'].endIncl) &&!(ch in Range['A'..'Z'].endIncl) &&!(ch in Range['0' .. '9'].endIncl) &&("/_-.".find(ch) == -1) ) throw new Exception("Invalid character in "~name~": "~ch~"!"); // prevent snooping if (name.find("..") != -1) throw new Exception("Can't use .. in "~name~"!"); string filename; if (name.exists()) filename = name; else { foreach (path; include_path) { auto combined = path.sub(name); if (combined.exists()) { filename = combined; break; } } } if (!filename) throw new Exception(Format("Couldn't find ", name, "! Tried ", include_path)); string extra; if (!isARM) extra = "-m32"; string mygcc; version(Windows) mygcc = path_prefix~"gcc"; else mygcc = path_prefix~platform_prefix~"gcc"; auto cmdline = mygcc~" "~extra~" -Xpreprocessor -dD -E " ~ (include_path /map/ (string s) { return "-I"~s; } ).join(" ") ~ " " ~ filename; // logln("? ", cmdline); auto src = readback(cmdline); parseHeader(filename, src); } import ast.fold, ast.literal_string; Object gotCImport(ref string text, ParseCb cont, ParseCb rest) { if (!text.accept("c_include")) return null; Expr ex; if (!rest(text, "tree.expr", &ex)) text.failparse("Couldn't find c_import string expr"); if (!text.accept(";")) text.failparse("Missing trailing semicolon"); auto str = fastcast!(StringExpr)~ foldex(ex); if (!str) text.failparse(foldex(ex), " is not a string"); performCImport(str.str); return Single!(NoOp); } mixin DefaultParser!(gotCImport, "tree.toplevel.c_import"); import ast.fold, ast.literal_string; Object gotSpecialCallback(ref string text, ParseCb cont, ParseCb rest) { Expr ex; auto dg = *specialCallback(); if (!dg) return null; auto t2 = text; auto res = dg(t2); if (!res) return null; text = t2; return fastcast!(Object) (res); } mixin DefaultParser!(gotSpecialCallback, "tree.expr.special_callback", "999"); // not super important static this() { ast.modules.specialHandler = delegate Module(string name) { auto hdr = name.startsWith("c."); if (!hdr) return null; auto hfile = hdr.replace(".", "/") ~ ".h"; auto mod = new Module(name, hfile); mod.dontEmit = true; auto backup = namespace(); namespace.set(mod); scope(exit) namespace.set(backup); performCImport(hfile); return mod; }; }
D
/Users/triggullberg/Desktop/LpRocks/Build/Intermediates/LpRocks.build/Debug-iphonesimulator/LpRocks.build/Objects-normal/x86_64/NVActivityIndicatorAnimationBallRotate.o : /Users/triggullberg/Desktop/LpRocks/LpRocks/OnboardVC.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/MainVC.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/StartVC.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulseSync.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScalePulseOutRapid.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScale.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScale.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorViewable.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScaleMultiple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScaleRippleMultiple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallClipRotateMultiple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScaleRipple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorShape.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallRotateChase.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulseRise.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallGridPulse.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallClipRotatePulse.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulse.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorAnimationDelegate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/AppDelegate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallRotate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallClipRotate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallZigZag.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallTrianglePath.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBlank.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationPacman.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationSemiCircleSpin.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationSquareSpin.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationTriangleSkewSpin.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationCubeTransition.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineSpinFadeLoader.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallSpinFadeLoader.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorPresenter.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationAudioEqualizer.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallGridBeat.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallBeat.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallZigZagDeflect.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationOrbit.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScalePulseOut.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorView.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScaleParty.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/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/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/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/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-SDK/Leanplum.framework/Headers/Leanplum.h /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-UIEditor/LeanplumUIEditor.framework/Headers/LeanplumUIEditor.h /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-SDK/Leanplum.framework/Headers/LPInbox.h /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-SDK/Leanplum.framework/Modules/module.modulemap /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-UIEditor/LeanplumUIEditor.framework/Modules/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/AVFoundation.framework/Headers/AVFoundation.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/AdSupport.framework/Headers/AdSupport.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes /Users/triggullberg/Desktop/LpRocks/Build/Intermediates/LpRocks.build/Debug-iphonesimulator/LpRocks.build/Objects-normal/x86_64/NVActivityIndicatorAnimationBallRotate~partial.swiftmodule : /Users/triggullberg/Desktop/LpRocks/LpRocks/OnboardVC.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/MainVC.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/StartVC.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulseSync.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScalePulseOutRapid.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScale.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScale.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorViewable.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScaleMultiple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScaleRippleMultiple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallClipRotateMultiple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScaleRipple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorShape.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallRotateChase.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulseRise.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallGridPulse.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallClipRotatePulse.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulse.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorAnimationDelegate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/AppDelegate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallRotate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallClipRotate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallZigZag.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallTrianglePath.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBlank.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationPacman.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationSemiCircleSpin.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationSquareSpin.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationTriangleSkewSpin.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationCubeTransition.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineSpinFadeLoader.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallSpinFadeLoader.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorPresenter.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationAudioEqualizer.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallGridBeat.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallBeat.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallZigZagDeflect.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationOrbit.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScalePulseOut.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorView.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScaleParty.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/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/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/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/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-SDK/Leanplum.framework/Headers/Leanplum.h /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-UIEditor/LeanplumUIEditor.framework/Headers/LeanplumUIEditor.h /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-SDK/Leanplum.framework/Headers/LPInbox.h /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-SDK/Leanplum.framework/Modules/module.modulemap /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-UIEditor/LeanplumUIEditor.framework/Modules/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/AVFoundation.framework/Headers/AVFoundation.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/AdSupport.framework/Headers/AdSupport.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes /Users/triggullberg/Desktop/LpRocks/Build/Intermediates/LpRocks.build/Debug-iphonesimulator/LpRocks.build/Objects-normal/x86_64/NVActivityIndicatorAnimationBallRotate~partial.swiftdoc : /Users/triggullberg/Desktop/LpRocks/LpRocks/OnboardVC.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/MainVC.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/StartVC.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulseSync.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScalePulseOutRapid.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScale.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScale.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorViewable.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScaleMultiple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScaleRippleMultiple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallClipRotateMultiple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScaleRipple.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorShape.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallRotateChase.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulseRise.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallGridPulse.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallClipRotatePulse.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulse.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorAnimationDelegate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/AppDelegate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallRotate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallClipRotate.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallZigZag.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallTrianglePath.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBlank.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationPacman.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationSemiCircleSpin.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationSquareSpin.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationTriangleSkewSpin.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationCubeTransition.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineSpinFadeLoader.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallSpinFadeLoader.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorPresenter.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationAudioEqualizer.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallGridBeat.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallBeat.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallZigZagDeflect.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationOrbit.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScalePulseOut.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/NVActivityIndicatorView.swift /Users/triggullberg/Desktop/LpRocks/LpRocks/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScaleParty.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/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/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/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/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-SDK/Leanplum.framework/Headers/Leanplum.h /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-UIEditor/LeanplumUIEditor.framework/Headers/LeanplumUIEditor.h /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-SDK/Leanplum.framework/Headers/LPInbox.h /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-SDK/Leanplum.framework/Modules/module.modulemap /Users/triggullberg/Desktop/LpRocks/Pods/Leanplum-iOS-UIEditor/LeanplumUIEditor.framework/Modules/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/AVFoundation.framework/Headers/AVFoundation.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/AdSupport.framework/Headers/AdSupport.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes
D
/+ + Copyright (c) Charles Petzold, 1998. + Ported to the D Programming Language by Andrej Mitrovic, 2011. +/ module HexCalc; import core.runtime; import core.thread; import std.conv; import std.ascii; import std.math; import std.range; import std.string; import std.utf; auto toUTF16z(S)(S s) { return toUTFz!(const(wchar)*)(s); } pragma(lib, "gdi32.lib"); import win32.windef; import win32.winuser; import win32.wingdi; import win32.winbase; import win32.winnt; import resource; string appName = "HexCalc"; string description = "Hex Calculator"; enum ID_TIMER = 1; HINSTANCE hinst; const MAXDWORD = 0xffffffff; extern (Windows) int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow) { int result; void exceptionHandler(Throwable e) { throw e; } try { Runtime.initialize(&exceptionHandler); result = myWinMain(hInstance, hPrevInstance, lpCmdLine, iCmdShow); Runtime.terminate(&exceptionHandler); } catch (Throwable o) { MessageBox(null, o.toString().toUTF16z, "Error", MB_OK | MB_ICONEXCLAMATION); result = 0; } return result; } int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow) { hinst = hInstance; HWND hwnd; MSG msg; WNDCLASS wndclass; wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = &WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = DLGWINDOWEXTRA; // Note! wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = cast(HBRUSH)(COLOR_BTNFACE + 1); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = appName.toUTF16z; if (!RegisterClass (&wndclass)) { MessageBox(NULL, "This program requires Windows NT!", appName.toUTF16z, MB_ICONERROR); return 0; } hwnd = CreateDialog (hInstance, appName.toUTF16z, null, NULL); ShowWindow (hwnd, iCmdShow); while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg); DispatchMessage (&msg); } return msg.wParam; } void ShowNumber(HWND hwnd, UINT iNumber) { TCHAR[20] szBuffer; auto result = format("%x", iNumber); SetDlgItemText(hwnd, VK_ESCAPE, result.toUTF16z); } DWORD CalcIt(UINT iFirstNum, int iOperation, UINT iNum) { switch (iOperation) { case '=': return iNum; case '+': return iFirstNum + iNum; case '-': return iFirstNum - iNum; case '*': return iFirstNum * iNum; case '&': return iFirstNum & iNum; case '|': return iFirstNum | iNum; case '^': return iFirstNum ^ iNum; case '<': return iFirstNum << iNum; case '>': return iFirstNum >> iNum; case '/': return iNum ? iFirstNum / iNum : MAXDWORD; case '%': return iNum ? iFirstNum % iNum : MAXDWORD; default: return 0; } } extern (Windows) LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static BOOL bNewNumber = TRUE; static int iOperation = '='; static UINT iNumber, iFirstNum; HWND hButton; switch (message) { case WM_KEYDOWN: // left arrow --> backspace if (wParam != VK_LEFT) break; wParam = VK_BACK; goto case WM_CHAR; case WM_CHAR: if ((wParam = cast(WPARAM)CharUpper(cast(TCHAR *)wParam)) == VK_RETURN) wParam = '='; hButton = GetDlgItem(hwnd, wParam); if (hButton) { SendMessage(hButton, BM_SETSTATE, 1, 0); Thread.sleep( dur!"msecs"( 100 ) ); SendMessage(hButton, BM_SETSTATE, 0, 0); } else { MessageBeep(0); break; } goto case WM_COMMAND; case WM_COMMAND: SetFocus(hwnd); if (LOWORD(wParam) == VK_BACK) // backspace ShowNumber(hwnd, iNumber /= 16); else if (LOWORD(wParam) == VK_ESCAPE) // escape ShowNumber(hwnd, iNumber = 0); else if (isHexDigit(LOWORD(wParam))) // hex digit { if (bNewNumber) { iFirstNum = iNumber; iNumber = 0; } bNewNumber = FALSE; if (iNumber <= MAXDWORD >> 4) ShowNumber(hwnd, iNumber = 16 * iNumber + wParam - (isDigit(wParam) ? '0' : 'A' - 10)); else MessageBeep(0); } else // operation { if (!bNewNumber) ShowNumber(hwnd, iNumber = CalcIt(iFirstNum, iOperation, iNumber)); bNewNumber = TRUE; iOperation = LOWORD(wParam); } return 0; case WM_DESTROY: PostQuitMessage(0); return 0; default: } return DefWindowProc(hwnd, message, wParam, lParam); }
D
module spasm.rt.memory; import spasm.rt.allocator : WasmAllocator; import stdx.allocator.building_blocks.null_allocator; private __gshared SpasmGCAllocator gcAllocator; version (LDC) import ldc.attributes; import spasm.intrinsics; import spasm.rt.gc; enum wasmPageSize = 64 * 1024; @safe nothrow void alloc_init(uint heap_base) { version (WebAssembly) WasmAllocator.init(heap_base); } version (unittest) { struct Allocator { nothrow: void[] allocate(size_t n) { auto mem = new byte[n]; return mem; } bool deallocate(void[] b) { return true; } } __gshared Allocator unittestAllocator; __gshared Allocator* allocator = &unittestAllocator; } else { __gshared auto allocator = &gcAllocator; } @trusted template make(T) { import spasm.types; static if (is(T == Item[], Item)) { Item[] make(A)(A allocator, size_t size) nothrow { void[] raw = allocator.allocate(Item.sizeof * size); auto t = cast(Item*) raw.ptr; return t[0 .. size]; } } else static if (is(T == Item[size], Item, size_t size)) { Item[] make(A)(A allocator) { void[] raw = allocator.allocate(Item.sizeof * size); auto t = cast(Item*) raw.ptr; return t[0..size]; } } else { T* make(A, Args...)(A allocatorOld, auto ref Args args) nothrow { import spasm.rt.allocator : PoolAllocatorList; static __gshared allocator = PoolAllocatorList!(T)(); void[] raw = allocator.allocate(T.sizeof); auto t = cast(T*) raw.ptr; *t = T.init; static if (Args.length) { import core.lifetime: forward; *t = T(forward!args); } return t; } } } extern (C) void * memcpy(void * destination, const void * source, size_t num) { foreach(i; 0..num) { (cast(ubyte*)destination)[i] = (cast(ubyte*)source)[i]; } return destination; } extern (C) void * memset(void* ptr, int value, size_t num) { ubyte val = cast(ubyte)value; ubyte* p = cast(ubyte*)ptr; foreach(i;0..num) p[i] = val; return ptr; } extern(C) { int memcmp(void*a,void*b,size_t cnt) { foreach(i;0..cnt) { if ((cast(byte*)a)[i] < (cast(byte*)b)[i]) return -1; if ((cast(byte*)a)[i] > (cast(byte*)b)[i]) return 1; } return 0; } // per-element array init routines void _d_array_init_i16(ushort* a, size_t n, ushort v) { auto p = a; auto end = a+n; while (p !is end) *p++ = v; } void _d_array_init_i32(uint* a, size_t n, uint v) { auto p = a; auto end = a+n; while (p !is end) *p++ = v; } void _d_array_init_i64(ulong* a, size_t n, ulong v) { auto p = a; auto end = a+n; while (p !is end) *p++ = v; } void _d_array_init_float(float* a, size_t n, float v) { auto p = a; auto end = a+n; while (p !is end) *p++ = v; } void _d_array_init_double(double* a, size_t n, double v) { auto p = a; auto end = a+n; while (p !is end) *p++ = v; } void _d_array_init_real(real* a, size_t n, real v) { auto p = a; auto end = a+n; while (p !is end) *p++ = v; } void _d_array_init_cfloat(cfloat* a, size_t n, cfloat v) { auto p = a; auto end = a+n; while (p !is end) *p++ = v; } void _d_array_init_cdouble(cdouble* a, size_t n, cdouble v) { auto p = a; auto end = a+n; while (p !is end) *p++ = v; } void _d_array_init_creal(creal* a, size_t n, creal v) { auto p = a; auto end = a+n; while (p !is end) *p++ = v; } void _d_array_init_pointer(void** a, size_t n, void* v) { auto p = a; auto end = a+n; while (p !is end) *p++ = v; } void _d_array_init_mem(void* a, size_t na, void* v, size_t nv) { auto p = a; auto end = a + na*nv; while (p !is end) { version (LDC) { import ldc.intrinsics; llvm_memcpy(p,v,nv,0); } else memcpy(p,v,nv); p += nv; } } deprecated("since ldc 1.14.0") size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) { if (newelemsz == 1) { return len*elemsz; } else if ((len*elemsz) % newelemsz) { assert(0); } return (len*elemsz)/newelemsz; } @trusted nothrow size_t _d_arraycast_len(size_t len, size_t elemsz, size_t newelemsz) { const size = len * elemsz; const newlen = size / newelemsz; if (newlen * newelemsz != size) assert(0); return newlen; } // slice copy when assertions are enabled void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen, size_t elemsz) { if (dstlen != 0) assert(dst); if (dstlen != 0) assert(src); if (dstlen != srclen) assert(0); else if (dst+dstlen*elemsz <= src || src+srclen*elemsz <= dst) { version (LDC) { import ldc.intrinsics; llvm_memcpy!size_t(dst, src, dstlen * elemsz, 0); } else memcpy(dst, src, dstlen * elemsz); } else assert(0); } void _d_arraybounds(string file, int line) { } extern (C) export void* _d_allocmemory(size_t sz) { import spasm.rt.memory : WasmAllocator; return WasmAllocator.instance.allocate(sz).ptr; } }
D
instance PAL_6082_RITTER(Npc_Default) { name[0] = NAME_Ritter; guild = GIL_BDT; aivar[AIV_IgnoresFakeGuild] = TRUE; aivar[AIV_IgnoresArmor] = TRUE; id = 6082; voice = 4; flags = 0; npcType = NPCTYPE_PALMORA; aivar[AIV_DropDeadAndKill] = TRUE; B_SetAttributesToChapter(self,6); fight_tactic = FAI_HUMAN_MASTER; EquipItem(self,ItMw_1h_Pal_Sword_Etlu); EquipItem(self,ItRw_Crossbow_M_02); CreateInvItems(self,ItRw_Bolt,10); B_CreateAmbientInv(self); B_SetNpcVisual(self,MALE,"Hum_Head_Bald",Face_P_NormalBart_Nefarius,BodyTex_P,ItAr_PAL_M_NPC); Mdl_SetModelFatness(self,0); Mdl_ApplyOverlayMds(self,"Humans_Militia.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,80); daily_routine = rtn_start_6082; }; func void rtn_start_6082() { TA_Smalltalk(8,0,21,0,"INSEL_DORF_70"); TA_Sleep(21,0,8,0,"INSEL_BAUERNHAUS_171"); };
D
any of a class of composite plastics used to make car bodies and cases for computers and other appliances a bachelor's degree in arts and sciences the eleventh month of the civil year the muscles of the abdomen the blood group whose red cells carry both the A and B antigens
D
/home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/obj/x86_64-slc6-gcc49-opt/TrigSteeringEvent/obj/TrigPassBits.o /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/obj/x86_64-slc6-gcc49-opt/TrigSteeringEvent/obj/TrigPassBits.d : /cvmfs/atlas.cern.ch/repo/sw/ASG/AnalysisBase/2.3.45/TrigSteeringEvent/Root/TrigPassBits.cxx /cvmfs/atlas.cern.ch/repo/sw/ASG/AnalysisBase/2.3.45/TrigSteeringEvent/TrigSteeringEvent/TrigPassBits.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/xAODCore/CLASS_DEF.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/xAODCore/ClassID_traits.h /cvmfs/atlas.cern.ch/repo/sw/ASG/AnalysisBase/2.3.45/TrigSteeringEvent/TrigSteeringEvent/TrigPassBitsCollection.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/DataVector.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/exceptions.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainersInterfaces/AuxTypes.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/CxxUtils/unordered_set.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/CxxUtils/hashtable.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/remove_const.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_volatile.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/config.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/config/user.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/config/select_compiler_config.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/config/compiler/gcc.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/config/select_stdlib_config.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/config/stdlib/libstdcpp3.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/config/select_platform_config.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/config/platform/linux.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/config/posix_features.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/config/suffix.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/detail/workaround.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/cv_traits_impl.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/bool_trait_def.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/template_arity_spec.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/int.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/int_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/adl_barrier.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/adl.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/msvc.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/intel.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/gcc.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/workaround.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/nttp_decl.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/nttp.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/integral_wrapper.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/integral_c_tag.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/static_constant.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/static_cast.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/cat.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/config/config.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/template_arity_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessor/params.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/preprocessor.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/comma_if.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/punctuation/comma_if.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/control/if.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/control/iif.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/logical/bool.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/facilities/empty.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/punctuation/comma.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/repeat.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/repetition/repeat.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/debug/error.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/detail/auto_rec.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/tuple/eat.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/inc.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/arithmetic/inc.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/lambda.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/ttp.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/ctps.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/overload_resolution.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/integral_constant.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/bool.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/bool_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/integral_c.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/integral_c_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/lambda_support.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/bool_trait_undef.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/type_trait_def.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/type_trait_undef.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/CxxUtils/noreturn.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/OwnershipPolicy.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/IndexTrackingPolicy.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/AuxVectorBase.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/AuxVectorData.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainersInterfaces/IConstAuxStore.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainersInterfaces/AuxDataOption.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainersInterfaces/AuxDataOption.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/AuxDataTraits.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthLinks/DataLink.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthLinks/DataLinkBase.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthLinks/tools/selection_ns.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/RVersion.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/RootMetaSelection.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthLinks/DataLink.icc /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/TError.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/Rtypes.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/RtypesCore.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/RConfig.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/DllImport.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/Rtypeinfo.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/snprintf.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/strlcpy.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/TGenericClassInfo.h /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.12-x86_64-slc6-gcc49-opt/include/TSchemaHelper.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/xAODRootAccessInterfaces/TVirtualEvent.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/xAODRootAccessInterfaces/TVirtualEvent.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/xAODRootAccessInterfaces/TActiveEvent.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/CxxUtils/override.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/likely.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/assume.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/threading.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/threading.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/AuxVectorData.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/AuxTypeRegistry.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainersInterfaces/IAuxTypeVector.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainersInterfaces/IAuxTypeVectorFactory.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/AuxTypeVector.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainersInterfaces/IAuxSetOption.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/PackedContainer.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/PackedParameters.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/PackedParameters.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/PackedContainer.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/AuxTypeVector.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/AuxTypeVectorFactory.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/AuxTypeVectorFactory.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/AuxTypeRegistry.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainersInterfaces/IAuxStore.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/AuxElement.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainersInterfaces/IAuxElement.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/AuxElement.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/ATHCONTAINERS_ASSERT.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainersInterfaces/AuxStore_traits.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/AuxVectorBase.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/DVLNoBase.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/DVLInfo.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/ClassID.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/DVLInfo.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/DVLCast.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/DVLIterator.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/ElementProxy.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/ElementProxy.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/iterator/iterator_adaptor.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/static_assert.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/iterator.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/detail/iterator.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/iterator/iterator_categories.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/iterator/detail/config_def.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/eval_if.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/if.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/value_wknd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/integral.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/eti.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/na_spec.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/lambda_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/void_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/na.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/na_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/lambda_arity_param.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/arity.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/dtp.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessor/enum.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessor/def_params_tail.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/limits/arity.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/logical/and.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/logical/bitand.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/identity.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/facilities/identity.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/empty.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/arithmetic/add.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/arithmetic/dec.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/control/while.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/list/fold_left.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/list/detail/fold_left.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/control/expr_iif.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/list/adt.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/detail/is_binary.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/detail/check.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/logical/compl.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/list/fold_right.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/list/detail/fold_right.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/list/reverse.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/control/detail/while.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/tuple/elem.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/facilities/expand.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/facilities/overload.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/variadic/size.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/tuple/rem.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/tuple/detail/is_single_return.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/variadic/elem.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/arithmetic/sub.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/identity.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/placeholders.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/arg.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/arg_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/na_assert.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/assert.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/not.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/nested_type_wknd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/yes_no.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/arrays.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/gpu.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/pp_counter.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/arity_spec.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/arg_typedef.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/use_preprocessed.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/include_preprocessed.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/compiler.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/stringize.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/arg.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_convertible.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/intrinsics.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/config.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_same.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_reference.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_lvalue_reference.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_rvalue_reference.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/ice.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/yes_no_type.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/ice_or.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/ice_and.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/ice_not.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/ice_eq.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_array.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_arithmetic.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_integral.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_float.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_void.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_abstract.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/add_lvalue_reference.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/add_reference.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/add_rvalue_reference.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_function.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/false_result.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/is_function_ptr_helper.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/utility/declval.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/iterator/detail/config_undef.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/iterator/iterator_facade.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/iterator/interoperable.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/or.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/or.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/iterator/iterator_traits.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/iterator/detail/facade_iterator_category.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/and.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/and.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_const.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/detail/indirect_traits.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_pointer.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_member_pointer.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_member_function_pointer.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/remove_cv.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_class.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/remove_reference.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/remove_pointer.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/iterator/detail/enable_if.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/utility/addressof.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/core/addressof.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/add_const.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/add_pointer.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_pod.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_scalar.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_enum.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/always.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessor/default_params.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/apply.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/apply_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/apply_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/apply_wrap.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/has_apply.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/has_xxx.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/type_wrapper.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/has_xxx.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/msvc_typename.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/array/elem.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/array/data.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/array/size.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/repetition/enum_params.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/repetition/enum_trailing_params.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/has_apply.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/msvc_never_true.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/lambda.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/bind.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/bind_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/bind.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/bind_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/next.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/next_prior.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/common_name_wknd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/protect.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/bind.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/full_lambda.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/quote.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/void.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/has_type.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/config/bcc.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/quote.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/template_arity.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/aux_/preprocessed/gcc/apply.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/version.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/DVL_iter_swap.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/DVL_algorithms.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/DVL_algorithms.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/IsMostDerivedFlag.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/add_cv.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/add_volatile.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/aligned_storage.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/aligned_storage.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/alignment_of.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/size_t_trait_def.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/size_t.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/mpl/size_t_fwd.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/size_t_trait_undef.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/type_with_alignment.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/list/for_each_i.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/repetition/for.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/repetition/detail/for.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/tuple/to_list.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/tuple/size.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/list/transform.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/preprocessor/list/append.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/common_type.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/conditional.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/decay.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/remove_bounds.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/extent.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/floating_point_promotion.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/function_traits.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_new_operator.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_nothrow_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_trivial_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_nothrow_constructor.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_trivial_constructor.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_nothrow_copy.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_trivial_copy.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_nothrow_destructor.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_trivial_destructor.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_operator.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_bit_and.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/has_binary_operator.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_base_of.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_base_and_derived.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_fundamental.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_bit_and_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_bit_or.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_bit_or_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_bit_xor.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_bit_xor_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_complement.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/has_prefix_operator.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_dereference.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_divides.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_divides_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_equal_to.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_greater.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_greater_equal.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_left_shift.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_left_shift_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_less.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_less_equal.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_logical_and.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_logical_not.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_logical_or.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_minus.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_minus_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_modulus.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_modulus_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_multiplies.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_multiplies_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_negate.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_not_equal_to.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_plus.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_plus_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_post_decrement.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/detail/has_postfix_operator.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_post_increment.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_pre_decrement.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_pre_increment.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_right_shift.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_right_shift_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_unary_minus.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_unary_plus.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_trivial_move_assign.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_trivial_move_constructor.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/has_virtual_destructor.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_complex.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_compound.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_copy_constructible.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/noncopyable.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/core/noncopyable.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_copy_assignable.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_empty.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_floating_point.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_member_object_pointer.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_nothrow_move_assignable.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/utility/enable_if.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/core/enable_if.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_nothrow_move_constructible.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_object.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_polymorphic.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_signed.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_stateless.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_union.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_unsigned.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/is_virtual_base_of.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/make_unsigned.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/make_signed.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/rank.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/remove_extent.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/remove_all_extents.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/remove_volatile.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/integral_promotion.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/boost/type_traits/promote.hpp /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/ClassName.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/ClassName.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/error.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/DataVector.icc /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/AthContainers/tools/CompareAndPrint.h /home/shepj/xaod/ROOTAnalysisTutorial/RootCoreBin/include/xAODCore/BaseInfo.h
D
/* * Copyright (c) 2004-2008 Derelict Developers * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the names 'Derelict', 'DerelictODE', nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ module derelict.ode.common; private { version(Tango) { import tango.stdc.math; } else { import std.math; } } /* * ODE contribution by William DeVore, 2007 * distanthumans.info * ODE Version 0.8 */ /* * The ODE library could have been compiled with float or double defined for dReal. * The default is to use doubles. * Note: Something to consider is alignment between C and D. Gregor Richards * clued me in to the idea that C compilers may have aligned doubles differently * than the default D configuration. In light of this some structures need to * have the alignment explicity stated as done below to the dJointFeedback * structure. */ // floating point data type, vector, matrix and quaternion types version (DerelictODE_DoublePrecision) { alias double dReal; //pragma(msg, "Using Double Precision"); } else version (DerelictODE_SinglePrecision) { alias float dReal; } else { alias double dReal; } /* round an integer up to a multiple of 4, except that 0 and 1 are unmodified * (used to compute matrix leading dimensions) */ int dPAD(int a) { return (((a) > 1) ? ((((a)-1)|3)+1) : (a)); } /* these types are mainly just used in headers */ typedef dReal[4] dVector3; typedef dReal[4] dVector4; typedef dReal[4*3] dMatrix3; typedef dReal[4*4] dMatrix4; typedef dReal[8*6] dMatrix6; alias dVector4 dQuaternion; //============================================================================== // MACROS //============================================================================== /* scalar math functions */ dReal dRecip(dReal x) { return ((1.0/(x))); } /* reciprocal */ dReal dSqrt(dReal x) { return (sqrt(x)); } /* square root */ dReal dRecipSqrt(dReal x) { return ((1.0/sqrt(x))); } /* reciprocal square root */ dReal dSin(dReal x) { return (sin(x)); } /* sine */ dReal dCos(dReal x) { return (cos(x)); } /* cosine */ dReal dFabs(dReal x) { return (fabs(x)); } /* absolute value */ dReal dAtan2(dReal y, dReal x) { return (atan2(y,x)); } /* arc tangent with 2 args */ dReal dFMod(dReal a, dReal b) { version(Tango) { return modf(a,&b); } else { real c; return modf(a,c); } } dReal dIsNan(dReal x) { return (isnan(x)); } dReal dCopySign(dReal a, dReal b) { return (copysign(a,b)); } /* internal object types (all prefixed with `dx') */ private { struct dxWorld {} /* dynamics world */ struct dxSpace {} /* collision space */ struct dxBody {} /* rigid body (dynamics object) */ struct dxGeom {} /* geometry (collision object) */ struct dxJoint {} struct dxJointNode {} struct dxJointGroup {} } typedef dxWorld* dWorldID; typedef dxSpace* dSpaceID; typedef dxBody* dBodyID; typedef dxGeom* dGeomID; typedef dxJoint* dJointID; typedef dxJointGroup* dJointGroupID; /* error numbers */ enum { d_ERR_UNKNOWN = 0, /* unknown error */ d_ERR_IASSERT, /* internal assertion failed */ d_ERR_UASSERT, /* user assertion failed */ d_ERR_LCP /* user assertion failed */ } /* joint type numbers */ enum { dJointTypeNone = 0, /* or "unknown" */ dJointTypeBall, dJointTypeHinge, dJointTypeSlider, dJointTypeContact, dJointTypeUniversal, dJointTypeHinge2, dJointTypeFixed, dJointTypeNull, dJointTypeAMotor, dJointTypeLMotor, dJointTypePlane2D, dJointTypePR // added in 0.8 } /* standard joint parameter names. */ enum { /* parameters for limits and motors */ dParamLoStop = 0, dParamHiStop, dParamVel, dParamFMax, dParamFudgeFactor, dParamBounce, dParamCFM, dParamStopERP, dParamStopCFM, /* parameters for suspension */ dParamSuspensionERP, dParamSuspensionCFM, dParamLoStop2 = 0x100, dParamHiStop2, dParamVel2, dParamFMax2, dParamFudgeFactor2, dParamBounce2, dParamCFM2, dParamStopERP2, dParamStopCFM2, /* parameters for suspension */ dParamSuspensionERP2, dParamSuspensionCFM2, dParamLoStop3 = 0x200, dParamHiStop3, dParamVel3, dParamFMax3, dParamFudgeFactor3, dParamBounce3, dParamCFM3, dParamStopERP3, dParamStopCFM3, /* parameters for suspension */ dParamSuspensionERP3, dParamSuspensionCFM3, /* * add a multiple of this constant to the basic parameter numbers to get * the parameters for the second, third etc axes. */ dParamGroup = 0x100 } /* angular motor mode numbers */ enum { dAMotorUser = 0, dAMotorEuler = 1 } /* joint force feedback information */ version (DerelictODE_DoublePrecision) { align(4): } struct dJointFeedback { dVector3 f1; /* force applied to body 1 */ dVector3 t1; /* torque applied to body 1 */ dVector3 f2; /* force applied to body 2 */ dVector3 t2; /* torque applied to body 2 */ }
D
INSTANCE Xeres_03 (Npc_Default) { //----- Monster ---- name = "Xeres"; guild = GIL_STRF; id = 1608; voice = 0; level = 10000; npctype = NPCTYPE_MAIN; flags = 0; //----- Attribute ---- attribute [ATR_STRENGTH] = 250; //+ 105 Waffe attribute [ATR_DEXTERITY] = 100; attribute [ATR_HITPOINTS_MAX] = 5000; attribute [ATR_HITPOINTS] = 5000; attribute [ATR_MANA_MAX] = 200; attribute [ATR_MANA] = 200; //----- Protection ---- protection [PROT_BLUNT] = 0; //hat RS! protection [PROT_EDGE] = 0; protection [PROT_POINT] = 0; protection [PROT_FIRE] = 0; protection [PROT_FLY] = 0; protection [PROT_MAGIC] = 0; //so lassen! //----- Damage Types ---- damagetype = DAM_EDGE; // damage [DAM_INDEX_BLUNT] = 0; // damage [DAM_INDEX_EDGE] = 0; // damage [DAM_INDEX_POINT] = 0; // damage [DAM_INDEX_FIRE] = 0; // damage [DAM_INDEX_FLY] = 0; // damage [DAM_INDEX_MAGIC] = 0; //----- Kampf-Taktik ---- fight_tactic = FAI_HUMAN_MASTER; EquipItem (self,Xeres_Schwert); Mdl_SetVisual (self, "HumanS.mds"); //Mdl_ApplyOverlayMds (self, "humans_skeleton.mds"); //FIXME s.Skeleton. // Body-Mesh Body-Tex Skin-Color Head-MMS Head-Tex Teeth-Tex ARMOR B_SetNpcVisual (self, MALE, "Hum_Head_Bald", 179, 0, ITAR_Xeres); daily_routine = Rtn_Start_1608; }; FUNC VOID Rtn_Start_1608() { TA_Stand_ArmsCrossed (08,00,20,00,"ARENA_01"); TA_Stand_ArmsCrossed (20,00,08,00,"ARENA_01"); };
D
module texts; import ask.locale; /// static immutable AlexaText_de = mixin(LocaParser!(TextId, import("lang_de.csv"))); /// static immutable AlexaText_en = mixin(LocaParser!(TextId, import("lang_en.csv"))); /// enum TextId { PleaseLogin, PleaseLoginSSML, DefaultCardTitle, HelloCardContent, HelloSSML, ChannelsCardTitle, ChannelsSSML, AboutCardTitle, AboutCardContent, AboutSSML, MoviesCardTitle, MoviesSSML, MuteCardTitle, MutedSSML, MuteFailedSSML, UnMutedSSML, StandbyCardTitle, StandbyFailedSSML, StandbySSML, BoxStartedSSML, SetVolumeCardTitle, SetVolumeFailedSSML, SetVolumeSSML, RecordNowCardTitle, RecordNowFailedSSML, RecordNowSSML, ZapToCardTitle, ZapUpCardTitle, ZapDownCardTitle, ZapRandomCardTitle, ZapToEventCardTitle, ZapToEventFailedSSML, ZapToEventNotFoundSSML, ZapFailedSSML, ZapSSML, ZapUp, ZapDown, ZapToRandom, SleepTimerCardTitle, SleepTimerOffSSML, SleepTimerResetSSML, SleepTimerSetSSML, SleepTimerFailedSSML, SleepTimerNoTimerSSML, CurrentCardTitle, CurrentSSML, CurrentNextSSML, RCPlayPauseCardTitle, RCOKSSML, RCFailedSSML, RCStopCardTitle, NotSupportedSSML, RCPreviousCardTitle, ErrorCardTitle, ErrorCardContent, ErrorSSML, SetVolumeRangeErrorSSML, HelpCardTitle, HelpCardContent, HelpSSML, And, InStandbyCardTitle, InStandbyCardContent, InStandbySSML }
D
/home/zbf/workspace/git/RTAP/target/debug/deps/semver_parser-0de4503b66472cac.rmeta: /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/lib.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/version.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/range.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/common.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/recognize.rs /home/zbf/workspace/git/RTAP/target/debug/deps/libsemver_parser-0de4503b66472cac.rlib: /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/lib.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/version.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/range.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/common.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/recognize.rs /home/zbf/workspace/git/RTAP/target/debug/deps/semver_parser-0de4503b66472cac.d: /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/lib.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/version.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/range.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/common.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/recognize.rs /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/lib.rs: /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/version.rs: /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/range.rs: /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/common.rs: /home/zbf/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/semver-parser-0.7.0/src/recognize.rs:
D
<?xml version="1.0" encoding="ASCII" standalone="no"?> <di:SashWindowsMngr xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmi:version="2.0"> <pageList> <availablePage> <emfPageIdentifier href="VAR_4_MobileMedia-1137961552.notation#_copSALmGEeKQQp7P9cQvNQ"/> </availablePage> </pageList> <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> <windows> <children xsi:type="di:TabFolder"> <children> <emfPageIdentifier href="VAR_4_MobileMedia-1137961552.notation#_copSALmGEeKQQp7P9cQvNQ"/> </children> </children> </windows> </sashModel> </di:SashWindowsMngr>
D
module common.util.config.pair; public { import common.util.config.pair.base; import common.util.config.pair.container; import common.util.config.pair.string; }
D
module dlint.app; import core.stdc.stdio; import std.algorithm.searching : startsWith; import std.typecons : Tuple; import dmd.astcodegen; import dmd.dmodule : Module; import dmd.frontend; import dmd.globals; import dlint.checks.undocumented; Tuple!(Module, "module_", Diagnostics, "diagnostics") parseModule(AST = ASTCodegen)( const(char)[] fileName) { import dmd.root.file : File, FileBuffer; import dmd.globals : Loc, global; import dmd.parse : Parser; import dmd.identifier : Identifier; import dmd.tokens : TOK; import std.path : baseName, stripExtension; import std.string : toStringz; import std.typecons : tuple; auto id = Identifier.idPool(fileName.baseName.stripExtension); auto m = new Module(fileName, id, 1, 0); m.read(Loc.initial); m.parseModule!AST(); Diagnostics diagnostics = { errors: global.errors, warnings: global.warnings }; return typeof(return)(m, diagnostics); } void main(string[] args) { initDMD; global.params.showColumns = true; import std.algorithm : each; findImportPaths.each!addImport; import std.file; Module[] modules; foreach (arg; args[1..$]) { if (arg.startsWith("-")) { switch (arg) { case "-unittest": case "-d": case "-dw": case "-de": break; // ignore default: if (arg.startsWith("-I")) addImport(arg[2 .. $]); else throw new Exception("Unknown switch: " ~ arg); } continue; } debug(dlint) printf("# Loading %.*s\n", cast(int)arg.length, arg.ptr); auto t = parseModule(arg); assert(!t.diagnostics.hasErrors); assert(!t.diagnostics.hasWarnings); modules ~= t.module_; } auto linter = new UndocumentedLinter; foreach (m; modules) { debug(dlint) printf("# Processing %s\n", m.srcfile.toChars()); m.fullSemantic; m.accept(linter); } }
D
/** * TypeInfo support code. * * Copyright: Copyright Digital Mars 2004 - 2009. * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). * Authors: Walter Bright */ /* Copyright Digital Mars 2004 - 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 rt.typeinfo.ti_dchar; // dchar class TypeInfo_w : TypeInfo { @trusted: const: pure: nothrow: override string toString() const pure nothrow @safe { return "dchar"; } override size_t getHash(in void* p) { return *cast(dchar *)p; } override bool equals(in void* p1, in void* p2) { return *cast(dchar *)p1 == *cast(dchar *)p2; } override int compare(in void* p1, in void* p2) { return *cast(dchar *)p1 - *cast(dchar *)p2; } override @property size_t tsize() nothrow pure { return dchar.sizeof; } override void swap(void *p1, void *p2) { dchar t; t = *cast(dchar *)p1; *cast(dchar *)p1 = *cast(dchar *)p2; *cast(dchar *)p2 = t; } override const(void)[] init() nothrow pure { static immutable dchar c; return (cast(dchar *)&c)[0 .. 1]; } }
D
module core.dto.hand_put; import std.concurrency; import std.format; public import core.dto.common; import core.gs; import qs.server; struct HandPutReq { bool side; int indexInHand; Position to; } struct HandPutResp {} HandPutResp handPut(Tid from, ServerInterface server, HandPutReq req) { Quantum q = server.getInHand(req.side, req.indexInHand); if (q is null) throw new Exception(format("No piece in hand at %d", req.indexInHand)); server.aHandPut( req.side, q, req.to.toPos()); return HandPutResp(); }
D
module android.java.java.util.Map_Entry_d_interface; import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers; static import arsd.jni; import import1 = android.java.java.lang.Class_d_interface; import import0 = android.java.java.util.Comparator_d_interface; @JavaName("Map$Entry") final class Map_Entry : IJavaObject { static immutable string[] _d_canCastTo = [ ]; @Import IJavaObject getKey(); @Import IJavaObject getValue(); @Import IJavaObject setValue(IJavaObject); @Import bool equals(IJavaObject); @Import int hashCode(); @Import static import0.Comparator comparingByKey(); @Import static import0.Comparator comparingByValue(); @Import static import0.Comparator comparingByKey(import0.Comparator); @Import static import0.Comparator comparingByValue(import0.Comparator); @Import import1.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 = "Ljava/util/Map$Entry;"; }
D
module glued.adhesives.config; import std.algorithm; public import glued.pathtree; import glued.logging; import glued.adhesives.bundles; import optional; import properd; //todo no tests at all struct ConfigEntry { string text; Asset source; } //todo Environment seems more natural //todo would this gain anything from making previous value versions visible or reachable? class Config { //todo CreateLogger -> DefineLogger; CreateLogger(name) = DefineLogger + Logger <name> mixin CreateLogger; Logger log; this(LogSink sink){ log = Logger(sink); } private PathTree!ConfigEntry backend = new ConcretePathTree!ConfigEntry(); void feed(Asset asset){ log.debug_.emit("Feeding config from ", asset); auto aa = parseProperties(asset.content); foreach(k; aa.keys()){ backend.put(k, ConfigEntry(aa[k], asset)); } } //todo introduce interface ViewClosure(Result), normalize all closures, e.g. ValuesClosure: ViewClosure!string? @property PathTreeView!ConfigEntry view(){ return backend; } struct ValuesClosure { private Config config; string get(string path){ return find(path).front(); } Optional!string find(string path){ return config.backend.get(path).map!(x => x.text).toOptional; } Optional!string resolve(string path){ return config.backend.resolve(path).map!(x => x.text).toOptional; } } @property ValuesClosure values(){ return ValuesClosure(); } struct SourcesClosure { private Config config; Asset get(string path){ return find(path).front(); } Optional!Asset find(string path){ return config.backend.get(path).map!(x => x.source).toOptional; } Optional!Asset resolve(string path){ return config.backend.resolve(path).map!(x => x.source).toOptional; } } @property SourcesClosure sources(){ return SourcesClosure(); } struct EntriesClosure { private Config config; ConfigEntry get(string path){ return find(path).front(); } Optional!ConfigEntry find(string path){ return config.backend.get(path); } Optional!ConfigEntry resolve(string path){ return config.backend.resolve(path); } } @property EntriesClosure entries(){ return EntriesClosure(); } }
D
/*============================================================================= spiritd - Copyright (c) 2009 s.d.hammett a D2 parser library ported from boost::spirit 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 spiritd.parse; import spiritd.impl.types; version(D_Version2) { public import spiritd.ver.parsev2; } else { public import spiritd.ver.parsev1; } struct parseInfo(iteratorT) { intptr_t length() { return _length; } intptr_t _length; ///< number of input characters iteratorT _end; ///< iterator to character after last consumed }
D
module mci.debugger.cli; import std.array, std.conv, std.socket, std.stdio, mci.debugger.client, mci.debugger.protocol; /** * Represents the exit status of a command line debugger session. */ public enum DebuggerExitCode : ubyte { success = 0, /// Execution finished successfully. failure = 1, /// An error occurred. } public final class CommandLineDebugger { private SignalDebuggerClient _client; private ulong _threadID; private ulong _frameID; private void connected(Socket socket) in { assert(socket); } body { writefln("Connected to debugger server at: %s", socket.remoteAddress()); } private void disconnected(Socket socket) in { assert(socket); } body { writefln("Disconnected from debugger server at: %s", socket.remoteAddress()); } private void received(Socket socket, Packet packet) in { assert(socket); assert(packet); } body { } public DebuggerExitCode run() { bool stop; while (true) { write("(dbg) "); auto line = readln(); auto words = split(line); if (!words) continue; auto cmd = words[0]; auto args = words[1 .. $]; switch (cmd) { case "c": case "connect": if (args.length != 2) { writeln("No address/port given."); break; } ushort port; try port = to!ushort(args[1]); catch (ConvException) { writefln("Invalid port: '%s'", args[1]); break; } Address addr; try addr = parseAddress(args[0], port); catch (SocketException) { // Handled below. } if (!addr || (addr.addressFamily != AddressFamily.INET && addr.addressFamily != AddressFamily.INET6)) { writefln("Invalid IPv4/IPv6 address: '%s'", args[0]); break; } _client = new SignalDebuggerClient(addr); _client.connected.connect(&connected); _client.disconnected.connect(&disconnected); _client.received.connect(&received); _client.start(); break; case "d": case "disconnect": if (!_client) { writeln("No active connection."); break; } _client.stop(); _client = null; break; case "i": case "info": case "query": _client.send(new ClientQueryPacket()); break; case "s": case "start": _client.send(new ClientStartPacket()); break; case "p": case "pause": _client.send(new ClientPausePacket()); break; case "cont": case "continue": _client.send(new ClientContinuePacket()); break; case "e": case "exit": _client.send(new ClientExitPacket()); break; case "threads": auto pkt = new ClientThreadPacket(); pkt.action = ThreadAction.list; _client.send(pkt); break; case "t": case "thread": if (!args.length) { writefln("Current thread ID: %s", _threadID); break; } else if (args.length == 1) { ulong id; try id = to!ulong(args[0]); catch (ConvException) { writefln("Invalid thread ID: '%s'", args[0]); break; } auto pkt = new ClientThreadPacket(); pkt.action = ThreadAction.switch_; pkt.thread = id; _client.send(pkt); } else writeln("Invalid arguments."); break; case "f": case "frame": if (!args.length) { writefln("Current frame ID: %s", _frameID); break; } else if (args.length == 1) { ulong id; try id = to!ulong(args[0]); catch (ConvException) { writefln("Invalid frame ID: '%s'", args[0]); break; } auto pkt = new ClientFramePacket(); pkt.frame = id; _client.send(pkt); } else writeln("Invalid arguments."); break; case "q": case "quit": stop = true; break; default: writefln("Unknown command: '%s'", cmd); break; } if (stop) { if (_client) _client.stop(); break; } } return DebuggerExitCode.success; } }
D
module hunt.quartz.spi.TriggerFiredResult; import hunt.quartz.spi.TriggerFiredBundle; import std.exception; /** * @author lorban */ class TriggerFiredResult { private TriggerFiredBundle triggerFiredBundle; private Exception exception; this(TriggerFiredBundle triggerFiredBundle) { this.triggerFiredBundle = triggerFiredBundle; } this(Exception exception) { this.exception = exception; } TriggerFiredBundle getTriggerFiredBundle() { return triggerFiredBundle; } Exception getException() { return exception; } }
D
/* Copyright (c) 2018 Timur Gafarov Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ module dlib.image.canvas; import std.math; import dlib.math.vector; import dlib.math.matrix; import dlib.math.transformation; import dlib.math.utils; import dlib.geometry.bezier; import dlib.container.array; import dlib.image.color; import dlib.image.image; import dlib.image.render.shapes; import dlib.core.memory; struct CanvasState { Matrix3x3f transformation; Color4f lineColor; Color4f fillColor; float lineWidth; } enum SegmentType { Line, BezierCubic } struct ContourSegment { Vector2f p1; Vector2f p2; Vector2f p3; Vector2f p4; float radius; SegmentType type; } /* * A simple 2D vector engine inspired by HTML5 canvas. * Supports rendering arbitrary polygons and cubic Bezier paths, filled and outlined. * Not real-time, best suited for offline graph plotting. */ class Canvas { protected: SuperImage _image; SuperImage tmpBuffer; // TODO: state stack CanvasState state; DynamicArray!ContourSegment contour; Vector2f penPosition; float tesselationStep = 1.0f / 40.0f; uint subpixelResolution = 4; public: this(SuperImage img) { _image = img; tmpBuffer = image.createSameFormat(_image.width, _image.height); state.transformation = Matrix3x3f.identity; state.lineColor = Color4f(0.0f, 0.0f, 0.0f, 1.0f); state.fillColor = Color4f(0.0f, 0.0f, 0.0f, 1.0f); state.lineWidth = 1.0f; penPosition = Vector2f(0.0f, 0.0f); } ~this() { contour.free(); tmpBuffer.free(); } public: SuperImage image() @property { return _image; } void fillColor(Color4f c) @property { state.fillColor = c; } Color4f fillColor() @property { return state.fillColor; } void lineColor(Color4f c) @property { state.lineColor = c; } Color4f lineColor() @property { return state.lineColor; } void lineWidth(float w) @property { state.lineWidth = w; } float lineWidth() @property { return state.lineWidth; } void resetTransform() { state.transformation = Matrix3x3f.identity; } void transform(Matrix3x3f m) { state.transformation *= m; } void translate(float x, float y) { state.transformation *= translationMatrix2D(Vector2f(x, y)); } void rotate(float a) { state.transformation *= rotationMatrix2D(a); } void scale(float x, float y) { state.transformation *= scaleMatrix2D(Vector2f(x, y)); } void clear(Color4f c) { dlib.image.render.shapes.fillColor(_image, c); } void beginPath() { penPosition = Vector2f(0.0f, 0.0f); } void endPath() { contour.free(); } void pathMoveTo(float x, float y) { penPosition = Vector2f(x, y); } void pathLineTo(float x, float y) { Vector2f p1 = penPosition; Vector2f p2 = Vector2f(x, y); pathAddLine(p1, p2); penPosition = p2; } void pathBezierTo(Vector2f cp1, Vector2f cp2, Vector2f endPoint) { pathAddBezierCubic(penPosition, cp1, cp2, endPoint); penPosition = endPoint; } void pathStroke() { dlib.image.render.shapes.fillColor(tmpBuffer, Color4f(0, 0, 0, 0)); drawContour(); blitTmpBuffer(state.lineColor); } void pathFill() { fillShape(); } protected: void pathAddLine(Vector2f p1, Vector2f p2) { ContourSegment segment; segment.p1 = p1; segment.p2 = p2; segment.type = SegmentType.Line; contour.append(segment); } void pathAddBezierCubic(Vector2f p1, Vector2f p2, Vector2f p3, Vector2f p4) { ContourSegment segment; segment.p1 = p1; segment.p2 = p2; segment.p3 = p3; segment.p4 = p4; segment.type = SegmentType.BezierCubic; contour.append(segment); } void fillShape() { DynamicArray!Vector2f poly; DynamicArray!size_t polyBounds; Vector2f startP, endP, wayP1, wayP2; foreach(ref p; contour.data) { startP = p.p1.affineTransform2D(state.transformation); if (startP != endP) { polyBounds.append(poly.length); poly.append(startP); } if (p.type == SegmentType.Line) { endP = p.p2.affineTransform2D(state.transformation); poly.append(endP); } else { assert(p.type == SegmentType.BezierCubic); wayP1 = p.p2.affineTransform2D(state.transformation); wayP2 = p.p3.affineTransform2D(state.transformation); endP = p.p4.affineTransform2D(state.transformation); float t = 0.0f; while(t < 1.0f) { t += tesselationStep; Vector2f tessP = bezierVector2(startP, wayP1, wayP2, endP, t); poly.append(tessP); } } } auto alphas = New!(float[])(polyBounds.length); polyBounds.append(poly.length); foreach(y; 0.._image.height) foreach(x; 0.._image.width) { auto p = Vector2f(x, y); bool inside = false; foreach(i, ref alpha; alphas) { alpha = pointInPolygonAAFast(p, poly.data[polyBounds[i] .. polyBounds[i+1]]); if (alpha == 1) inside = !inside; } float totalAlpha = inside? 1: 0; if (inside) { foreach(alpha; alphas) { totalAlpha *= alpha == 1? 1: 1 - alpha; } } else { foreach(alpha; alphas) { totalAlpha += alpha == 1? 0: (1 - totalAlpha) * alpha; } } Color4f c = state.fillColor; c.a = c.a * totalAlpha; if (c.a > 0.0f) { _image[x, y] = alphaOver(_image[x, y], c); } } poly.free(); polyBounds.free(); alphas.Delete(); } void drawContour() { Vector2f tp1, tp2, tp3, tp4; foreach(i, ref p; contour.data) { if (p.type == SegmentType.Line) { tp1 = p.p1.affineTransform2D(state.transformation); tp2 = p.p2.affineTransform2D(state.transformation); drawLine(tp1, tp2); } else if (p.type == SegmentType.BezierCubic) { tp1 = p.p1.affineTransform2D(state.transformation); tp2 = p.p2.affineTransform2D(state.transformation); tp3 = p.p3.affineTransform2D(state.transformation); tp4 = p.p4.affineTransform2D(state.transformation); drawBezierCurve(tp1, tp2, tp3, tp4); } } } void drawLineTangent(Vector2f p1, Vector2f p2, Vector2f t1, Vector2f t2) { Vector2f n1 = Vector2f(-t1.y, t1.x); Vector2f n2 = Vector2f(-t2.y, t2.x); Vector2f offset1 = n1 * state.lineWidth * 0.5f; Vector2f offset2 = n2 * state.lineWidth * 0.5f; Vector2f[4] poly; poly[0] = p1 - offset1; poly[1] = p1 + offset1; poly[2] = p2 + offset2; poly[3] = p2 - offset2; float subpSize = 1.0f / subpixelResolution; float subpContrib = 1.0f / (subpixelResolution * subpixelResolution); int xmin = cast(int)min2(min2(poly[0].x, poly[1].x), min2(poly[2].x, poly[3].x)) - 1; int ymin = cast(int)min2(min2(poly[0].y, poly[1].y), min2(poly[2].y, poly[3].y)) - 1; int xmax = cast(int)max2(max2(poly[0].x, poly[1].x), max2(poly[2].x, poly[3].x)) + 1; int ymax = cast(int)max2(max2(poly[0].y, poly[1].y), max2(poly[2].y, poly[3].y)) + 1; foreach(y; ymin..ymax) foreach(x; xmin..xmax) { float alpha = 0.0f; foreach(sy; 0..subpixelResolution) foreach(sx; 0..subpixelResolution) { auto p = Vector2f(x + sx * subpSize, y + sy * subpSize); if (pointInPolygon(p, poly)) alpha += subpContrib; } float srcAlpha = tmpBuffer[x, y].r; tmpBuffer[x, y] = Color4f(min2(srcAlpha + alpha, 1.0f), 0, 0, 1); } } void drawLine(Vector2f p1, Vector2f p2) { Vector2f dir = p2 - p1; Vector2f ndir = dir.normalized; drawLineTangent(p1, p2, ndir, ndir); } void drawBezierCurve(Vector2f a, Vector2f b, Vector2f c, Vector2f d) { Vector2f p1 = a; Vector2f t1 = bezierTangentVector2(a, b, c, d, 0.0f).normalized; float t = 0.0f; while(t < 1.0f) { t += tesselationStep; Vector2f p2 = bezierVector2(a, b, c, d, t); Vector2f t2 = bezierTangentVector2(a, b, c, d, t).normalized; drawLineTangent(p1, p2, t1, t2); p1 = p2; t1 = t2; } } void blitTmpBuffer(Color4f color) { foreach(y; 0.._image.height) foreach(x; 0.._image.width) { Color4f c1 = _image[x, y]; Color4f c2 = color; c2.a = tmpBuffer[x, y].r * color.a; _image[x, y] = alphaOver(c1, c2); } } } bool pointInPolygon(Vector2f p, Vector2f[] poly) { size_t i = 0; size_t j = poly.length - 1; bool inside = false; for (i = 0; i < poly.length; i++) { Vector2f a = poly[i]; Vector2f b = poly[j]; if ((a.y > p.y) != (b.y > p.y) && (p.x < (b.x - a.x) * (p.y - a.y) / (b.y - a.y) + a.x)) inside = !inside; j = i; } return inside; } float sqrDistanceToLineSegment(Vector2f a, Vector2f b, Vector2f p) { Vector2f n = b - a; Vector2f pa = a - p; float c = dot(n, pa); if (c > 0.0f) return dot(pa, pa); Vector2f bp = p - b; if (dot(n, bp) > 0.0f) return dot(bp, bp); Vector2f e = pa - n * (c / dot(n, n)); return dot(e, e); } float pointInPolygonAAFast(Vector2f p, Vector2f[] poly) { size_t i = 0; size_t j = poly.length - 1; bool inside = false; float minDistance = float.max; for (i = 0; i < poly.length; i++) { Vector2f a = poly[i]; Vector2f b = poly[j]; float lx = (b.x - a.x) * (p.y - a.y) / (b.y - a.y) + a.x; if ((a.y > p.y) != (b.y > p.y)) { if (p.x < lx) inside = !inside; float dist = sqrDistanceToLineSegment(a, b, p); if (dist < minDistance) minDistance = dist; } j = i; } float cd = 1.0f - clamp(sqrt(minDistance), 0.0f, 1.0f); return max2(cast(float)inside, cd); }
D
struct S { int i; } auto f() { S[] ss; ss.length = 1; return 0; } enum a = f(); void main() { f(); }
D
instance NONE_ADDON_111_Quarhodron(Npc_Default) { name[0] = "Quarhodron"; guild = GIL_NONE; id = 111; voice = 11; flags = NPC_FLAG_GHOST | NPC_FLAG_IMMORTAL; npcType = NPCTYPE_FRIEND; aivar[AIV_MM_RestEnd] = TRUE; aivar[AIV_ToughGuy] = TRUE; aivar[AIV_ToughGuyNewsOverride] = TRUE; aivar[AIV_IGNORE_Murder] = TRUE; aivar[AIV_IGNORE_Theft] = TRUE; aivar[AIV_IGNORE_Sheepkiller] = TRUE; aivar[AIV_IgnoresArmor] = TRUE; aivar[AIV_NoFightParker] = TRUE; protection[PROT_POINT] = 9000; B_SetAttributesToChapter(self,6); attribute[ATR_MANA_MAX] = 6666; attribute[ATR_MANA] = 6666; fight_tactic = FAI_HUMAN_MASTER; B_SetNpcVisual(self,MALE,"Ske_Head",0,BodyTex_N,ITAR_Ancient); Mdl_SetModelFatness(self,2); Mdl_ApplyOverlayMds(self,"Humans_Arrogance.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,80); aivar[AIV_MagicUser] = MAGIC_ALWAYS; daily_routine = Rtn_Start_111; }; func void Rtn_Start_111() { TA_Ghost(8,0,23,0,"ADW_ANCIENTGHOST"); TA_Ghost(23,0,8,0,"ADW_ANCIENTGHOST"); }; func void Rtn_TOT_111() { TA_Ghost(8,0,23,0,"TOT"); TA_Ghost(23,0,8,0,"TOT"); }; instance NONE_ADDON_1158_Quarhodron(Npc_Default) { name[0] = "Quarhodron"; guild = GIL_SKELETON; id = 1158; voice = 11; aivar[90] = TRUE; aivar[94] = NPC_EPIC; flags = NPC_FLAG_GHOST | NPC_FLAG_IMMORTAL; npcType = npctype_main; aivar[AIV_ToughGuy] = TRUE; aivar[AIV_ToughGuyNewsOverride] = TRUE; aivar[AIV_IGNORE_Murder] = TRUE; aivar[AIV_IGNORE_Theft] = TRUE; aivar[AIV_IGNORE_Sheepkiller] = TRUE; aivar[AIV_IgnoresArmor] = TRUE; aivar[AIV_NoFightParker] = TRUE; aivar[AIV_EnemyOverride] = TRUE; protection[PROT_POINT] = 1000; B_SetAttributesToChapter(self,56); attribute[ATR_MANA_MAX] = 6666; attribute[ATR_MANA] = 6666; fight_tactic = FAI_HUMAN_MASTER; B_SetNpcVisual(self,MALE,"Ske_Head",0,BodyTex_N,ITAR_Ancient); Mdl_SetModelFatness(self,2); Mdl_ApplyOverlayMds(self,"Humans_Arrogance.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,100); EquipItem(self,ITMW_2H_DOOMSWORD_Elite); CreateInvItems(self,ITMW_1H_LostSoul,1); daily_routine = Rtn_Start_1158; }; func void Rtn_Start_1158() { TA_Ghost_Main(8,0,23,0,"AV_UNDEADTHRONE"); TA_Ghost_Main(23,0,8,0,"AV_UNDEADTHRONE"); }; func void Rtn_TOT_1158() { TA_Ghost_Main(8,0,23,0,"TOT"); TA_Ghost_Main(23,0,8,0,"TOT"); };
D
/** * Windows API header module * * Translated from MinGW Windows headers * * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(DRUNTIMESRC src/core/sys/windows/_winuser.d) */ module core.sys.windows.winuser; version (Windows): version (ANSI) {} else version = Unicode; pragma(lib, "user32"); // Conversion Notes: // The following macros were for win16 only, and are not included in this file: //#define EnumTaskWindows(h, f, p) EnumThreadWindows((DWORD)h, f, p) //#define PostAppMessageA(t, m, w, l) PostThreadMessageA((DWORD)t, m, w, l) //#define PostAppMessageW(t, m, w, l) PostThreadMessageW((DWORD)t, m, w, l) //#define GetSysModalWindow() (NULL) //#define SetSysModalWindow(h) (NULL) //#define GetWindowTask(hWnd) ((HANDLE)GetWindowThreadProcessId(hWnd, NULL)) //#define DefHookProc(c, p, lp, h) CallNextHookEx((HHOOK)*h, c, p, lp) private import core.sys.windows.w32api, core.sys.windows.winbase, core.sys.windows.wingdi; private import core.sys.windows.windef; // for HMONITOR // FIXME: clean up Windows version support LPTSTR MAKEINTATOM_T()(int i) { return cast(LPTSTR) i; } enum LPTSTR WC_DIALOG = MAKEINTATOM_T(0x8002); enum { FAPPCOMMAND_MOUSE = 0x8000, FAPPCOMMAND_KEY = 0, FAPPCOMMAND_OEM = 0x1000, FAPPCOMMAND_MASK = 0xF000 } enum { MNGO_NOINTERFACE = 0, MNGO_NOERROR, MNGOF_TOPGAP = 1, MNGOF_BOTTOMGAP } enum { FVIRTKEY = 1, FNOINVERT = 2, FSHIFT = 4, FCONTROL = 8, FALT = 16 } enum { ATF_TIMEOUTON = 1, ATF_ONOFFFEEDBACK = 2, ATF_AVAILABLE = 4 // May be obsolete. Not in recent MS docs. } enum { WH_MIN = -1, WH_MSGFILTER = -1, WH_JOURNALRECORD, WH_JOURNALPLAYBACK, WH_KEYBOARD, WH_GETMESSAGE, WH_CALLWNDPROC, WH_CBT, WH_SYSMSGFILTER, WH_MOUSE, WH_HARDWARE, WH_DEBUG, WH_SHELL, WH_FOREGROUNDIDLE, WH_CALLWNDPROCRET, WH_KEYBOARD_LL, WH_MOUSE_LL, // = 14 WH_MAX = 14, WH_MINHOOK = WH_MIN, WH_MAXHOOK = WH_MAX } enum { HC_ACTION = 0, HC_GETNEXT, HC_SKIP, HC_NOREMOVE, // = 3 HC_NOREM = HC_NOREMOVE, HC_SYSMODALON, HC_SYSMODALOFF } enum { HCBT_MOVESIZE = 0, HCBT_MINMAX, HCBT_QS, HCBT_CREATEWND, HCBT_DESTROYWND, HCBT_ACTIVATE, HCBT_CLICKSKIPPED, HCBT_KEYSKIPPED, HCBT_SYSCOMMAND, HCBT_SETFOCUS // = 9 } enum { CF_TEXT = 0x0001, CF_BITMAP, CF_METAFILEPICT, CF_SYLK, CF_DIF, CF_TIFF, CF_OEMTEXT, CF_DIB, CF_PALETTE, CF_PENDATA, CF_RIFF, CF_WAVE, CF_UNICODETEXT, CF_ENHMETAFILE, CF_HDROP, CF_LOCALE, CF_DIBV5, CF_MAX, // = 0x0012 CF_OWNERDISPLAY = 0x0080, CF_DSPTEXT, CF_DSPBITMAP, CF_DSPMETAFILEPICT, // = 0x0083 CF_DSPENHMETAFILE = 0x008E, CF_PRIVATEFIRST = 0x0200, CF_PRIVATELAST = 0x02FF, CF_GDIOBJFIRST = 0x0300, CF_GDIOBJLAST = 0x03FF } enum HKL_PREV = 0; enum HKL_NEXT = 1; enum KLF_ACTIVATE = 1; enum KLF_SUBSTITUTE_OK = 2; enum KLF_UNLOADPREVIOUS = 4; enum KLF_REORDER = 8; enum KLF_REPLACELANG = 16; enum KLF_NOTELLSHELL = 128; enum KLF_SETFORPROCESS = 256; enum KL_NAMELENGTH = 9; enum MF_ENABLED = 0; enum MF_GRAYED = 1; enum MF_DISABLED = 2; enum MF_BITMAP = 4; enum MF_CHECKED = 8; enum MF_MENUBARBREAK = 32; enum MF_MENUBREAK = 64; enum MF_OWNERDRAW = 256; enum MF_POPUP = 16; enum MF_SEPARATOR = 0x800; enum MF_STRING = 0; enum MF_UNCHECKED = 0; enum MF_DEFAULT = 4096; enum MF_SYSMENU = 0x2000; enum MF_HELP = 0x4000; enum MF_END = 128; enum MF_RIGHTJUSTIFY = 0x4000; enum MF_MOUSESELECT = 0x8000; enum MF_INSERT = 0; enum MF_CHANGE = 128; enum MF_APPEND = 256; enum MF_DELETE = 512; enum MF_REMOVE = 4096; enum MF_USECHECKBITMAPS = 512; enum MF_UNHILITE = 0; enum MF_HILITE = 128; // Also defined in dbt.h enum BSM_ALLCOMPONENTS = 0; enum BSM_VXDS = 1; enum BSM_NETDRIVER = 2; enum BSM_INSTALLABLEDRIVERS = 4; enum BSM_APPLICATIONS = 8; enum BSM_ALLDESKTOPS = 16; enum { BSF_QUERY = 0x0001, BSF_IGNORECURRENTTASK = 0x0002, BSF_FLUSHDISK = 0x0004, BSF_NOHANG = 0x0008, BSF_POSTMESSAGE = 0x0010, BSF_FORCEIFHUNG = 0x0020, BSF_NOTIMEOUTIFNOTHUNG = 0x0040, BSF_ALLOWSFW = 0x0080, BSF_SENDNOTIFYMESSAGE = 0x0100 } static if (_WIN32_WINNT >= 0x501) { enum { BSF_RETURNHDESK = 0x0200, BSF_LUID = 0x0400 } } enum BROADCAST_QUERY_DENY = 1112363332; enum DWORD ENUM_CURRENT_SETTINGS = -1; enum DWORD ENUM_REGISTRY_SETTINGS = -2; enum CDS_UPDATEREGISTRY = 1; enum CDS_TEST = 2; enum CDS_FULLSCREEN = 4; enum CDS_GLOBAL = 8; enum CDS_SET_PRIMARY = 16; enum CDS_NORESET = 0x10000000; enum CDS_SETRECT = 0x20000000; enum CDS_RESET = 0x40000000; enum { DISP_CHANGE_BADPARAM = -5, DISP_CHANGE_BADFLAGS, DISP_CHANGE_NOTUPDATED, DISP_CHANGE_BADMODE, DISP_CHANGE_FAILED, DISP_CHANGE_SUCCESSFUL, DISP_CHANGE_RESTART // = 1 } enum BST_UNCHECKED = 0; enum BST_CHECKED = 1; enum BST_INDETERMINATE = 2; enum BST_PUSHED = 4; enum BST_FOCUS = 8; enum MF_BYCOMMAND = 0; enum MF_BYPOSITION = 1024; // [Redefined] MF_UNCHECKED = 0 // [Redefined] MF_HILITE = 128 // [Redefined] MF_UNHILITE = 0 enum CWP_ALL = 0; enum CWP_SKIPINVISIBLE = 1; enum CWP_SKIPDISABLED = 2; enum CWP_SKIPTRANSPARENT = 4; enum IMAGE_BITMAP = 0; enum IMAGE_ICON = 1; enum IMAGE_CURSOR = 2; enum IMAGE_ENHMETAFILE = 3; enum DF_ALLOWOTHERACCOUNTHOOK = 1; enum DESKTOP_READOBJECTS = 1; enum DESKTOP_CREATEWINDOW = 2; enum DESKTOP_CREATEMENU = 4; enum DESKTOP_HOOKCONTROL = 8; enum DESKTOP_JOURNALRECORD = 16; enum DESKTOP_JOURNALPLAYBACK = 32; enum DESKTOP_ENUMERATE = 64; enum DESKTOP_WRITEOBJECTS = 128; enum DESKTOP_SWITCHDESKTOP = 256; enum int CW_USEDEFAULT = 0x80000000; enum { WS_OVERLAPPED = 0, WS_TILED = WS_OVERLAPPED, WS_MAXIMIZEBOX = 0x00010000, WS_MINIMIZEBOX = 0x00020000, WS_TABSTOP = 0x00010000, WS_GROUP = 0x00020000, WS_THICKFRAME = 0x00040000, WS_SIZEBOX = WS_THICKFRAME, WS_SYSMENU = 0x00080000, WS_HSCROLL = 0x00100000, WS_VSCROLL = 0x00200000, WS_DLGFRAME = 0x00400000, WS_BORDER = 0x00800000, WS_CAPTION = 0x00c00000, WS_OVERLAPPEDWINDOW = WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX, WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW, WS_MAXIMIZE = 0x01000000, WS_CLIPCHILDREN = 0x02000000, WS_CLIPSIBLINGS = 0x04000000, WS_DISABLED = 0x08000000, WS_VISIBLE = 0x10000000, WS_MINIMIZE = 0x20000000, WS_ICONIC = WS_MINIMIZE, WS_CHILD = 0x40000000, WS_CHILDWINDOW = 0x40000000, WS_POPUP = 0x80000000, WS_POPUPWINDOW = WS_POPUP|WS_BORDER|WS_SYSMENU, } enum MDIS_ALLCHILDSTYLES = 1; enum BS_3STATE = 5; enum BS_AUTO3STATE = 6; enum BS_AUTOCHECKBOX = 3; enum BS_AUTORADIOBUTTON = 9; enum BS_BITMAP = 128; enum BS_BOTTOM = 0x800; enum BS_CENTER = 0x300; enum BS_CHECKBOX = 2; enum BS_DEFPUSHBUTTON = 1; enum BS_GROUPBOX = 7; enum BS_ICON = 64; enum BS_LEFT = 256; enum BS_LEFTTEXT = 32; enum BS_MULTILINE = 0x2000; enum BS_NOTIFY = 0x4000; enum BS_OWNERDRAW = 0xb; enum BS_PUSHBUTTON = 0; enum BS_PUSHLIKE = 4096; enum BS_RADIOBUTTON = 4; enum BS_RIGHT = 512; enum BS_RIGHTBUTTON = 32; enum BS_TEXT = 0; enum BS_TOP = 0x400; enum BS_USERBUTTON = 8; enum BS_VCENTER = 0xc00; enum BS_FLAT = 0x8000; enum CBS_AUTOHSCROLL = 64; enum CBS_DISABLENOSCROLL = 0x800; enum CBS_DROPDOWN = 2; enum CBS_DROPDOWNLIST = 3; enum CBS_HASSTRINGS = 512; enum CBS_LOWERCASE = 0x4000; enum CBS_NOINTEGRALHEIGHT = 0x400; enum CBS_OEMCONVERT = 128; enum CBS_OWNERDRAWFIXED = 16; enum CBS_OWNERDRAWVARIABLE = 32; enum CBS_SIMPLE = 1; enum CBS_SORT = 256; enum CBS_UPPERCASE = 0x2000; enum ES_AUTOHSCROLL = 128; enum ES_AUTOVSCROLL = 64; enum ES_CENTER = 1; enum ES_LEFT = 0; enum ES_LOWERCASE = 16; enum ES_MULTILINE = 4; enum ES_NOHIDESEL = 256; enum ES_NUMBER = 0x2000; enum ES_OEMCONVERT = 0x400; enum ES_PASSWORD = 32; enum ES_READONLY = 0x800; enum ES_RIGHT = 2; enum ES_UPPERCASE = 8; enum ES_WANTRETURN = 4096; enum LBS_DISABLENOSCROLL = 4096; enum LBS_EXTENDEDSEL = 0x800; enum LBS_HASSTRINGS = 64; enum LBS_MULTICOLUMN = 512; enum LBS_MULTIPLESEL = 8; enum LBS_NODATA = 0x2000; enum LBS_NOINTEGRALHEIGHT = 256; enum LBS_NOREDRAW = 4; enum LBS_NOSEL = 0x4000; enum LBS_NOTIFY = 1; enum LBS_OWNERDRAWFIXED = 16; enum LBS_OWNERDRAWVARIABLE = 32; enum LBS_SORT = 2; enum LBS_STANDARD = 0xa00003; enum LBS_USETABSTOPS = 128; enum LBS_WANTKEYBOARDINPUT = 0x400; enum SBS_BOTTOMALIGN = 4; enum SBS_HORZ = 0; enum SBS_LEFTALIGN = 2; enum SBS_RIGHTALIGN = 4; enum SBS_SIZEBOX = 8; enum SBS_SIZEBOXBOTTOMRIGHTALIGN = 4; enum SBS_SIZEBOXTOPLEFTALIGN = 2; enum SBS_SIZEGRIP = 16; enum SBS_TOPALIGN = 2; enum SBS_VERT = 1; enum SS_BITMAP = 14; enum SS_BLACKFRAME = 7; enum SS_BLACKRECT = 4; enum SS_CENTER = 1; enum SS_CENTERIMAGE = 512; enum SS_ENHMETAFILE = 15; enum SS_ETCHEDFRAME = 18; enum SS_ETCHEDHORZ = 16; enum SS_ETCHEDVERT = 17; enum SS_GRAYFRAME = 8; enum SS_GRAYRECT = 5; enum SS_ICON = 3; enum SS_LEFT = 0; enum SS_LEFTNOWORDWRAP = 0xc; enum SS_NOPREFIX = 128; enum SS_NOTIFY = 256; enum SS_OWNERDRAW = 0xd; enum SS_REALSIZEIMAGE = 0x800; enum SS_RIGHT = 2; enum SS_RIGHTJUST = 0x400; enum SS_SIMPLE = 11; enum SS_SUNKEN = 4096; enum SS_WHITEFRAME = 9; enum SS_WHITERECT = 6; enum SS_USERITEM = 10; enum SS_TYPEMASK = 0x0000001FL; enum SS_ENDELLIPSIS = 0x00004000L; enum SS_PATHELLIPSIS = 0x00008000L; enum SS_WORDELLIPSIS = 0x0000C000L; enum SS_ELLIPSISMASK = 0x0000C000L; enum DS_ABSALIGN = 0x0001; enum DS_3DLOOK = 0x0004; enum DS_SYSMODAL = 0x0002; enum DS_FIXEDSYS = 0x0008; enum DS_NOFAILCREATE = 0x0010; enum DS_LOCALEDIT = 0x0020; enum DS_SETFONT = 0x0040; enum DS_MODALFRAME = 0x0080; enum DS_NOIDLEMSG = 0x0100; enum DS_SETFOREGROUND = 0x0200; enum DS_CONTROL = 0x0400; enum DS_CENTER = 0x0800; enum DS_CENTERMOUSE = 0x1000; enum DS_CONTEXTHELP = 0x2000; enum DS_SHELLFONT = DS_SETFONT | DS_FIXEDSYS; enum WS_EX_ACCEPTFILES = 16; enum WS_EX_APPWINDOW = 0x40000; enum WS_EX_CLIENTEDGE = 512; enum WS_EX_COMPOSITED = 0x2000000; // XP enum WS_EX_CONTEXTHELP = 0x400; enum WS_EX_CONTROLPARENT = 0x10000; enum WS_EX_DLGMODALFRAME = 1; enum WS_EX_LAYERED = 0x80000; // w2k enum WS_EX_LAYOUTRTL = 0x400000; // w98, w2k enum WS_EX_LEFT = 0; enum WS_EX_LEFTSCROLLBAR = 0x4000; enum WS_EX_LTRREADING = 0; enum WS_EX_MDICHILD = 64; enum WS_EX_NOACTIVATE = 0x8000000; // w2k enum WS_EX_NOINHERITLAYOUT = 0x100000; // w2k enum WS_EX_NOPARENTNOTIFY = 4; enum WS_EX_OVERLAPPEDWINDOW = 0x300; enum WS_EX_PALETTEWINDOW = 0x188; enum WS_EX_RIGHT = 0x1000; enum WS_EX_RIGHTSCROLLBAR = 0; enum WS_EX_RTLREADING = 0x2000; enum WS_EX_STATICEDGE = 0x20000; enum WS_EX_TOOLWINDOW = 128; enum WS_EX_TOPMOST = 8; enum WS_EX_TRANSPARENT = 32; enum WS_EX_WINDOWEDGE = 256; enum WINSTA_ENUMDESKTOPS = 1; enum WINSTA_READATTRIBUTES = 2; enum WINSTA_ACCESSCLIPBOARD = 4; enum WINSTA_CREATEDESKTOP = 8; enum WINSTA_WRITEATTRIBUTES = 16; enum WINSTA_ACCESSGLOBALATOMS = 32; enum WINSTA_EXITWINDOWS = 64; enum WINSTA_ENUMERATE = 256; enum WINSTA_READSCREEN = 512; enum DDL_READWRITE = 0; enum DDL_READONLY = 1; enum DDL_HIDDEN = 2; enum DDL_SYSTEM = 4; enum DDL_DIRECTORY = 16; enum DDL_ARCHIVE = 32; enum DDL_POSTMSGS = 8192; enum DDL_DRIVES = 16384; enum DDL_EXCLUSIVE = 32768; enum { DC_ACTIVE = 0x0001, DC_SMALLCAP = 0x0002, DC_ICON = 0x0004, DC_TEXT = 0x0008, DC_INBUTTON = 0x0010, DC_GRADIENT = 0x0020 } static if (_WIN32_WINNT >= 0x501) { enum DC_BUTTONS = 0x1000; } // Where are these documented? //enum DC_CAPTION = DC_ICON|DC_TEXT|DC_BUTTONS; //enum DC_NC = DC_CAPTION|DC_FRAME; enum BDR_RAISEDOUTER = 1; enum BDR_SUNKENOUTER = 2; enum BDR_RAISEDINNER = 4; enum BDR_SUNKENINNER = 8; enum BDR_OUTER = 3; enum BDR_INNER = 0xc; enum BDR_RAISED = 5; enum BDR_SUNKEN = 10; enum EDGE_RAISED = BDR_RAISEDOUTER|BDR_RAISEDINNER; enum EDGE_SUNKEN = BDR_SUNKENOUTER|BDR_SUNKENINNER; enum EDGE_ETCHED = BDR_SUNKENOUTER|BDR_RAISEDINNER; enum EDGE_BUMP = BDR_RAISEDOUTER|BDR_SUNKENINNER; enum BF_LEFT = 1; enum BF_TOP = 2; enum BF_RIGHT = 4; enum BF_BOTTOM = 8; enum BF_TOPLEFT = BF_TOP|BF_LEFT; enum BF_TOPRIGHT = BF_TOP|BF_RIGHT; enum BF_BOTTOMLEFT = BF_BOTTOM|BF_LEFT; enum BF_BOTTOMRIGHT = BF_BOTTOM|BF_RIGHT; enum BF_RECT = BF_LEFT|BF_TOP|BF_RIGHT|BF_BOTTOM ; enum BF_DIAGONAL = 16; enum BF_DIAGONAL_ENDTOPRIGHT = BF_DIAGONAL|BF_TOP|BF_RIGHT; enum BF_DIAGONAL_ENDTOPLEFT = BF_DIAGONAL|BF_TOP|BF_LEFT; enum BF_DIAGONAL_ENDBOTTOMLEFT = BF_DIAGONAL|BF_BOTTOM|BF_LEFT; enum BF_DIAGONAL_ENDBOTTOMRIGHT = BF_DIAGONAL|BF_BOTTOM|BF_RIGHT; enum BF_MIDDLE = 0x800; enum BF_SOFT = 0x1000; enum BF_ADJUST = 0x2000; enum BF_FLAT = 0x4000; enum BF_MONO = 0x8000; enum { DFC_CAPTION = 1, DFC_MENU, DFC_SCROLL, DFC_BUTTON, DFC_POPUPMENU // = 5 } enum { DFCS_CAPTIONCLOSE, DFCS_CAPTIONMIN, DFCS_CAPTIONMAX, DFCS_CAPTIONRESTORE, DFCS_CAPTIONHELP // = 4 } enum { DFCS_MENUARROW = 0, DFCS_MENUCHECK = 1, DFCS_MENUBULLET = 2, DFCS_MENUARROWRIGHT = 4 } enum { DFCS_SCROLLUP = 0, DFCS_SCROLLDOWN = 1, DFCS_SCROLLLEFT = 2, DFCS_SCROLLRIGHT = 3, DFCS_SCROLLCOMBOBOX = 5, DFCS_SCROLLSIZEGRIP = 8, DFCS_SCROLLSIZEGRIPRIGHT = 16 } enum { DFCS_BUTTONCHECK = 0, DFCS_BUTTONRADIOIMAGE = 0x0001, DFCS_BUTTONRADIOMASK = 0x0002, DFCS_BUTTONRADIO = 0x0004, DFCS_BUTTON3STATE = 0x0008, DFCS_BUTTONPUSH = 0x0010, DFCS_INACTIVE = 0x0100, DFCS_PUSHED = 0x0200, DFCS_CHECKED = 0x0400, DFCS_TRANSPARENT = 0x0800, DFCS_HOT = 0x1000, DFCS_ADJUSTRECT = 0x2000, DFCS_FLAT = 0x4000, DFCS_MONO = 0x8000 } enum { DST_COMPLEX = 0, DST_TEXT, DST_PREFIXTEXT, DST_ICON, DST_BITMAP // = 4 } enum DSS_NORMAL = 0; enum DSS_UNION = 16; enum DSS_DISABLED = 32; enum DSS_MONO = 128; enum DSS_RIGHT = 0x8000; enum DT_BOTTOM = 8; enum DT_CALCRECT = 1024; enum DT_CENTER = 1; enum DT_EDITCONTROL = 8192; enum DT_END_ELLIPSIS = 32768; enum DT_PATH_ELLIPSIS = 16384; enum DT_WORD_ELLIPSIS = 0x40000; enum DT_EXPANDTABS = 64; enum DT_EXTERNALLEADING = 512; enum DT_LEFT = 0; enum DT_MODIFYSTRING = 65536; enum DT_NOCLIP = 256; enum DT_NOPREFIX = 2048; enum DT_RIGHT = 2; enum DT_RTLREADING = 131072; enum DT_SINGLELINE = 32; enum DT_TABSTOP = 128; enum DT_TOP = 0; enum DT_VCENTER = 4; enum DT_WORDBREAK = 16; enum DT_INTERNAL = 4096; enum WB_ISDELIMITER = 2; enum WB_LEFT = 0; enum WB_RIGHT = 1; enum SB_HORZ = 0; enum SB_VERT = 1; enum SB_CTL = 2; enum SB_BOTH = 3; enum ESB_DISABLE_BOTH = 3; enum ESB_DISABLE_DOWN = 2; enum ESB_DISABLE_LEFT = 1; enum ESB_DISABLE_LTUP = 1; enum ESB_DISABLE_RIGHT = 2; enum ESB_DISABLE_RTDN = 2; enum ESB_DISABLE_UP = 1; enum ESB_ENABLE_BOTH = 0; enum SB_LINEUP = 0; enum SB_LINEDOWN = 1; enum SB_LINELEFT = 0; enum SB_LINERIGHT = 1; enum SB_PAGEUP = 2; enum SB_PAGEDOWN = 3; enum SB_PAGELEFT = 2; enum SB_PAGERIGHT = 3; enum SB_THUMBPOSITION = 4; enum SB_THUMBTRACK = 5; enum SB_ENDSCROLL = 8; enum SB_LEFT = 6; enum SB_RIGHT = 7; enum SB_BOTTOM = 7; enum SB_TOP = 6; //MACRO #define IS_INTRESOURCE(i) (((ULONG_PTR)(i) >> 16) == 0) template MAKEINTRESOURCE_T(WORD i) { enum LPTSTR MAKEINTRESOURCE_T = cast(LPTSTR)(i); } nothrow @nogc { LPSTR MAKEINTRESOURCEA(/*WORD*/uint i) { return cast(LPSTR) i; } LPWSTR MAKEINTRESOURCEW(/*WORD*/uint i) { return cast(LPWSTR) i; } } enum RT_CURSOR = MAKEINTRESOURCE_T!(1); enum RT_BITMAP = MAKEINTRESOURCE_T!(2); enum RT_ICON = MAKEINTRESOURCE_T!(3); enum RT_MENU = MAKEINTRESOURCE_T!(4); enum RT_DIALOG = MAKEINTRESOURCE_T!(5); enum RT_STRING = MAKEINTRESOURCE_T!(6); enum RT_FONTDIR = MAKEINTRESOURCE_T!(7); enum RT_FONT = MAKEINTRESOURCE_T!(8); enum RT_ACCELERATOR = MAKEINTRESOURCE_T!(9); enum RT_RCDATA = MAKEINTRESOURCE_T!(10); enum RT_MESSAGETABLE = MAKEINTRESOURCE_T!(11); enum RT_GROUP_CURSOR = MAKEINTRESOURCE_T!(12); enum RT_GROUP_ICON = MAKEINTRESOURCE_T!(14); enum RT_VERSION = MAKEINTRESOURCE_T!(16); enum RT_DLGINCLUDE = MAKEINTRESOURCE_T!(17); enum RT_PLUGPLAY = MAKEINTRESOURCE_T!(19); enum RT_VXD = MAKEINTRESOURCE_T!(20); enum RT_ANICURSOR = MAKEINTRESOURCE_T!(21); enum RT_ANIICON = MAKEINTRESOURCE_T!(22); enum RT_HTML = MAKEINTRESOURCE_T!(23); enum RT_MANIFEST = MAKEINTRESOURCE_T!(24); enum CREATEPROCESS_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE_T!(1); enum ISOLATIONAWARE_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE_T!(2); enum ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE_T!(3); enum { EWX_LOGOFF = 0, EWX_SHUTDOWN = 1, EWX_REBOOT = 2, EWX_FORCE = 4, EWX_POWEROFF = 8, EWX_FORCEIFHUNG = 16 } enum CS_BYTEALIGNCLIENT = 4096; enum CS_BYTEALIGNWINDOW = 8192; enum CS_KEYCVTWINDOW = 4; enum CS_NOKEYCVT = 256; enum CS_CLASSDC = 64; enum CS_DBLCLKS = 8; enum CS_GLOBALCLASS = 16384; enum CS_HREDRAW = 2; enum CS_NOCLOSE = 512; enum CS_OWNDC = 32; enum CS_PARENTDC = 128; enum CS_SAVEBITS = 2048; enum CS_VREDRAW = 1; enum CS_IME = 0x10000; enum GCW_ATOM = -32; enum GCL_CBCLSEXTRA = -20; enum GCL_CBWNDEXTRA = -18; enum GCL_HBRBACKGROUND = -10; enum GCL_HCURSOR = -12; enum GCL_HICON = -14; enum GCL_HICONSM = -34; enum GCL_HMODULE = -16; enum GCL_MENUNAME = -8; enum GCL_STYLE = -26; enum GCL_WNDPROC = -24; alias GCL_HICONSM GCLP_HICONSM; alias GCL_HICON GCLP_HICON; alias GCL_HCURSOR GCLP_HCURSOR; alias GCL_HBRBACKGROUND GCLP_HBRBACKGROUND; alias GCL_HMODULE GCLP_HMODULE; alias GCL_MENUNAME GCLP_MENUNAME; alias GCL_WNDPROC GCLP_WNDPROC; enum { IDC_ARROW = MAKEINTRESOURCE_T!(32512), IDC_IBEAM = MAKEINTRESOURCE_T!(32513), IDC_WAIT = MAKEINTRESOURCE_T!(32514), IDC_CROSS = MAKEINTRESOURCE_T!(32515), IDC_UPARROW = MAKEINTRESOURCE_T!(32516), IDC_SIZE = MAKEINTRESOURCE_T!(32640), IDC_ICON = MAKEINTRESOURCE_T!(32641), IDC_SIZENWSE = MAKEINTRESOURCE_T!(32642), IDC_SIZENESW = MAKEINTRESOURCE_T!(32643), IDC_SIZEWE = MAKEINTRESOURCE_T!(32644), IDC_SIZENS = MAKEINTRESOURCE_T!(32645), IDC_SIZEALL = MAKEINTRESOURCE_T!(32646), IDC_NO = MAKEINTRESOURCE_T!(32648), IDC_HAND = MAKEINTRESOURCE_T!(32649), IDC_APPSTARTING = MAKEINTRESOURCE_T!(32650), IDC_HELP = MAKEINTRESOURCE_T!(32651), IDI_APPLICATION = MAKEINTRESOURCE_T!(32512), IDI_HAND = MAKEINTRESOURCE_T!(32513), IDI_QUESTION = MAKEINTRESOURCE_T!(32514), IDI_EXCLAMATION = MAKEINTRESOURCE_T!(32515), IDI_ASTERISK = MAKEINTRESOURCE_T!(32516), IDI_WINLOGO = MAKEINTRESOURCE_T!(32517), IDI_WARNING = IDI_EXCLAMATION, IDI_ERROR = IDI_HAND, IDI_INFORMATION = IDI_ASTERISK } static if (_WIN32_WINNT >= 0x600) { enum IDI_SHIELD = MAKEINTRESOURCE_T!(32518); } enum { MIIM_STATE = 0x0001, MIIM_ID = 0x0002, MIIM_SUBMENU = 0x0004, MIIM_CHECKMARKS = 0x0008, MIIM_TYPE = 0x0010, MIIM_DATA = 0x0020, MIIM_STRING = 0x0040, MIIM_BITMAP = 0x0080, MIIM_FTYPE = 0x0100 } enum { MFT_BITMAP = 0x0004, MFT_MENUBARBREAK = 0x0020, MFT_MENUBREAK = 0x0040, MFT_OWNERDRAW = 0x0100, MFT_RADIOCHECK = 0x0200, MFT_RIGHTJUSTIFY = 0x4000, MFT_SEPARATOR = 0x0800, MFT_RIGHTORDER = 0x2000, MFT_STRING = 0 } enum { MFS_CHECKED = 8, MFS_DEFAULT = 4096, MFS_DISABLED = 3, MFS_ENABLED = 0, MFS_GRAYED = 3, MFS_HILITE = 128, MFS_UNCHECKED = 0, MFS_UNHILITE = 0 } enum { GW_HWNDFIRST = 0, GW_HWNDLAST, GW_HWNDNEXT, GW_HWNDPREV, GW_OWNER, GW_CHILD // = 5 } enum { SW_HIDE = 0, SW_NORMAL = 1, SW_SHOWNORMAL = 1, SW_SHOWMINIMIZED = 2, SW_MAXIMIZE = 3, SW_SHOWMAXIMIZED = 3, SW_SHOWNOACTIVATE = 4, SW_SHOW = 5, SW_MINIMIZE = 6, SW_SHOWMINNOACTIVE = 7, SW_SHOWNA = 8, SW_RESTORE = 9, SW_SHOWDEFAULT = 10, SW_FORCEMINIMIZE = 11, SW_MAX = 11 } enum { SW_PARENTCLOSING = 1, SW_OTHERZOOM, SW_PARENTOPENING, SW_OTHERUNZOOM // = 4 } enum { // is this a different SW from the previous? SW_SCROLLCHILDREN = 0x01, SW_INVALIDATE = 0x02, SW_ERASE = 0x04, SW_SMOOTHSCROLL = 0x10 } enum { MB_OK = 0, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNOCANCEL, MB_YESNO, MB_RETRYCANCEL, MB_CANCELTRYCONTINUE, // = 6 MB_TYPEMASK = 0x0000000F, MB_ICONHAND = 0x00000010, MB_ICONSTOP = MB_ICONHAND, MB_ICONERROR = MB_ICONHAND, MB_ICONQUESTION = 0x00000020, MB_ICONEXCLAMATION = 0x00000030, MB_ICONWARNING = MB_ICONEXCLAMATION, MB_ICONASTERISK = 0x00000040, MB_ICONINFORMATION = MB_ICONASTERISK, MB_USERICON = 0x00000080, MB_ICONMASK = 0x000000F0, MB_DEFBUTTON1 = 0, MB_DEFBUTTON2 = 0x00000100, MB_DEFBUTTON3 = 0x00000200, MB_DEFBUTTON4 = 0x00000300, MB_DEFMASK = 0x00000F00, MB_APPLMODAL = 0, MB_SYSTEMMODAL = 0x00001000, MB_TASKMODAL = 0x00002000, MB_MODEMASK = 0x00003000, MB_HELP = 0x00004000, MB_NOFOCUS = 0x00008000, MB_MISCMASK = 0x0000C000, MB_SETFOREGROUND = 0x00010000, MB_DEFAULT_DESKTOP_ONLY = 0x00020000, MB_TOPMOST = 0x00040000, MB_SERVICE_NOTIFICATION_NT3X = 0x00040000, MB_RIGHT = 0x00080000, MB_RTLREADING = 0x00100000, MB_SERVICE_NOTIFICATION = 0x00200000 } enum { IDOK = 1, IDCANCEL, IDABORT, IDRETRY, IDIGNORE, IDYES, IDNO, IDCLOSE, IDHELP, IDTRYAGAIN, IDCONTINUE // = 11 } enum GWL_EXSTYLE = -20; enum GWL_STYLE = -16; enum GWL_WNDPROC = -4; enum GWLP_WNDPROC = -4; enum GWL_HINSTANCE = -6; enum GWLP_HINSTANCE = -6; enum GWL_HWNDPARENT = -8; enum GWLP_HWNDPARENT = -8; enum GWL_ID = -12; enum GWLP_ID = -12; enum GWL_USERDATA = -21; enum GWLP_USERDATA = -21; enum DWL_DLGPROC = 4; enum DWLP_DLGPROC = 4; enum DWL_MSGRESULT = 0; enum DWLP_MSGRESULT = 0; enum DWL_USER = 8; enum DWLP_USER = 8; enum QS_KEY = 1; enum QS_MOUSEMOVE = 2; enum QS_MOUSEBUTTON = 4; enum QS_MOUSE = 6; enum QS_POSTMESSAGE = 8; enum QS_TIMER = 16; enum QS_PAINT = 32; enum QS_SENDMESSAGE = 64; enum QS_HOTKEY = 128; enum QS_ALLPOSTMESSAGE = 256; static if (_WIN32_WINNT >= 0x501) { enum QS_RAWINPUT = 1024; enum QS_INPUT = 1031; enum QS_ALLEVENTS = 1215; enum QS_ALLINPUT = 1279; } else { enum QS_INPUT = 7; enum QS_ALLEVENTS = 191; enum QS_ALLINPUT = 255; } enum MWMO_WAITALL = 1; enum MWMO_ALERTABLE = 2; enum MWMO_INPUTAVAILABLE = 4; enum COLOR_3DDKSHADOW = 21; enum COLOR_3DFACE = 15; enum COLOR_3DHILIGHT = 20; enum COLOR_3DHIGHLIGHT = 20; enum COLOR_3DLIGHT = 22; enum COLOR_BTNHILIGHT = 20; enum COLOR_3DSHADOW = 16; enum COLOR_ACTIVEBORDER = 10; enum COLOR_ACTIVECAPTION = 2; enum COLOR_APPWORKSPACE = 12; enum COLOR_BACKGROUND = 1; enum COLOR_DESKTOP = 1; enum COLOR_BTNFACE = 15; enum COLOR_BTNHIGHLIGHT = 20; enum COLOR_BTNSHADOW = 16; enum COLOR_BTNTEXT = 18; enum COLOR_CAPTIONTEXT = 9; enum COLOR_GRAYTEXT = 17; enum COLOR_HIGHLIGHT = 13; enum COLOR_HIGHLIGHTTEXT = 14; enum COLOR_INACTIVEBORDER = 11; enum COLOR_INACTIVECAPTION = 3; enum COLOR_INACTIVECAPTIONTEXT = 19; enum COLOR_INFOBK = 24; enum COLOR_INFOTEXT = 23; enum COLOR_MENU = 4; enum COLOR_MENUTEXT = 7; enum COLOR_SCROLLBAR = 0; enum COLOR_WINDOW = 5; enum COLOR_WINDOWFRAME = 6; enum COLOR_WINDOWTEXT = 8; enum COLOR_HOTLIGHT = 26; enum COLOR_GRADIENTACTIVECAPTION = 27; enum COLOR_GRADIENTINACTIVECAPTION = 28; enum CTLCOLOR_MSGBOX = 0; enum CTLCOLOR_EDIT = 1; enum CTLCOLOR_LISTBOX = 2; enum CTLCOLOR_BTN = 3; enum CTLCOLOR_DLG = 4; enum CTLCOLOR_SCROLLBAR = 5; enum CTLCOLOR_STATIC = 6; enum CTLCOLOR_MAX = 7; // For GetSystemMetrics() enum : int { SM_CXSCREEN = 0, SM_CYSCREEN, SM_CXVSCROLL, SM_CYHSCROLL, SM_CYCAPTION, SM_CXBORDER, SM_CYBORDER, SM_CXDLGFRAME, // = 7 SM_CXFIXEDFRAME = SM_CXDLGFRAME, SM_CYDLGFRAME, // = 8 SM_CYFIXEDFRAME = SM_CYDLGFRAME, SM_CYVTHUMB, // = 9 SM_CXHTHUMB, SM_CXICON, SM_CYICON, SM_CXCURSOR, SM_CYCURSOR, SM_CYMENU, SM_CXFULLSCREEN, SM_CYFULLSCREEN, SM_CYKANJIWINDOW, SM_MOUSEPRESENT, SM_CYVSCROLL, SM_CXHSCROLL, SM_DEBUG, SM_SWAPBUTTON, SM_RESERVED1, SM_RESERVED2, SM_RESERVED3, SM_RESERVED4, SM_CXMIN, SM_CYMIN, SM_CXSIZE, SM_CYSIZE, SM_CXSIZEFRAME, // = 32, SM_CXFRAME = SM_CXSIZEFRAME, SM_CYSIZEFRAME, // = 33 SM_CYFRAME = SM_CYSIZEFRAME, SM_CXMINTRACK, SM_CYMINTRACK, SM_CXDOUBLECLK, SM_CYDOUBLECLK, SM_CXICONSPACING, SM_CYICONSPACING, SM_MENUDROPALIGNMENT, SM_PENWINDOWS, SM_DBCSENABLED, SM_CMOUSEBUTTONS, SM_SECURE, SM_CXEDGE, SM_CYEDGE, SM_CXMINSPACING, SM_CYMINSPACING, SM_CXSMICON, SM_CYSMICON, SM_CYSMCAPTION, SM_CXSMSIZE, SM_CYSMSIZE, SM_CXMENUSIZE, SM_CYMENUSIZE, SM_ARRANGE, SM_CXMINIMIZED, SM_CYMINIMIZED, SM_CXMAXTRACK, SM_CYMAXTRACK, SM_CXMAXIMIZED, SM_CYMAXIMIZED, SM_NETWORK, // = 63 SM_CLEANBOOT = 67, SM_CXDRAG, SM_CYDRAG, SM_SHOWSOUNDS, SM_CXMENUCHECK, SM_CYMENUCHECK, SM_SLOWMACHINE, SM_MIDEASTENABLED, SM_MOUSEWHEELPRESENT, SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN, SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN, SM_CMONITORS, SM_SAMEDISPLAYFORMAT, SM_IMMENABLED, SM_CXFOCUSBORDER, SM_CYFOCUSBORDER, // = 84 SM_TABLETPC = 86, SM_MEDIACENTER, SM_STARTER, // = 88 SM_CMETRICS = 88, SM_SERVERR2, SM_REMOTESESSION = 0x1000, } static if (_WIN32_WINNT >= 0x501) { enum { // These are only for WinXP and later SM_SHUTTINGDOWN = 0x2000, SM_REMOTECONTROL = 0x2001 } } enum ARW_BOTTOMLEFT = 0; enum ARW_BOTTOMRIGHT = 1; enum ARW_HIDE = 8; enum ARW_TOPLEFT = 2; enum ARW_TOPRIGHT = 3; enum ARW_DOWN = 4; enum ARW_LEFT = 0; enum ARW_RIGHT = 0; enum ARW_UP = 4; enum UOI_FLAGS = 1; enum UOI_NAME = 2; enum UOI_TYPE = 3; enum UOI_USER_SID = 4; // For the fuLoad parameter of LoadImage() enum : UINT { LR_DEFAULTCOLOR = 0, LR_MONOCHROME = 0x0001, LR_COLOR = 0x0002, LR_COPYRETURNORG = 0x0004, LR_COPYDELETEORG = 0x0008, LR_LOADFROMFILE = 0x0010, LR_LOADTRANSPARENT = 0x0020, LR_DEFAULTSIZE = 0x0040, LR_VGACOLOR = 0x0080, LR_LOADREALSIZE = 0x0080, LR_LOADMAP3DCOLORS = 0x1000, LR_CREATEDIBSECTION = 0x2000, LR_COPYFROMRESOURCE = 0x4000, LR_SHARED = 0x8000 } enum { KEYEVENTF_EXTENDEDKEY = 1, KEYEVENTF_KEYUP = 2, KEYEVENTF_UNICODE = 4, KEYEVENTF_SCANCODE = 8 } enum OBM_BTNCORNERS = 32758; enum OBM_BTSIZE = 32761; enum OBM_CHECK = 32760; enum OBM_CHECKBOXES = 32759; enum OBM_CLOSE = 32754; enum OBM_COMBO = 32738; enum OBM_DNARROW = 32752; enum OBM_DNARROWD = 32742; enum OBM_DNARROWI = 32736; enum OBM_LFARROW = 32750; enum OBM_LFARROWI = 32734; enum OBM_LFARROWD = 32740; enum OBM_MNARROW = 32739; enum OBM_OLD_CLOSE = 32767; enum OBM_OLD_DNARROW = 32764; enum OBM_OLD_LFARROW = 32762; enum OBM_OLD_REDUCE = 32757; enum OBM_OLD_RESTORE = 32755; enum OBM_OLD_RGARROW = 32763; enum OBM_OLD_UPARROW = 32765; enum OBM_OLD_ZOOM = 32756; enum OBM_REDUCE = 32749; enum OBM_REDUCED = 32746; enum OBM_RESTORE = 32747; enum OBM_RESTORED = 32744; enum OBM_RGARROW = 32751; enum OBM_RGARROWD = 32741; enum OBM_RGARROWI = 32735; enum OBM_SIZE = 32766; enum OBM_UPARROW = 32753; enum OBM_UPARROWD = 32743; enum OBM_UPARROWI = 32737; enum OBM_ZOOM = 32748; enum OBM_ZOOMD = 32745; enum OCR_NORMAL = 32512; enum OCR_IBEAM = 32513; enum OCR_WAIT = 32514; enum OCR_CROSS = 32515; enum OCR_UP = 32516; enum OCR_SIZE = 32640; enum OCR_ICON = 32641; enum OCR_SIZENWSE = 32642; enum OCR_SIZENESW = 32643; enum OCR_SIZEWE = 32644; enum OCR_SIZENS = 32645; enum OCR_SIZEALL = 32646; enum OCR_NO = 32648; enum OCR_APPSTARTING = 32650; enum OIC_SAMPLE = 32512; enum OIC_HAND = 32513; enum OIC_QUES = 32514; enum OIC_BANG = 32515; enum OIC_NOTE = 32516; enum OIC_WINLOGO = 32517; enum OIC_WARNING = OIC_BANG; enum OIC_ERROR = OIC_HAND; enum OIC_INFORMATION = OIC_NOTE; enum HELPINFO_MENUITEM = 2; enum HELPINFO_WINDOW = 1; static if (_WIN32_WINNT >= 0x501) { enum { WTS_CONSOLE_CONNECT = 1, WTS_CONSOLE_DISCONNECT, WTS_REMOTE_CONNECT, WTS_REMOTE_DISCONNECT, WTS_SESSION_LOGON, WTS_SESSION_LOGOFF, WTS_SESSION_LOCK, WTS_SESSION_UNLOCK, WTS_SESSION_REMOTE_CONTROL // = 9 } } enum MSGF_DIALOGBOX = 0; enum MSGF_MESSAGEBOX = 1; enum MSGF_MENU = 2; enum MSGF_MOVE = 3; enum MSGF_SIZE = 4; enum MSGF_SCROLLBAR = 5; enum MSGF_NEXTWINDOW = 6; enum MSGF_MAINLOOP = 8; enum MSGF_USER = 4096; enum { MOUSEEVENTF_MOVE = 0x0001, MOUSEEVENTF_LEFTDOWN = 0x0002, MOUSEEVENTF_LEFTUP = 0x0004, MOUSEEVENTF_RIGHTDOWN = 0x0008, MOUSEEVENTF_RIGHTUP = 0x0010, MOUSEEVENTF_MIDDLEDOWN = 0x0020, MOUSEEVENTF_MIDDLEUP = 0x0040, MOUSEEVENTF_XDOWN = 0x0080, MOUSEEVENTF_XUP = 0x0100, MOUSEEVENTF_WHEEL = 0x0800, MOUSEEVENTF_ABSOLUTE = 0x8000 } enum PM_NOREMOVE = 0; enum PM_REMOVE = 1; enum PM_NOYIELD = 2; enum : HWND { HWND_BROADCAST = cast(HWND) 0xFFFF, HWND_MESSAGE = cast(HWND) -3, HWND_NOTOPMOST = cast(HWND) -2, HWND_TOPMOST = cast(HWND) -1, HWND_TOP = cast(HWND) 0, HWND_DESKTOP = cast(HWND) 0, HWND_BOTTOM = cast(HWND) 1 } enum RDW_INVALIDATE = 1; enum RDW_INTERNALPAINT = 2; enum RDW_ERASE = 4; enum RDW_VALIDATE = 8; enum RDW_NOINTERNALPAINT = 16; enum RDW_NOERASE = 32; enum RDW_NOCHILDREN = 64; enum RDW_ALLCHILDREN = 128; enum RDW_UPDATENOW = 256; enum RDW_ERASENOW = 512; enum RDW_FRAME = 1024; enum RDW_NOFRAME = 2048; enum { SMTO_NORMAL = 0, SMTO_BLOCK = 1, SMTO_ABORTIFHUNG = 2, SMTO_NOTIMEOUTIFNOTHUNG = 8 } enum SIF_ALL = 23; enum SIF_PAGE = 2; enum SIF_POS = 4; enum SIF_RANGE = 1; enum SIF_DISABLENOSCROLL = 8; enum SIF_TRACKPOS = 16; enum SWP_DRAWFRAME = 32; enum SWP_FRAMECHANGED = 32; enum SWP_HIDEWINDOW = 128; enum SWP_NOACTIVATE = 16; enum SWP_NOCOPYBITS = 256; enum SWP_NOMOVE = 2; enum SWP_NOSIZE = 1; enum SWP_NOREDRAW = 8; enum SWP_NOZORDER = 4; enum SWP_SHOWWINDOW = 64; enum SWP_NOOWNERZORDER = 512; enum SWP_NOREPOSITION = 512; enum SWP_NOSENDCHANGING = 1024; enum SWP_DEFERERASE = 8192; enum SWP_ASYNCWINDOWPOS = 16384; enum { // passed variously as int or WPARAM HSHELL_WINDOWCREATED = 1, HSHELL_WINDOWDESTROYED, HSHELL_ACTIVATESHELLWINDOW, HSHELL_WINDOWACTIVATED, HSHELL_GETMINRECT, HSHELL_REDRAW, HSHELL_TASKMAN, HSHELL_LANGUAGE, // = 8 HSHELL_ENDTASK = 10, HSHELL_ACCESSIBILITYSTATE, HSHELL_APPCOMMAND, // = 12 HSHELL_RUDEAPPACTIVATED = 32772, HSHELL_FLASH = 32774 } static if (_WIN32_WINNT >= 0x501) { enum { HSHELL_WINDOWREPLACED = 13, HSHELL_WINDOWREPLACING } } enum { SPI_GETBEEP = 0x0001, SPI_SETBEEP = 0x0002, SPI_GETMOUSE = 0x0003, SPI_SETMOUSE = 0x0004, SPI_GETBORDER = 0x0005, SPI_SETBORDER = 0x0006, SPI_GETKEYBOARDSPEED = 0x000A, SPI_SETKEYBOARDSPEED = 0x000B, SPI_LANGDRIVER = 0x000C, SPI_ICONHORIZONTALSPACING = 0x000D, SPI_GETSCREENSAVETIMEOUT = 0x000E, SPI_SETSCREENSAVETIMEOUT = 0x000F, SPI_GETSCREENSAVEACTIVE = 0x0010, SPI_SETSCREENSAVEACTIVE = 0x0011, SPI_GETGRIDGRANULARITY = 0x0012, SPI_SETGRIDGRANULARITY = 0x0013, SPI_SETDESKWALLPAPER = 0x0014, SPI_SETDESKPATTERN = 0x0015, SPI_GETKEYBOARDDELAY = 0x0016, SPI_SETKEYBOARDDELAY = 0x0017, SPI_ICONVERTICALSPACING = 0x0018, SPI_GETICONTITLEWRAP = 0x0019, SPI_SETICONTITLEWRAP = 0x001A, SPI_GETMENUDROPALIGNMENT = 0x001B, SPI_SETMENUDROPALIGNMENT = 0x001C, SPI_SETDOUBLECLKWIDTH = 0x001D, SPI_SETDOUBLECLKHEIGHT = 0x001E, SPI_GETICONTITLELOGFONT = 0x001F, SPI_SETDOUBLECLICKTIME = 0x0020, SPI_SETMOUSEBUTTONSWAP = 0x0021, SPI_SETICONTITLELOGFONT = 0x0022, SPI_GETFASTTASKSWITCH = 0x0023, SPI_SETFASTTASKSWITCH = 0x0024, SPI_SETDRAGFULLWINDOWS = 0x0025, SPI_GETDRAGFULLWINDOWS = 0x0026, SPI_GETNONCLIENTMETRICS = 0x0029, SPI_SETNONCLIENTMETRICS = 0x002A, SPI_GETMINIMIZEDMETRICS = 0x002B, SPI_SETMINIMIZEDMETRICS = 0x002C, SPI_GETICONMETRICS = 0x002D, SPI_SETICONMETRICS = 0x002E, SPI_SETWORKAREA = 0x002F, SPI_GETWORKAREA = 0x0030, SPI_SETPENWINDOWS = 0x0031, SPI_GETFILTERKEYS = 0x0032, SPI_SETFILTERKEYS = 0x0033, SPI_GETTOGGLEKEYS = 0x0034, SPI_SETTOGGLEKEYS = 0x0035, SPI_GETMOUSEKEYS = 0x0036, SPI_SETMOUSEKEYS = 0x0037, SPI_GETSHOWSOUNDS = 0x0038, SPI_SETSHOWSOUNDS = 0x0039, SPI_GETSTICKYKEYS = 0x003A, SPI_SETSTICKYKEYS = 0x003B, SPI_GETACCESSTIMEOUT = 0x003C, SPI_SETACCESSTIMEOUT = 0x003D, SPI_GETSERIALKEYS = 0x003E, SPI_SETSERIALKEYS = 0x003F, SPI_GETSOUNDSENTRY = 0x0040, SPI_SETSOUNDSENTRY = 0x0041, SPI_GETHIGHCONTRAST = 0x0042, SPI_SETHIGHCONTRAST = 0x0043, SPI_GETKEYBOARDPREF = 0x0044, SPI_SETKEYBOARDPREF = 0x0045, SPI_GETSCREENREADER = 0x0046, SPI_SETSCREENREADER = 0x0047, SPI_GETANIMATION = 0x0048, SPI_SETANIMATION = 0x0049, SPI_GETFONTSMOOTHING = 0x004A, SPI_SETFONTSMOOTHING = 0x004B, SPI_SETDRAGWIDTH = 0x004C, SPI_SETDRAGHEIGHT = 0x004D, SPI_SETHANDHELD = 0x004E, SPI_GETLOWPOWERTIMEOUT = 0x004F, SPI_GETPOWEROFFTIMEOUT = 0x0050, SPI_SETLOWPOWERTIMEOUT = 0x0051, SPI_SETPOWEROFFTIMEOUT = 0x0052, SPI_GETLOWPOWERACTIVE = 0x0053, SPI_GETPOWEROFFACTIVE = 0x0054, SPI_SETLOWPOWERACTIVE = 0x0055, SPI_SETPOWEROFFACTIVE = 0x0056, SPI_SETCURSORS = 0x0057, SPI_SETICONS = 0x0058, SPI_GETDEFAULTINPUTLANG = 0x0059, SPI_SETDEFAULTINPUTLANG = 0x005A, SPI_SETLANGTOGGLE = 0x005B, SPI_GETWINDOWSEXTENSION = 0x005C, SPI_SETMOUSETRAILS = 0x005D, SPI_GETMOUSETRAILS = 0x005E, SPI_GETSNAPTODEFBUTTON = 0x005F, SPI_SETSNAPTODEFBUTTON = 0x0060, //SPI_SCREENSAVERRUNNING = 0x0061, // mistake in older MinGW? SPI_SETSCREENSAVERRUNNING = 0x0061, SPI_GETMOUSEHOVERWIDTH = 0x0062, SPI_SETMOUSEHOVERWIDTH = 0x0063, SPI_GETMOUSEHOVERHEIGHT = 0x0064, SPI_SETMOUSEHOVERHEIGHT = 0x0065, SPI_GETMOUSEHOVERTIME = 0x0066, SPI_SETMOUSEHOVERTIME = 0x0067, SPI_GETWHEELSCROLLLINES = 0x0068, SPI_SETWHEELSCROLLLINES = 0x0069, SPI_GETMENUSHOWDELAY = 0x006A, SPI_SETMENUSHOWDELAY = 0x006B, SPI_GETSHOWIMEUI = 0x006E, SPI_SETSHOWIMEUI = 0x006F, SPI_GETMOUSESPEED = 0x0070, SPI_SETMOUSESPEED = 0x0071, SPI_GETSCREENSAVERRUNNING = 0x0072, SPI_GETDESKWALLPAPER = 0x0073, SPI_GETACTIVEWINDOWTRACKING = 0x1000, SPI_SETACTIVEWINDOWTRACKING = 0x1001, SPI_GETMENUANIMATION = 0x1002, SPI_SETMENUANIMATION = 0x1003, SPI_GETCOMBOBOXANIMATION = 0x1004, SPI_SETCOMBOBOXANIMATION = 0x1005, SPI_GETLISTBOXSMOOTHSCROLLING = 0x1006, SPI_SETLISTBOXSMOOTHSCROLLING = 0x1007, SPI_GETGRADIENTCAPTIONS = 0x1008, SPI_SETGRADIENTCAPTIONS = 0x1009, SPI_GETKEYBOARDCUES = 0x100A, SPI_GETMENUUNDERLINES = SPI_GETKEYBOARDCUES, SPI_SETKEYBOARDCUES = 0x100B, SPI_SETMENUUNDERLINES = SPI_SETKEYBOARDCUES, SPI_GETACTIVEWNDTRKZORDER = 0x100C, SPI_SETACTIVEWNDTRKZORDER = 0x100D, SPI_GETHOTTRACKING = 0x100E, SPI_SETHOTTRACKING = 0x100F, SPI_GETMENUFADE = 0x1012, SPI_SETMENUFADE = 0x1013, SPI_GETSELECTIONFADE = 0x1014, SPI_SETSELECTIONFADE = 0x1015, SPI_GETTOOLTIPANIMATION = 0x1016, SPI_SETTOOLTIPANIMATION = 0x1017, SPI_GETTOOLTIPFADE = 0x1018, SPI_SETTOOLTIPFADE = 0x1019, SPI_GETCURSORSHADOW = 0x101A, SPI_SETCURSORSHADOW = 0x101B, SPI_GETBLOCKSENDINPUTRESETS = 0x1026, SPI_SETBLOCKSENDINPUTRESETS = 0x1027, SPI_GETUIEFFECTS = 0x103E, SPI_SETUIEFFECTS = 0x103F, SPI_GETFOREGROUNDLOCKTIMEOUT = 0x2000, SPI_SETFOREGROUNDLOCKTIMEOUT = 0x2001, SPI_GETACTIVEWNDTRKTIMEOUT = 0x2002, SPI_SETACTIVEWNDTRKTIMEOUT = 0x2003, SPI_GETFOREGROUNDFLASHCOUNT = 0x2004, SPI_SETFOREGROUNDFLASHCOUNT = 0x2005, SPI_GETCARETWIDTH = 0x2006, SPI_SETCARETWIDTH = 0x2007 } enum { SPIF_UPDATEINIFILE = 1, SPIF_SENDWININICHANGE = 2, SPIF_SENDCHANGE = SPIF_SENDWININICHANGE } // [Redefined] ATF_ONOFFFEEDBACK = 2 // [Redefined] ATF_TIMEOUTON = 1 enum WM_APP = 32768; enum WM_ACTIVATE = 6; enum WM_ACTIVATEAPP = 28; enum WM_AFXFIRST = 864; enum WM_AFXLAST = 895; enum WM_ASKCBFORMATNAME = 780; enum WM_CANCELJOURNAL = 75; enum WM_CANCELMODE = 31; enum WM_CAPTURECHANGED = 533; enum WM_CHANGECBCHAIN = 781; enum WM_CHAR = 258; enum WM_CHARTOITEM = 47; enum WM_CHILDACTIVATE = 34; enum WM_CLEAR = 771; enum WM_CLOSE = 16; enum WM_COMMAND = 273; enum WM_COMMNOTIFY = 68; // obsolete enum WM_COMPACTING = 65; enum WM_COMPAREITEM = 57; enum WM_CONTEXTMENU = 123; enum WM_COPY = 769; enum WM_COPYDATA = 74; enum WM_CREATE = 1; enum WM_CTLCOLORBTN = 309; enum WM_CTLCOLORDLG = 310; enum WM_CTLCOLOREDIT = 307; enum WM_CTLCOLORLISTBOX = 308; enum WM_CTLCOLORMSGBOX = 306; enum WM_CTLCOLORSCROLLBAR = 311; enum WM_CTLCOLORSTATIC = 312; enum WM_CUT = 768; enum WM_DEADCHAR = 259; enum WM_DELETEITEM = 45; enum WM_DESTROY = 2; enum WM_DESTROYCLIPBOARD = 775; enum WM_DEVICECHANGE = 537; enum WM_DEVMODECHANGE = 27; enum WM_DISPLAYCHANGE = 126; enum WM_DRAWCLIPBOARD = 776; enum WM_DRAWITEM = 43; enum WM_DROPFILES = 563; enum WM_ENABLE = 10; enum WM_ENDSESSION = 22; enum WM_ENTERIDLE = 289; enum WM_ENTERMENULOOP = 529; enum WM_ENTERSIZEMOVE = 561; enum WM_ERASEBKGND = 20; enum WM_EXITMENULOOP = 530; enum WM_EXITSIZEMOVE = 562; enum WM_FONTCHANGE = 29; enum WM_GETDLGCODE = 135; enum WM_GETFONT = 49; enum WM_GETHOTKEY = 51; enum WM_GETICON = 127; enum WM_GETMINMAXINFO = 36; enum WM_GETTEXT = 13; enum WM_GETTEXTLENGTH = 14; enum WM_HANDHELDFIRST = 856; enum WM_HANDHELDLAST = 863; enum WM_HELP = 83; enum WM_HOTKEY = 786; enum WM_HSCROLL = 276; enum WM_HSCROLLCLIPBOARD = 782; enum WM_ICONERASEBKGND = 39; enum WM_INITDIALOG = 272; enum WM_INITMENU = 278; enum WM_INITMENUPOPUP = 279; enum WM_INPUTLANGCHANGE = 81; enum WM_INPUTLANGCHANGEREQUEST = 80; enum WM_KEYDOWN = 256; enum WM_KEYUP = 257; enum WM_KILLFOCUS = 8; enum WM_MDIACTIVATE = 546; enum WM_MDICASCADE = 551; enum WM_MDICREATE = 544; enum WM_MDIDESTROY = 545; enum WM_MDIGETACTIVE = 553; enum WM_MDIICONARRANGE = 552; enum WM_MDIMAXIMIZE = 549; enum WM_MDINEXT = 548; enum WM_MDIREFRESHMENU = 564; enum WM_MDIRESTORE = 547; enum WM_MDISETMENU = 560; enum WM_MDITILE = 550; enum WM_MEASUREITEM = 44; enum WM_UNINITMENUPOPUP = 0x0125; enum WM_MENURBUTTONUP = 290; enum WM_MENUCOMMAND = 0x0126; enum WM_MENUGETOBJECT = 0x0124; enum WM_MENUDRAG = 0x0123; enum WM_CHANGEUISTATE = 0x0127; enum WM_UPDATEUISTATE = 0x0128; enum WM_QUERYUISTATE = 0x0129; // LOWORD(wParam) values in WM_*UISTATE* enum { UIS_SET = 1, UIS_CLEAR = 2, UIS_INITIALIZE = 3 } // HIWORD(wParam) values in WM_*UISTATE* enum { UISF_HIDEFOCUS = 0x1, UISF_HIDEACCEL = 0x2 } static if (_WIN32_WINNT >= 0x501) { // HIWORD(wParam) values in WM_*UISTATE* enum { UISF_ACTIVE = 0x4 } } enum WM_MENUCHAR = 288; enum WM_MENUSELECT = 287; enum WM_MOVE = 3; enum WM_MOVING = 534; enum WM_NCACTIVATE = 134; enum WM_NCCALCSIZE = 131; enum WM_NCCREATE = 129; enum WM_NCDESTROY = 130; enum WM_NCHITTEST = 132; enum WM_NCLBUTTONDBLCLK = 163; enum WM_NCLBUTTONDOWN = 161; enum WM_NCLBUTTONUP = 162; enum WM_NCMBUTTONDBLCLK = 169; enum WM_NCMBUTTONDOWN = 167; enum WM_NCMBUTTONUP = 168; enum WM_NCXBUTTONDOWN = 171; enum WM_NCXBUTTONUP = 172; enum WM_NCXBUTTONDBLCLK = 173; enum WM_NCMOUSEHOVER = 0x02A0; enum WM_NCMOUSELEAVE = 0x02A2; enum WM_NCMOUSEMOVE = 160; enum WM_NCPAINT = 133; enum WM_NCRBUTTONDBLCLK = 166; enum WM_NCRBUTTONDOWN = 164; enum WM_NCRBUTTONUP = 165; enum WM_NEXTDLGCTL = 40; enum WM_NEXTMENU = 531; enum WM_NOTIFY = 78; enum WM_NOTIFYFORMAT = 85; enum WM_NULL = 0; enum WM_PAINT = 15; enum WM_PAINTCLIPBOARD = 777; enum WM_PAINTICON = 38; enum WM_PALETTECHANGED = 785; enum WM_PALETTEISCHANGING = 784; enum WM_PARENTNOTIFY = 528; enum WM_PASTE = 770; enum WM_PENWINFIRST = 896; enum WM_PENWINLAST = 911; enum WM_POWER = 72; enum WM_POWERBROADCAST = 536; enum WM_PRINT = 791; enum WM_PRINTCLIENT = 792; enum WM_APPCOMMAND = 0x0319; enum WM_QUERYDRAGICON = 55; enum WM_QUERYENDSESSION = 17; enum WM_QUERYNEWPALETTE = 783; enum WM_QUERYOPEN = 19; enum WM_QUEUESYNC = 35; enum WM_QUIT = 18; enum WM_RENDERALLFORMATS = 774; enum WM_RENDERFORMAT = 773; enum WM_SETCURSOR = 32; enum WM_SETFOCUS = 7; enum WM_SETFONT = 48; enum WM_SETHOTKEY = 50; enum WM_SETICON = 128; enum WM_SETREDRAW = 11; enum WM_SETTEXT = 12; enum WM_SETTINGCHANGE = 26; enum WM_SHOWWINDOW = 24; enum WM_SIZE = 5; enum WM_SIZECLIPBOARD = 779; enum WM_SIZING = 532; enum WM_SPOOLERSTATUS = 42; enum WM_STYLECHANGED = 125; enum WM_STYLECHANGING = 124; enum WM_SYSCHAR = 262; enum WM_SYSCOLORCHANGE = 21; enum WM_SYSCOMMAND = 274; enum WM_SYSDEADCHAR = 263; enum WM_SYSKEYDOWN = 260; enum WM_SYSKEYUP = 261; static if (_WIN32_WINNT >= 0x501) { enum WM_TABLET_FIRST = 704; enum WM_TABLET_LAST = 735; } enum WM_TCARD = 82; enum WM_THEMECHANGED = 794; enum WM_TIMECHANGE = 30; enum WM_TIMER = 275; enum WM_UNDO = 772; enum WM_USER = 1024; enum WM_USERCHANGED = 84; enum WM_VKEYTOITEM = 46; enum WM_VSCROLL = 277; enum WM_VSCROLLCLIPBOARD = 778; enum WM_WINDOWPOSCHANGED = 71; enum WM_WINDOWPOSCHANGING = 70; enum WM_WININICHANGE = 26; static if(_WIN32_WINNT >= 0x501) { enum WM_WTSSESSION_CHANGE = 689; } enum WM_INPUT = 255; enum WM_KEYFIRST = 256; static if(_WIN32_WINNT >= 0x501) { enum WM_UNICHAR = 265; enum WM_KEYLAST = 265; enum UNICODE_NOCHAR = 0xFFFF; } else { enum WM_KEYLAST = 264; } enum WM_SYNCPAINT = 136; enum WM_MOUSEACTIVATE = 33; enum WM_MOUSEMOVE = 512; enum WM_LBUTTONDOWN = 513; enum WM_LBUTTONUP = 514; enum WM_LBUTTONDBLCLK = 515; enum WM_RBUTTONDOWN = 516; enum WM_RBUTTONUP = 517; enum WM_RBUTTONDBLCLK = 518; enum WM_MBUTTONDOWN = 519; enum WM_MBUTTONUP = 520; enum WM_MBUTTONDBLCLK = 521; enum WM_MOUSEWHEEL = 522; enum WM_MOUSEFIRST = 512; static if (_WIN32_WINNT >= 0x501) { enum WM_XBUTTONDOWN = 523; enum WM_XBUTTONUP = 524; enum WM_XBUTTONDBLCLK = 525; } static if (_WIN32_WINNT >= 0x600) { // FIXME: where did this come from? what version is it? enum WM_MOUSEHWHEEL = 526; } static if (_WIN32_WINNT >= 0x600) { enum WM_MOUSELAST = WM_MOUSEHWHEEL; } else static if (_WIN32_WINNT >= 0x501) { enum WM_MOUSELAST = WM_XBUTTONDBLCLK; } else { enum WM_MOUSELAST = WM_MOUSEWHEEL; } enum WM_MOUSEHOVER = 0x2A1; enum WM_MOUSELEAVE = 0x2A3; enum WHEEL_DELTA = 120; SHORT GET_WHEEL_DELTA_WPARAM()(WPARAM wparam) { return cast(SHORT) HIWORD(wparam); } enum WHEEL_PAGESCROLL = uint.max; enum BM_CLICK = 245; enum BM_GETCHECK = 240; enum BM_GETIMAGE = 246; enum BM_GETSTATE = 242; enum BM_SETCHECK = 241; enum BM_SETIMAGE = 247; static if(_WIN32_WINNT >= 0x600) { enum BM_SETDONTCLICK = 248; } enum BM_SETSTATE = 243; enum BM_SETSTYLE = 244; enum BN_CLICKED = 0; enum BN_DBLCLK = 5; enum BN_DISABLE = 4; enum BN_DOUBLECLICKED = 5; enum BN_HILITE = 2; enum BN_KILLFOCUS = 7; enum BN_PAINT = 1; enum BN_PUSHED = 2; enum BN_SETFOCUS = 6; enum BN_UNHILITE = 3; enum BN_UNPUSHED = 3; enum CB_ADDSTRING = 323; enum CB_DELETESTRING = 324; enum CB_DIR = 325; enum CB_FINDSTRING = 332; enum CB_FINDSTRINGEXACT = 344; enum CB_GETCOUNT = 326; enum CB_GETCURSEL = 327; enum CB_GETDROPPEDCONTROLRECT = 338; enum CB_GETDROPPEDSTATE = 343; enum CB_GETDROPPEDWIDTH = 351; enum CB_GETEDITSEL = 320; enum CB_GETEXTENDEDUI = 342; enum CB_GETHORIZONTALEXTENT = 349; enum CB_GETITEMDATA = 336; enum CB_GETITEMHEIGHT = 340; enum CB_GETLBTEXT = 328; enum CB_GETLBTEXTLEN = 329; enum CB_GETLOCALE = 346; enum CB_GETTOPINDEX = 347; enum CB_INITSTORAGE = 353; enum CB_INSERTSTRING = 330; enum CB_LIMITTEXT = 321; enum CB_RESETCONTENT = 331; enum CB_SELECTSTRING = 333; enum CB_SETCURSEL = 334; enum CB_SETDROPPEDWIDTH = 352; enum CB_SETEDITSEL = 322; enum CB_SETEXTENDEDUI = 341; enum CB_SETHORIZONTALEXTENT = 350; enum CB_SETITEMDATA = 337; enum CB_SETITEMHEIGHT = 339; enum CB_SETLOCALE = 345; enum CB_SETTOPINDEX = 348; enum CB_SHOWDROPDOWN = 335; static if(_WIN32_WINNT >= 0x501) { enum CB_GETCOMBOBOXINFO = 356; } enum CBN_CLOSEUP = 8; enum CBN_DBLCLK = 2; enum CBN_DROPDOWN = 7; enum CBN_EDITCHANGE = 5; enum CBN_EDITUPDATE = 6; enum CBN_ERRSPACE = (-1); enum CBN_KILLFOCUS = 4; enum CBN_SELCHANGE = 1; enum CBN_SELENDCANCEL = 10; enum CBN_SELENDOK = 9; enum CBN_SETFOCUS = 3; enum EM_CANUNDO = 198; enum EM_CHARFROMPOS = 215; enum EM_EMPTYUNDOBUFFER = 205; enum EM_FMTLINES = 200; enum EM_GETFIRSTVISIBLELINE = 206; enum EM_GETHANDLE = 189; enum EM_GETLIMITTEXT = 213; enum EM_GETLINE = 196; enum EM_GETLINECOUNT = 186; enum EM_GETMARGINS = 212; enum EM_GETMODIFY = 184; enum EM_GETPASSWORDCHAR = 210; enum EM_GETRECT = 178; enum EM_GETSEL = 176; enum EM_GETTHUMB = 190; enum EM_GETWORDBREAKPROC = 209; enum EM_LIMITTEXT = 197; enum EM_LINEFROMCHAR = 201; enum EM_LINEINDEX = 187; enum EM_LINELENGTH = 193; enum EM_LINESCROLL = 182; enum EM_POSFROMCHAR = 214; enum EM_REPLACESEL = 194; enum EM_SCROLL = 181; enum EM_SCROLLCARET = 183; enum EM_SETHANDLE = 188; enum EM_SETLIMITTEXT = 197; enum EM_SETMARGINS = 211; enum EM_SETMODIFY = 185; enum EM_SETPASSWORDCHAR = 204; enum EM_SETREADONLY = 207; enum EM_SETRECT = 179; enum EM_SETRECTNP = 180; enum EM_SETSEL = 177; enum EM_SETTABSTOPS = 203; enum EM_SETWORDBREAKPROC = 208; enum EM_UNDO = 199; enum EM_SETIMESTATUS = 216; enum EM_GETIMESTATUS = 217; enum EN_CHANGE = 768; enum EN_ERRSPACE = 1280; enum EN_HSCROLL = 1537; enum EN_KILLFOCUS = 512; enum EN_MAXTEXT = 1281; enum EN_SETFOCUS = 256; enum EN_UPDATE = 1024; enum EN_VSCROLL = 1538; enum LB_ADDFILE = 406; enum LB_ADDSTRING = 384; enum LB_DELETESTRING = 386; enum LB_DIR = 397; enum LB_FINDSTRING = 399; enum LB_FINDSTRINGEXACT = 418; enum LB_GETANCHORINDEX = 413; enum LB_GETCARETINDEX = 415; enum LB_GETCOUNT = 395; enum LB_GETCURSEL = 392; enum LB_GETHORIZONTALEXTENT = 403; enum LB_GETITEMDATA = 409; enum LB_GETITEMHEIGHT = 417; enum LB_GETITEMRECT = 408; enum LB_GETLOCALE = 422; enum LB_GETSEL = 391; enum LB_GETSELCOUNT = 400; enum LB_GETSELITEMS = 401; enum LB_GETTEXT = 393; enum LB_GETTEXTLEN = 394; enum LB_GETTOPINDEX = 398; enum LB_INITSTORAGE = 424; enum LB_INSERTSTRING = 385; enum LB_ITEMFROMPOINT = 425; enum LB_RESETCONTENT = 388; enum LB_SELECTSTRING = 396; enum LB_SELITEMRANGE = 411; enum LB_SELITEMRANGEEX = 387; enum LB_SETANCHORINDEX = 412; enum LB_SETCARETINDEX = 414; enum LB_SETCOLUMNWIDTH = 405; enum LB_SETCOUNT = 423; enum LB_SETCURSEL = 390; enum LB_SETHORIZONTALEXTENT = 404; enum LB_SETITEMDATA = 410; enum LB_SETITEMHEIGHT = 416; enum LB_SETLOCALE = 421; enum LB_SETSEL = 389; enum LB_SETTABSTOPS = 402; enum LB_SETTOPINDEX = 407; static if(_WIN32_WINNT >= 0x501) { enum LB_GETLISTBOXINFO = 434; } enum LBN_DBLCLK = 2; enum LBN_ERRSPACE = -2; enum LBN_KILLFOCUS = 5; enum LBN_SELCANCEL = 3; enum LBN_SELCHANGE = 1; enum LBN_SETFOCUS = 4; enum SBM_ENABLE_ARROWS = 228; enum SBM_GETPOS = 225; enum SBM_GETRANGE = 227; enum SBM_GETSCROLLINFO = 234; enum SBM_SETPOS = 224; enum SBM_SETRANGE = 226; enum SBM_SETRANGEREDRAW = 230; enum SBM_SETSCROLLINFO = 233; static if(_WIN32_WINNT >= 0x501) { enum SBM_GETSCROLLBARINFO = 235; } enum STM_GETICON = 369; enum STM_GETIMAGE = 371; enum STM_SETICON = 368; enum STM_SETIMAGE = 370; enum STN_CLICKED = 0; enum STN_DBLCLK = 1; enum STN_DISABLE = 3; enum STN_ENABLE = 2; enum STM_MSGMAX = 372; enum DM_GETDEFID = WM_USER; enum DM_SETDEFID = WM_USER+1; enum DM_REPOSITION = WM_USER+2; enum PSM_PAGEINFO = WM_USER+100; enum PSM_SHEETINFO = WM_USER+101; enum PSI_SETACTIVE = 1; enum PSI_KILLACTIVE = 2; enum PSI_APPLY = 3; enum PSI_RESET = 4; enum PSI_HASHELP = 5; enum PSI_HELP = 6; enum PSI_CHANGED = 1; enum PSI_GUISTART = 2; enum PSI_REBOOT = 3; enum PSI_GETSIBLINGS = 4; enum DCX_WINDOW = 1; enum DCX_CACHE = 2; enum DCX_PARENTCLIP = 32; enum DCX_CLIPSIBLINGS = 16; enum DCX_CLIPCHILDREN = 8; enum DCX_NORESETATTRS = 4; enum DCX_INTERSECTUPDATE = 0x200; enum DCX_LOCKWINDOWUPDATE = 0x400; enum DCX_EXCLUDERGN = 64; enum DCX_INTERSECTRGN = 128; enum DCX_EXCLUDEUPDATE = 256; enum DCX_VALIDATE = 0x200000; enum GMDI_GOINTOPOPUPS = 2; enum GMDI_USEDISABLED = 1; enum FKF_AVAILABLE = 2; enum FKF_CLICKON = 64; enum FKF_FILTERKEYSON = 1; enum FKF_HOTKEYACTIVE = 4; enum FKF_HOTKEYSOUND = 16; enum FKF_CONFIRMHOTKEY = 8; enum FKF_INDICATOR = 32; enum HCF_HIGHCONTRASTON = 1; enum HCF_AVAILABLE = 2; enum HCF_HOTKEYACTIVE = 4; enum HCF_CONFIRMHOTKEY = 8; enum HCF_HOTKEYSOUND = 16; enum HCF_INDICATOR = 32; enum HCF_HOTKEYAVAILABLE = 64; enum MKF_AVAILABLE = 2; enum MKF_CONFIRMHOTKEY = 8; enum MKF_HOTKEYACTIVE = 4; enum MKF_HOTKEYSOUND = 16; enum MKF_INDICATOR = 32; enum MKF_MOUSEKEYSON = 1; enum MKF_MODIFIERS = 64; enum MKF_REPLACENUMBERS = 128; enum SERKF_ACTIVE = 8; // May be obsolete. Not in recent MS docs. enum SERKF_AVAILABLE = 2; enum SERKF_INDICATOR = 4; enum SERKF_SERIALKEYSON = 1; enum SSF_AVAILABLE = 2; enum SSF_SOUNDSENTRYON = 1; enum SSTF_BORDER = 2; enum SSTF_CHARS = 1; enum SSTF_DISPLAY = 3; enum SSTF_NONE = 0; enum SSGF_DISPLAY = 3; enum SSGF_NONE = 0; enum SSWF_CUSTOM = 4; enum SSWF_DISPLAY = 3; enum SSWF_NONE = 0; enum SSWF_TITLE = 1; enum SSWF_WINDOW = 2; enum SKF_AUDIBLEFEEDBACK = 64; enum SKF_AVAILABLE = 2; enum SKF_CONFIRMHOTKEY = 8; enum SKF_HOTKEYACTIVE = 4; enum SKF_HOTKEYSOUND = 16; enum SKF_INDICATOR = 32; enum SKF_STICKYKEYSON = 1; enum SKF_TRISTATE = 128; enum SKF_TWOKEYSOFF = 256; enum TKF_AVAILABLE = 2; enum TKF_CONFIRMHOTKEY = 8; enum TKF_HOTKEYACTIVE = 4; enum TKF_HOTKEYSOUND = 16; enum TKF_TOGGLEKEYSON = 1; enum MDITILE_SKIPDISABLED = 2; enum MDITILE_HORIZONTAL = 1; enum MDITILE_VERTICAL = 0; enum { VK_LBUTTON = 0x01, VK_RBUTTON = 0x02, VK_CANCEL = 0x03, VK_MBUTTON = 0x04, VK_XBUTTON1 = 0x05, VK_XBUTTON2 = 0x06, VK_BACK = 0x08, VK_TAB = 0x09, VK_CLEAR = 0x0C, VK_RETURN = 0x0D, VK_SHIFT = 0x10, VK_CONTROL = 0x11, VK_MENU = 0x12, VK_PAUSE = 0x13, VK_CAPITAL = 0x14, VK_KANA = 0x15, VK_HANGEUL = 0x15, VK_HANGUL = 0x15, VK_JUNJA = 0x17, VK_FINAL = 0x18, VK_HANJA = 0x19, VK_KANJI = 0x19, VK_ESCAPE = 0x1B, VK_CONVERT = 0x1C, VK_NONCONVERT = 0x1D, VK_ACCEPT = 0x1E, VK_MODECHANGE = 0x1F, VK_SPACE = 0x20, VK_PRIOR = 0x21, VK_NEXT = 0x22, VK_END = 0x23, VK_HOME = 0x24, VK_LEFT = 0x25, VK_UP = 0x26, VK_RIGHT = 0x27, VK_DOWN = 0x28, VK_SELECT = 0x29, VK_PRINT = 0x2A, VK_EXECUTE = 0x2B, VK_SNAPSHOT = 0x2C, VK_INSERT = 0x2D, VK_DELETE = 0x2E, VK_HELP = 0x2F, VK_LWIN = 0x5B, VK_RWIN = 0x5C, VK_APPS = 0x5D, VK_SLEEP = 0x5F, VK_NUMPAD0 = 0x60, VK_NUMPAD1 = 0x61, VK_NUMPAD2 = 0x62, VK_NUMPAD3 = 0x63, VK_NUMPAD4 = 0x64, VK_NUMPAD5 = 0x65, VK_NUMPAD6 = 0x66, VK_NUMPAD7 = 0x67, VK_NUMPAD8 = 0x68, VK_NUMPAD9 = 0x69, VK_MULTIPLY = 0x6A, VK_ADD = 0x6B, VK_SEPARATOR = 0x6C, VK_SUBTRACT = 0x6D, VK_DECIMAL = 0x6E, VK_DIVIDE = 0x6F, VK_F1 = 0x70, VK_F2 = 0x71, VK_F3 = 0x72, VK_F4 = 0x73, VK_F5 = 0x74, VK_F6 = 0x75, VK_F7 = 0x76, VK_F8 = 0x77, VK_F9 = 0x78, VK_F10 = 0x79, VK_F11 = 0x7A, VK_F12 = 0x7B, VK_F13 = 0x7C, VK_F14 = 0x7D, VK_F15 = 0x7E, VK_F16 = 0x7F, VK_F17 = 0x80, VK_F18 = 0x81, VK_F19 = 0x82, VK_F20 = 0x83, VK_F21 = 0x84, VK_F22 = 0x85, VK_F23 = 0x86, VK_F24 = 0x87, VK_NUMLOCK = 0x90, VK_SCROLL = 0x91, VK_LSHIFT = 0xA0, VK_RSHIFT = 0xA1, VK_LCONTROL = 0xA2, VK_RCONTROL = 0xA3, VK_LMENU = 0xA4, VK_RMENU = 0xA5, VK_BROWSER_BACK = 0xA6, VK_BROWSER_FORWARD = 0xA7, VK_BROWSER_REFRESH = 0xA8, VK_BROWSER_STOP = 0xA9, VK_BROWSER_SEARCH = 0xAA, VK_BROWSER_FAVORITES = 0xAB, VK_BROWSER_HOME = 0xAC, VK_VOLUME_MUTE = 0xAD, VK_VOLUME_DOWN = 0xAE, VK_VOLUME_UP = 0xAF, VK_MEDIA_NEXT_TRACK = 0xB0, VK_MEDIA_PREV_TRACK = 0xB1, VK_MEDIA_STOP = 0xB2, VK_MEDIA_PLAY_PAUSE = 0xB3, VK_LAUNCH_MAIL = 0xB4, VK_LAUNCH_MEDIA_SELECT = 0xB5, VK_LAUNCH_APP1 = 0xB6, VK_LAUNCH_APP2 = 0xB7, VK_OEM_1 = 0xBA, VK_OEM_PLUS = 0xBB, VK_OEM_COMMA = 0xBC, VK_OEM_MINUS = 0xBD, VK_OEM_PERIOD = 0xBE, VK_OEM_2 = 0xBF, VK_OEM_3 = 0xC0, VK_OEM_4 = 0xDB, VK_OEM_5 = 0xDC, VK_OEM_6 = 0xDD, VK_OEM_7 = 0xDE, VK_OEM_8 = 0xDF, VK_OEM_102 = 0xE2, VK_PROCESSKEY = 0xE5, VK_PACKET = 0xE7, VK_ATTN = 0xF6, VK_CRSEL = 0xF7, VK_EXSEL = 0xF8, VK_EREOF = 0xF9, VK_PLAY = 0xFA, VK_ZOOM = 0xFB, VK_NONAME = 0xFC, VK_PA1 = 0xFD, VK_OEM_CLEAR = 0xFE, } enum TME_HOVER = 1; enum TME_LEAVE = 2; enum TME_QUERY = 0x40000000; enum TME_CANCEL = 0x80000000; enum HOVER_DEFAULT = 0xFFFFFFFF; enum MK_LBUTTON = 1; enum MK_RBUTTON = 2; enum MK_SHIFT = 4; enum MK_CONTROL = 8; enum MK_MBUTTON = 16; enum MK_XBUTTON1 = 32; enum MK_XBUTTON2 = 64; enum { TPM_RECURSE = 0x0001, TPM_LEFTBUTTON = 0, TPM_RIGHTBUTTON = 0x0002, TPM_LEFTALIGN = 0, TPM_CENTERALIGN = 0x0004, TPM_RIGHTALIGN = 0x0008, TPM_TOPALIGN = 0, TPM_VCENTERALIGN = 0x0010, TPM_BOTTOMALIGN = 0x0020, TPM_HORIZONTAL = 0, TPM_VERTICAL = 0x0040, TPM_NONOTIFY = 0x0080, TPM_RETURNCMD = 0x0100 } enum HELP_COMMAND = 0x102; enum HELP_CONTENTS = 3; enum HELP_CONTEXT = 1; enum HELP_CONTEXTPOPUP = 8; enum HELP_FORCEFILE = 9; enum HELP_HELPONHELP = 4; enum HELP_INDEX = 3; enum HELP_KEY = 0x101; enum HELP_MULTIKEY = 0x201; enum HELP_PARTIALKEY = 0x105; enum HELP_QUIT = 2; enum HELP_SETCONTENTS = 5; enum HELP_SETINDEX = 5; enum HELP_SETWINPOS = 0x203; enum HELP_CONTEXTMENU = 0xa; enum HELP_FINDER = 0xb; enum HELP_WM_HELP = 0xc; enum HELP_TCARD = 0x8000; enum HELP_TCARD_DATA = 16; enum HELP_TCARD_OTHER_CALLER = 0x11; enum IDH_NO_HELP = 28440; enum IDH_MISSING_CONTEXT = 28441; enum IDH_GENERIC_HELP_BUTTON = 28442; enum IDH_OK = 28443; enum IDH_CANCEL = 28444; enum IDH_HELP = 28445; enum LB_CTLCODE = 0; enum LB_OKAY = 0; enum LB_ERR = -1; enum LB_ERRSPACE = -2; enum CB_OKAY = 0; enum CB_ERR = -1; enum CB_ERRSPACE = -2; enum HIDE_WINDOW = 0; enum SHOW_OPENWINDOW = 1; enum SHOW_ICONWINDOW = 2; enum SHOW_FULLSCREEN = 3; enum SHOW_OPENNOACTIVATE = 4; enum KF_EXTENDED = 256; enum KF_DLGMODE = 2048; enum KF_MENUMODE = 4096; enum KF_ALTDOWN = 8192; enum KF_REPEAT = 16384; enum KF_UP = 32768; enum WSF_VISIBLE = 1; enum PWR_OK = 1; enum PWR_FAIL = -1; enum PWR_SUSPENDREQUEST = 1; enum PWR_SUSPENDRESUME = 2; enum PWR_CRITICALRESUME = 3; enum NFR_ANSI = 1; enum NFR_UNICODE = 2; enum NF_QUERY = 3; enum NF_REQUERY = 4; enum MENULOOP_WINDOW = 0; enum MENULOOP_POPUP = 1; enum WMSZ_LEFT = 1; enum WMSZ_RIGHT = 2; enum WMSZ_TOP = 3; enum WMSZ_TOPLEFT = 4; enum WMSZ_TOPRIGHT = 5; enum WMSZ_BOTTOM = 6; enum WMSZ_BOTTOMLEFT = 7; enum WMSZ_BOTTOMRIGHT = 8; enum HTERROR = -2; enum HTTRANSPARENT = -1; enum HTNOWHERE = 0; enum HTCLIENT = 1; enum HTCAPTION = 2; enum HTSYSMENU = 3; enum HTGROWBOX = 4; enum HTSIZE = 4; enum HTMENU = 5; enum HTHSCROLL = 6; enum HTVSCROLL = 7; enum HTMINBUTTON = 8; enum HTMAXBUTTON = 9; enum HTREDUCE = 8; enum HTZOOM = 9; enum HTLEFT = 10; enum HTSIZEFIRST = 10; enum HTRIGHT = 11; enum HTTOP = 12; enum HTTOPLEFT = 13; enum HTTOPRIGHT = 14; enum HTBOTTOM = 15; enum HTBOTTOMLEFT = 16; enum HTBOTTOMRIGHT = 17; enum HTSIZELAST = 17; enum HTBORDER = 18; enum HTOBJECT = 19; enum HTCLOSE = 20; enum HTHELP = 21; enum MA_ACTIVATE = 1; enum MA_ACTIVATEANDEAT = 2; enum MA_NOACTIVATE = 3; enum MA_NOACTIVATEANDEAT = 4; enum SIZE_RESTORED = 0; enum SIZE_MINIMIZED = 1; enum SIZE_MAXIMIZED = 2; enum SIZE_MAXSHOW = 3; enum SIZE_MAXHIDE = 4; enum SIZENORMAL = 0; enum SIZEICONIC = 1; enum SIZEFULLSCREEN = 2; enum SIZEZOOMSHOW = 3; enum SIZEZOOMHIDE = 4; enum WVR_ALIGNTOP = 16; enum WVR_ALIGNLEFT = 32; enum WVR_ALIGNBOTTOM = 64; enum WVR_ALIGNRIGHT = 128; enum WVR_HREDRAW = 256; enum WVR_VREDRAW = 512; enum WVR_REDRAW = (WVR_HREDRAW|WVR_VREDRAW); enum WVR_VALIDRECTS = 1024; enum PRF_CHECKVISIBLE = 1; enum PRF_NONCLIENT = 2; enum PRF_CLIENT = 4; enum PRF_ERASEBKGND = 8; enum PRF_CHILDREN = 16; enum PRF_OWNED = 32; enum IDANI_OPEN = 1; enum IDANI_CLOSE = 2; enum IDANI_CAPTION = 3; enum WPF_RESTORETOMAXIMIZED = 2; enum WPF_SETMINPOSITION = 1; enum ODT_MENU = 1; enum ODT_LISTBOX = 2; enum ODT_COMBOBOX = 3; enum ODT_BUTTON = 4; enum ODT_STATIC = 5; enum ODA_DRAWENTIRE = 1; enum ODA_SELECT = 2; enum ODA_FOCUS = 4; enum ODS_SELECTED = 1; enum ODS_GRAYED = 2; enum ODS_DISABLED = 4; enum ODS_CHECKED = 8; enum ODS_FOCUS = 16; enum ODS_DEFAULT = 32; enum ODS_COMBOBOXEDIT = 4096; enum IDHOT_SNAPWINDOW = -1; enum IDHOT_SNAPDESKTOP = -2; enum DBWF_LPARAMPOINTER = 0x8000; enum DLGWINDOWEXTRA = 30; enum MNC_IGNORE = 0; enum MNC_CLOSE = 1; enum MNC_EXECUTE = 2; enum MNC_SELECT = 3; enum DOF_EXECUTABLE = 0x8001; enum DOF_DOCUMENT = 0x8002; enum DOF_DIRECTORY = 0x8003; enum DOF_MULTIPLE = 0x8004; enum DOF_PROGMAN = 1; enum DOF_SHELLDATA = 2; enum DO_DROPFILE = 0x454C4946; enum DO_PRINTFILE = 0x544E5250; enum SC_SIZE = 0xF000; enum SC_MOVE = 0xF010; enum SC_MINIMIZE = 0xF020; enum SC_ICON = 0xf020; enum SC_MAXIMIZE = 0xF030; enum SC_ZOOM = 0xF030; enum SC_NEXTWINDOW = 0xF040; enum SC_PREVWINDOW = 0xF050; enum SC_CLOSE = 0xF060; enum SC_VSCROLL = 0xF070; enum SC_HSCROLL = 0xF080; enum SC_MOUSEMENU = 0xF090; enum SC_KEYMENU = 0xF100; enum SC_ARRANGE = 0xF110; enum SC_RESTORE = 0xF120; enum SC_TASKLIST = 0xF130; enum SC_SCREENSAVE = 0xF140; enum SC_HOTKEY = 0xF150; enum SC_DEFAULT = 0xF160; enum SC_MONITORPOWER = 0xF170; enum SC_CONTEXTHELP = 0xF180; enum SC_SEPARATOR = 0xF00F; enum EC_LEFTMARGIN = 1; enum EC_RIGHTMARGIN = 2; enum EC_USEFONTINFO = 0xffff; enum DC_HASDEFID = 0x534B; enum DLGC_WANTARROWS = 1; enum DLGC_WANTTAB = 2; enum DLGC_WANTALLKEYS = 4; enum DLGC_WANTMESSAGE = 4; enum DLGC_HASSETSEL = 8; enum DLGC_DEFPUSHBUTTON = 16; enum DLGC_UNDEFPUSHBUTTON = 32; enum DLGC_RADIOBUTTON = 64; enum DLGC_WANTCHARS = 128; enum DLGC_STATIC = 256; enum DLGC_BUTTON = 0x2000; enum WA_INACTIVE = 0; enum WA_ACTIVE = 1; enum WA_CLICKACTIVE = 2; enum ICON_SMALL = 0; enum ICON_BIG = 1; static if (_WIN32_WINNT >= 0x501) { enum ICON_SMALL2 = 2; } enum HBITMAP HBMMENU_CALLBACK = cast(HBITMAP)-1, HBMMENU_SYSTEM = cast(HBITMAP)1, HBMMENU_MBAR_RESTORE = cast(HBITMAP)2, HBMMENU_MBAR_MINIMIZE = cast(HBITMAP)3, HBMMENU_MBAR_CLOSE = cast(HBITMAP)5, HBMMENU_MBAR_CLOSE_D = cast(HBITMAP)6, HBMMENU_MBAR_MINIMIZE_D = cast(HBITMAP)7, HBMMENU_POPUP_CLOSE = cast(HBITMAP)8, HBMMENU_POPUP_RESTORE = cast(HBITMAP)9, HBMMENU_POPUP_MAXIMIZE = cast(HBITMAP)10, HBMMENU_POPUP_MINIMIZE = cast(HBITMAP)11; enum MOD_ALT = 1; enum MOD_CONTROL = 2; enum MOD_SHIFT = 4; enum MOD_WIN = 8; enum MOD_IGNORE_ALL_MODIFIER = 1024; enum MOD_ON_KEYUP = 2048; enum MOD_RIGHT = 16384; enum MOD_LEFT = 32768; enum LLKHF_EXTENDED = (KF_EXTENDED >> 8); enum LLKHF_INJECTED = 0x00000010; enum LLKHF_ALTDOWN = (KF_ALTDOWN >> 8); enum LLKHF_UP = (KF_UP >> 8); enum CURSOR_SHOWING = 0x00000001; enum WS_ACTIVECAPTION = 0x00000001; enum ENDSESSION_LOGOFF = 0x80000000; enum GA_PARENT = 1; enum GA_ROOT = 2; enum GA_ROOTOWNER = 3; enum { MAPVK_VK_TO_VSC, MAPVK_VSC_TO_VK, MAPVK_VK_TO_CHAR, MAPVK_VSC_TO_VK_EX, MAPVK_VK_TO_VSC_EX // = 4 } enum { INPUT_MOUSE, INPUT_KEYBOARD, INPUT_HARDWARE // = 2 } // Callbacks // --------- extern (Windows) nothrow { alias INT_PTR function(HWND, UINT, WPARAM, LPARAM) DLGPROC; alias void function(HWND, UINT, UINT_PTR, DWORD) TIMERPROC; alias BOOL function(HDC, LPARAM, int) GRAYSTRINGPROC; alias LRESULT function(int, WPARAM, LPARAM) HOOKPROC; alias BOOL function(HWND, LPCSTR, HANDLE) PROPENUMPROCA; alias BOOL function(HWND, LPCWSTR, HANDLE) PROPENUMPROCW; alias BOOL function(HWND, LPSTR, HANDLE, ULONG_PTR) PROPENUMPROCEXA; alias BOOL function(HWND, LPWSTR, HANDLE, ULONG_PTR) PROPENUMPROCEXW; alias int function(LPSTR, int, int, int) EDITWORDBREAKPROCA; alias int function(LPWSTR, int, int, int) EDITWORDBREAKPROCW; alias LRESULT function(HWND, UINT, WPARAM, LPARAM) WNDPROC; alias BOOL function(HDC, LPARAM, WPARAM, int, int) DRAWSTATEPROC; alias BOOL function(HWND, LPARAM) WNDENUMPROC; alias BOOL function(HWND, LPARAM) ENUMWINDOWSPROC; alias void function(LPHELPINFO) MSGBOXCALLBACK; alias BOOL function(HMONITOR, HDC, LPRECT, LPARAM) MONITORENUMPROC; alias BOOL function(LPSTR, LPARAM) NAMEENUMPROCA; alias BOOL function(LPWSTR, LPARAM) NAMEENUMPROCW; alias void function(HWND, UINT, ULONG_PTR, LRESULT) SENDASYNCPROC; alias NAMEENUMPROCA DESKTOPENUMPROCA; alias NAMEENUMPROCW DESKTOPENUMPROCW; alias NAMEENUMPROCA WINSTAENUMPROCA; alias NAMEENUMPROCW WINSTAENUMPROCW; } mixin DECLARE_HANDLE!("HDWP"); mixin DECLARE_HANDLE!("HDEVNOTIFY"); struct MENUGETOBJECTINFO { DWORD dwFlags; UINT uPos; HMENU hmenu; PVOID riid; PVOID pvObj; } alias MENUGETOBJECTINFO* PMENUGETOBJECTINFO; struct ACCEL { BYTE fVirt; WORD key; WORD cmd; } alias ACCEL* LPACCEL; struct ACCESSTIMEOUT { UINT cbSize = ACCESSTIMEOUT.sizeof; DWORD dwFlags; DWORD iTimeOutMSec; } alias ACCESSTIMEOUT* LPACCESSTIMEOUT; struct ANIMATIONINFO { UINT cbSize = ANIMATIONINFO.sizeof; int iMinAnimate; } alias ANIMATIONINFO* LPANIMATIONINFO; struct CREATESTRUCTA { LPVOID lpCreateParams; HINSTANCE hInstance; HMENU hMenu; HWND hwndParent; int cy; int cx; int y; int x; LONG style; LPCSTR lpszName; LPCSTR lpszClass; DWORD dwExStyle; } alias CREATESTRUCTA* LPCREATESTRUCTA; struct CREATESTRUCTW { LPVOID lpCreateParams; HINSTANCE hInstance; HMENU hMenu; HWND hwndParent; int cy; int cx; int y; int x; LONG style; LPCWSTR lpszName; LPCWSTR lpszClass; DWORD dwExStyle; } alias CREATESTRUCTW* LPCREATESTRUCTW; struct CBT_CREATEWNDA { LPCREATESTRUCTA lpcs; HWND hwndInsertAfter; } alias CBT_CREATEWNDA* LPCBT_CREATEWNDA; struct CBT_CREATEWNDW { LPCREATESTRUCTW lpcs; HWND hwndInsertAfter; } alias CBT_CREATEWNDW* LPCBT_CREATEWNDW; struct CBTACTIVATESTRUCT { BOOL fMouse; HWND hWndActive; } alias CBTACTIVATESTRUCT* LPCBTACTIVATESTRUCT; static if (_WIN32_WINNT >= 0x501) { struct WTSSESSION_NOTIFICATION { DWORD cbSize; DWORD dwSessionId; } alias WTSSESSION_NOTIFICATION* PWTSSESSION_NOTIFICATION; } struct CLIENTCREATESTRUCT { HANDLE hWindowMenu; UINT idFirstChild; } alias CLIENTCREATESTRUCT* LPCLIENTCREATESTRUCT; struct COMPAREITEMSTRUCT { UINT CtlType; UINT CtlID; HWND hwndItem; UINT itemID1; DWORD itemData1; UINT itemID2; DWORD itemData2; DWORD dwLocaleId; } alias COMPAREITEMSTRUCT* LPCOMPAREITEMSTRUCT; struct COPYDATASTRUCT { DWORD dwData; DWORD cbData; PVOID lpData; } alias COPYDATASTRUCT* PCOPYDATASTRUCT; struct CURSORSHAPE { int xHotSpot; int yHotSpot; int cx; int cy; int cbWidth; BYTE Planes; BYTE BitsPixel; } alias CURSORSHAPE* LPCURSORSHAPE; struct CWPRETSTRUCT { LRESULT lResult; LPARAM lParam; WPARAM wParam; DWORD message; HWND hwnd; } struct CWPSTRUCT { LPARAM lParam; WPARAM wParam; UINT message; HWND hwnd; } alias CWPSTRUCT* PCWPSTRUCT; struct DEBUGHOOKINFO { DWORD idThread; DWORD idThreadInstaller; LPARAM lParam; WPARAM wParam; int code; } alias DEBUGHOOKINFO* PDEBUGHOOKINFO, LPDEBUGHOOKINFO; struct DELETEITEMSTRUCT { UINT CtlType; UINT CtlID; UINT itemID; HWND hwndItem; UINT itemData; } alias DELETEITEMSTRUCT* PDELETEITEMSTRUCT, LPDELETEITEMSTRUCT; align(2): struct DLGITEMTEMPLATE { DWORD style; DWORD dwExtendedStyle; short x; short y; short cx; short cy; WORD id; } alias DLGITEMTEMPLATE* LPDLGITEMTEMPLATE; struct DLGTEMPLATE { DWORD style; DWORD dwExtendedStyle; WORD cdit; short x; short y; short cx; short cy; } alias DLGTEMPLATE* LPDLGTEMPLATE, LPDLGTEMPLATEA, LPDLGTEMPLATEW; alias const(DLGTEMPLATE)* LPCDLGTEMPLATE, LPCDLGTEMPLATEA, LPCDLGTEMPLATEW; align: struct DRAWITEMSTRUCT { UINT CtlType; UINT CtlID; UINT itemID; UINT itemAction; UINT itemState; HWND hwndItem; HDC hDC; RECT rcItem; DWORD itemData; } alias DRAWITEMSTRUCT* LPDRAWITEMSTRUCT, PDRAWITEMSTRUCT; struct DRAWTEXTPARAMS { UINT cbSize = DRAWTEXTPARAMS.sizeof; int iTabLength; int iLeftMargin; int iRightMargin; UINT uiLengthDrawn; } alias DRAWTEXTPARAMS* LPDRAWTEXTPARAMS; struct PAINTSTRUCT { HDC hdc; BOOL fErase; RECT rcPaint; BOOL fRestore; BOOL fIncUpdate; BYTE[32] rgbReserved; } alias PAINTSTRUCT* PPAINTSTRUCT, NPPAINTSTRUCT, LPPAINTSTRUCT; struct MSG { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } alias MSG* NPMSG, LPMSG, PMSG; struct ICONINFO { BOOL fIcon; DWORD xHotspot; DWORD yHotspot; HBITMAP hbmMask; HBITMAP hbmColor; } alias ICONINFO* PICONINFO; struct NMHDR { HWND hwndFrom; UINT_PTR idFrom; UINT code; } alias NMHDR* LPNMHDR; struct WNDCLASSA { UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCSTR lpszMenuName; LPCSTR lpszClassName; } alias WNDCLASSA* NPWNDCLASSA, LPWNDCLASSA, PWNDCLASSA; struct WNDCLASSW { UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCWSTR lpszMenuName; LPCWSTR lpszClassName; } alias WNDCLASSW* NPWNDCLASSW, LPWNDCLASSW, PWNDCLASSW; struct WNDCLASSEXA { UINT cbSize = WNDCLASSEXA.sizeof; UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCSTR lpszMenuName; LPCSTR lpszClassName; HICON hIconSm; } alias WNDCLASSEXA* NPWNDCLASSEXA, LPWNDCLASSEXA, PWNDCLASSEXA; struct WNDCLASSEXW { UINT cbSize = WNDCLASSEXW.sizeof; UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCWSTR lpszMenuName; LPCWSTR lpszClassName; HICON hIconSm; } alias WNDCLASSEXW* LPWNDCLASSEXW, PWNDCLASSEXW; struct MENUITEMINFOA { UINT cbSize = MENUITEMINFOA.sizeof; UINT fMask; UINT fType; UINT fState; UINT wID; HMENU hSubMenu; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; ULONG_PTR dwItemData; LPSTR dwTypeData; UINT cch; HBITMAP hbmpItem; } alias MENUITEMINFOA* LPMENUITEMINFOA; alias const(MENUITEMINFOA)* LPCMENUITEMINFOA; struct MENUITEMINFOW { UINT cbSize = MENUITEMINFOW.sizeof; UINT fMask; UINT fType; UINT fState; UINT wID; HMENU hSubMenu; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; ULONG_PTR dwItemData; LPWSTR dwTypeData; UINT cch; HBITMAP hbmpItem; } alias MENUITEMINFOW* LPMENUITEMINFOW; alias const(MENUITEMINFOW)* LPCMENUITEMINFOW; struct SCROLLINFO { UINT cbSize = this.sizeof; UINT fMask; int nMin; int nMax; UINT nPage; int nPos; int nTrackPos; } alias SCROLLINFO* LPSCROLLINFO; alias const(SCROLLINFO)* LPCSCROLLINFO; struct WINDOWPLACEMENT { UINT length; UINT flags; UINT showCmd; POINT ptMinPosition; POINT ptMaxPosition; RECT rcNormalPosition; } alias WINDOWPLACEMENT* LPWINDOWPLACEMENT, PWINDOWPLACEMENT; struct MENUITEMTEMPLATEHEADER { WORD versionNumber; WORD offset; } struct MENUITEMTEMPLATE { WORD mtOption; WORD mtID; WCHAR[1] mtString; } alias void MENUTEMPLATE, MENUTEMPLATEA, MENUTEMPLATEW; alias MENUTEMPLATE* LPMENUTEMPLATEA, LPMENUTEMPLATEW, LPMENUTEMPLATE; struct HELPINFO { UINT cbSize = this.sizeof; int iContextType; int iCtrlId; HANDLE hItemHandle; DWORD dwContextId; POINT MousePos; } alias HELPINFO* LPHELPINFO; struct MSGBOXPARAMSA { UINT cbSize = this.sizeof; HWND hwndOwner; HINSTANCE hInstance; LPCSTR lpszText; LPCSTR lpszCaption; DWORD dwStyle; LPCSTR lpszIcon; DWORD dwContextHelpId; MSGBOXCALLBACK lpfnMsgBoxCallback; DWORD dwLanguageId; } alias MSGBOXPARAMSA* PMSGBOXPARAMSA, LPMSGBOXPARAMSA; struct MSGBOXPARAMSW { UINT cbSize = this.sizeof; HWND hwndOwner; HINSTANCE hInstance; LPCWSTR lpszText; LPCWSTR lpszCaption; DWORD dwStyle; LPCWSTR lpszIcon; DWORD dwContextHelpId; MSGBOXCALLBACK lpfnMsgBoxCallback; DWORD dwLanguageId; } alias MSGBOXPARAMSW* PMSGBOXPARAMSW, LPMSGBOXPARAMSW; struct USEROBJECTFLAGS { BOOL fInherit; BOOL fReserved; DWORD dwFlags; } struct FILTERKEYS { UINT cbSize = this.sizeof; DWORD dwFlags; DWORD iWaitMSec; DWORD iDelayMSec; DWORD iRepeatMSec; DWORD iBounceMSec; } struct HIGHCONTRASTA { UINT cbSize = this.sizeof; DWORD dwFlags; LPSTR lpszDefaultScheme; } alias HIGHCONTRASTA* LPHIGHCONTRASTA; struct HIGHCONTRASTW { UINT cbSize = this.sizeof; DWORD dwFlags; LPWSTR lpszDefaultScheme; } alias HIGHCONTRASTW* LPHIGHCONTRASTW; struct ICONMETRICSA { UINT cbSize = this.sizeof; int iHorzSpacing; int iVertSpacing; int iTitleWrap; LOGFONTA lfFont; } alias ICONMETRICSA* LPICONMETRICSA; struct ICONMETRICSW { UINT cbSize = this.sizeof; int iHorzSpacing; int iVertSpacing; int iTitleWrap; LOGFONTW lfFont; } alias ICONMETRICSW* LPICONMETRICSW; struct MINIMIZEDMETRICS { UINT cbSize = this.sizeof; int iWidth; int iHorzGap; int iVertGap; int iArrange; } alias MINIMIZEDMETRICS* LPMINIMIZEDMETRICS; struct MOUSEKEYS { UINT cbSize = this.sizeof; DWORD dwFlags; DWORD iMaxSpeed; DWORD iTimeToMaxSpeed; DWORD iCtrlSpeed; DWORD dwReserved1; DWORD dwReserved2; } alias MOUSEKEYS* LPMOUSEKEYS; struct NONCLIENTMETRICSA { UINT cbSize = this.sizeof; int iBorderWidth; int iScrollWidth; int iScrollHeight; int iCaptionWidth; int iCaptionHeight; LOGFONTA lfCaptionFont; int iSmCaptionWidth; int iSmCaptionHeight; LOGFONTA lfSmCaptionFont; int iMenuWidth; int iMenuHeight; LOGFONTA lfMenuFont; LOGFONTA lfStatusFont; LOGFONTA lfMessageFont; } alias NONCLIENTMETRICSA* LPNONCLIENTMETRICSA; struct NONCLIENTMETRICSW { UINT cbSize = this.sizeof; int iBorderWidth; int iScrollWidth; int iScrollHeight; int iCaptionWidth; int iCaptionHeight; LOGFONTW lfCaptionFont; int iSmCaptionWidth; int iSmCaptionHeight; LOGFONTW lfSmCaptionFont; int iMenuWidth; int iMenuHeight; LOGFONTW lfMenuFont; LOGFONTW lfStatusFont; LOGFONTW lfMessageFont; } alias NONCLIENTMETRICSW* LPNONCLIENTMETRICSW; struct SERIALKEYSA { UINT cbSize = this.sizeof; DWORD dwFlags; LPSTR lpszActivePort; LPSTR lpszPort; UINT iBaudRate; UINT iPortState; UINT iActive; } alias SERIALKEYSA* LPSERIALKEYSA; struct SERIALKEYSW { UINT cbSize = this.sizeof; DWORD dwFlags; LPWSTR lpszActivePort; LPWSTR lpszPort; UINT iBaudRate; UINT iPortState; UINT iActive; } alias SERIALKEYSW* LPSERIALKEYSW; struct SOUNDSENTRYA { UINT cbSize = this.sizeof; DWORD dwFlags; DWORD iFSTextEffect; DWORD iFSTextEffectMSec; DWORD iFSTextEffectColorBits; DWORD iFSGrafEffect; DWORD iFSGrafEffectMSec; DWORD iFSGrafEffectColor; DWORD iWindowsEffect; DWORD iWindowsEffectMSec; LPSTR lpszWindowsEffectDLL; DWORD iWindowsEffectOrdinal; } alias SOUNDSENTRYA* LPSOUNDSENTRYA; struct SOUNDSENTRYW { UINT cbSize = this.sizeof; DWORD dwFlags; DWORD iFSTextEffect; DWORD iFSTextEffectMSec; DWORD iFSTextEffectColorBits; DWORD iFSGrafEffect; DWORD iFSGrafEffectMSec; DWORD iFSGrafEffectColor; DWORD iWindowsEffect; DWORD iWindowsEffectMSec; LPWSTR lpszWindowsEffectDLL; DWORD iWindowsEffectOrdinal; } alias SOUNDSENTRYW* LPSOUNDSENTRYW; struct STICKYKEYS { DWORD cbSize = this.sizeof; DWORD dwFlags; } alias STICKYKEYS* LPSTICKYKEYS; struct TOGGLEKEYS { DWORD cbSize = this.sizeof; DWORD dwFlags; } struct MOUSEHOOKSTRUCT { POINT pt; HWND hwnd; UINT wHitTestCode; DWORD dwExtraInfo; } alias MOUSEHOOKSTRUCT* LPMOUSEHOOKSTRUCT, PMOUSEHOOKSTRUCT; struct TRACKMOUSEEVENT { DWORD cbSize = this.sizeof; DWORD dwFlags; HWND hwndTrack; DWORD dwHoverTime; } alias TRACKMOUSEEVENT* LPTRACKMOUSEEVENT; struct TPMPARAMS { UINT cbSize = this.sizeof; RECT rcExclude; } alias TPMPARAMS* LPTPMPARAMS; struct EVENTMSG { UINT message; UINT paramL; UINT paramH; DWORD time; HWND hwnd; } alias EVENTMSG* PEVENTMSGMSG, LPEVENTMSGMSG, PEVENTMSG, LPEVENTMSG; struct WINDOWPOS { HWND hwnd; HWND hwndInsertAfter; int x; int y; int cx; int cy; UINT flags; } alias WINDOWPOS* PWINDOWPOS, LPWINDOWPOS; struct NCCALCSIZE_PARAMS { RECT[3] rgrc; PWINDOWPOS lppos; } alias NCCALCSIZE_PARAMS* LPNCCALCSIZE_PARAMS; struct MDICREATESTRUCTA { LPCSTR szClass; LPCSTR szTitle; HANDLE hOwner; int x; int y; int cx; int cy; DWORD style; LPARAM lParam; } alias MDICREATESTRUCTA* LPMDICREATESTRUCTA; struct MDICREATESTRUCTW { LPCWSTR szClass; LPCWSTR szTitle; HANDLE hOwner; int x; int y; int cx; int cy; DWORD style; LPARAM lParam; } alias MDICREATESTRUCTW* LPMDICREATESTRUCTW; struct MINMAXINFO { POINT ptReserved; POINT ptMaxSize; POINT ptMaxPosition; POINT ptMinTrackSize; POINT ptMaxTrackSize; } alias MINMAXINFO* PMINMAXINFO, LPMINMAXINFO; struct MDINEXTMENU { HMENU hmenuIn; HMENU hmenuNext; HWND hwndNext; } alias MDINEXTMENU* PMDINEXTMENU, LPMDINEXTMENU; struct MEASUREITEMSTRUCT { UINT CtlType; UINT CtlID; UINT itemID; UINT itemWidth; UINT itemHeight; DWORD itemData; } alias MEASUREITEMSTRUCT* PMEASUREITEMSTRUCT, LPMEASUREITEMSTRUCT; struct DROPSTRUCT { HWND hwndSource; HWND hwndSink; DWORD wFmt; DWORD dwData; POINT ptDrop; DWORD dwControlData; } alias DROPSTRUCT* PDROPSTRUCT, LPDROPSTRUCT; alias DWORD HELPPOLY; struct MULTIKEYHELPA { DWORD mkSize; CHAR mkKeylist; CHAR[1] szKeyphrase; } alias MULTIKEYHELPA* PMULTIKEYHELPA, LPMULTIKEYHELPA; struct MULTIKEYHELPW { DWORD mkSize; WCHAR mkKeylist; WCHAR[1] szKeyphrase; } alias MULTIKEYHELPW* PMULTIKEYHELPW, LPMULTIKEYHELPW; struct HELPWININFOA { int wStructSize; int x; int y; int dx; int dy; int wMax; CHAR[2] rgchMember; } alias HELPWININFOA* PHELPWININFOA, LPHELPWININFOA; struct HELPWININFOW { int wStructSize; int x; int y; int dx; int dy; int wMax; WCHAR[2] rgchMember; } alias HELPWININFOW* PHELPWININFOW, LPHELPWININFOW; struct STYLESTRUCT { DWORD styleOld; DWORD styleNew; } alias STYLESTRUCT* LPSTYLESTRUCT; struct ALTTABINFO { DWORD cbSize = this.sizeof; int cItems; int cColumns; int cRows; int iColFocus; int iRowFocus; int cxItem; int cyItem; POINT ptStart; } alias ALTTABINFO* PALTTABINFO, LPALTTABINFO; struct COMBOBOXINFO { DWORD cbSize = this.sizeof; RECT rcItem; RECT rcButton; DWORD stateButton; HWND hwndCombo; HWND hwndItem; HWND hwndList; } alias COMBOBOXINFO* PCOMBOBOXINFO, LPCOMBOBOXINFO; struct CURSORINFO { DWORD cbSize = this.sizeof; DWORD flags; HCURSOR hCursor; POINT ptScreenPos; } alias CURSORINFO* PCURSORINFO, LPCURSORINFO; struct MENUBARINFO { DWORD cbSize = this.sizeof; RECT rcBar; HMENU hMenu; HWND hwndMenu; byte bf_; // Simulated bitfield // BOOL fBarFocused:1; // BOOL fFocused:1; bool fBarFocused() { return (bf_ & 1) == 1; } bool fFocused() { return (bf_ & 2) == 2; } bool fBarFocused(bool b) { bf_ = cast(byte) ((bf_ & 0xFE) | b); return b; } bool fFocused(bool b) { bf_ = cast(byte) (b ? (bf_ | 2) : bf_ & 0xFD); return b; } } alias MENUBARINFO* PMENUBARINFO; struct MENUINFO { DWORD cbSize = this.sizeof; DWORD fMask; DWORD dwStyle; UINT cyMax; HBRUSH hbrBack; DWORD dwContextHelpID; ULONG_PTR dwMenuData; } alias MENUINFO* LPMENUINFO; alias const(MENUINFO)* LPCMENUINFO; enum CCHILDREN_SCROLLBAR = 5; struct SCROLLBARINFO { DWORD cbSize = this.sizeof; RECT rcScrollBar; int dxyLineButton; int xyThumbTop; int xyThumbBottom; int reserved; DWORD[CCHILDREN_SCROLLBAR+1] rgstate; } alias SCROLLBARINFO* PSCROLLBARINFO, LPSCROLLBARINFO; enum CCHILDREN_TITLEBAR = 5; struct WINDOWINFO { DWORD cbSize = WINDOWINFO.sizeof; RECT rcWindow; RECT rcClient; DWORD dwStyle; DWORD dwExStyle; DWORD dwWindowStatus; UINT cxWindowBorders; UINT cyWindowBorders; ATOM atomWindowType; WORD wCreatorVersion; } alias WINDOWINFO* PWINDOWINFO, LPWINDOWINFO; struct LASTINPUTINFO { UINT cbSize = this.sizeof; DWORD dwTime; } alias LASTINPUTINFO* PLASTINPUTINFO; struct MONITORINFO { DWORD cbSize = this.sizeof; RECT rcMonitor; RECT rcWork; DWORD dwFlags; } alias MONITORINFO* LPMONITORINFO; enum CCHDEVICENAME = 32; struct MONITORINFOEXA { DWORD cbSize = MONITORINFOEXA.sizeof; RECT rcMonitor; RECT rcWork; DWORD dwFlags; CHAR[CCHDEVICENAME] szDevice; } alias MONITORINFOEXA* LPMONITORINFOEXA; struct MONITORINFOEXW { DWORD cbSize = MONITORINFOEXW.sizeof; RECT rcMonitor; RECT rcWork; DWORD dwFlags; WCHAR[CCHDEVICENAME] szDevice; } alias MONITORINFOEXW* LPMONITORINFOEXW; struct KBDLLHOOKSTRUCT { DWORD vkCode; DWORD scanCode; DWORD flags; DWORD time; DWORD dwExtraInfo; } alias KBDLLHOOKSTRUCT* LPKBDLLHOOKSTRUCT, PKBDLLHOOKSTRUCT; struct MSLLHOOKSTRUCT { POINT pt; DWORD mouseData; DWORD flags; DWORD time; ULONG_PTR dwExtraInfo; } alias MSLLHOOKSTRUCT* PMSLLHOOKSTRUCT; struct MOUSEINPUT { LONG dx; LONG dy; DWORD mouseData; DWORD dwFlags; DWORD time; ULONG_PTR dwExtraInfo; } alias MOUSEINPUT* PMOUSEINPUT; struct KEYBDINPUT { WORD wVk; WORD wScan; DWORD dwFlags; DWORD time; ULONG_PTR dwExtraInfo; } alias KEYBDINPUT* PKEYBDINPUT; struct HARDWAREINPUT { DWORD uMsg; WORD wParamL; WORD wParamH; } alias HARDWAREINPUT* PHARDWAREINPUT; struct INPUT { DWORD type; union { MOUSEINPUT mi; KEYBDINPUT ki; HARDWAREINPUT hi; } } alias INPUT* PINPUT, LPINPUT; static if (_WIN32_WINNT >= 0x501) { struct BSMINFO { UINT cbSize = this.sizeof; HDESK hdesk; HWND hwnd; LUID luid; } alias BSMINFO* PBSMINFO; alias TypeDef!(HANDLE) HRAWINPUT; struct RAWINPUTHEADER { DWORD dwType; DWORD dwSize; HANDLE hDevice; WPARAM wParam; } alias RAWINPUTHEADER* PRAWINPUTHEADER; struct RAWMOUSE { USHORT usFlags; union { ULONG ulButtons; struct { USHORT usButtonFlags; USHORT usButtonData; } } ULONG ulRawButtons; LONG lLastX; LONG lLastY; ULONG ulExtraInformation; } alias RAWMOUSE* PRAWMOUSE, LPRAWMOUSE; struct RAWKEYBOARD { USHORT MakeCode; USHORT Flags; USHORT Reserved; USHORT VKey; UINT Message; ULONG ExtraInformation; } alias RAWKEYBOARD* PRAWKEYBOARD, LPRAWKEYBOARD; struct RAWHID { DWORD dwSizeHid; DWORD dwCount; BYTE bRawData; } alias RAWHID* PRAWHID, LPRAWHID; struct RAWINPUT { RAWINPUTHEADER header; union _data { RAWMOUSE mouse; RAWKEYBOARD keyboard; RAWHID hid; } _data data; } alias RAWINPUT* PRAWINPUT, LPRAWINPUT; struct RAWINPUTDEVICE { USHORT usUsagePage; USHORT usUsage; DWORD dwFlags; HWND hwndTarget; } alias RAWINPUTDEVICE* PRAWINPUTDEVICE, LPRAWINPUTDEVICE; alias const(RAWINPUTDEVICE)* PCRAWINPUTDEVICE; struct RAWINPUTDEVICELIST { HANDLE hDevice; DWORD dwType; } alias RAWINPUTDEVICELIST* PRAWINPUTDEVICELIST; struct RID_DEVICE_INFO_MOUSE { DWORD dwId; DWORD dwNumberOfButtons; DWORD dwSampleRate; BOOL fHasHorizontalWheel; } struct RID_DEVICE_INFO_KEYBOARD { DWORD dwType; DWORD dwSubType; DWORD dwKeyboardMode; DWORD dwNumberOfFunctionKeys; DWORD dwNumberOfIndicators; DWORD dwNumberOfKeysTotal; } struct RID_DEVICE_INFO_HID { DWORD dwVendorId; DWORD dwProductId; DWORD dwVersionNumber; USHORT usUsagePage; USHORT usUsage; } struct RID_DEVICE_INFO { DWORD cbSize = this.sizeof; DWORD dwType; union { RID_DEVICE_INFO_MOUSE mouse; RID_DEVICE_INFO_KEYBOARD keyboard; RID_DEVICE_INFO_HID hid; } } }// (_WIN32_WINNT >= 0x501) alias CharToOemA AnsiToOem; alias OemToCharA OemToAnsi; alias CharToOemBuffA AnsiToOemBuff; alias OemToCharBuffA OemToAnsiBuff; alias CharUpperA AnsiUpper; alias CharUpperBuffA AnsiUpperBuff; alias CharLowerA AnsiLower; alias CharLowerBuffA AnsiLowerBuff; alias CharNextA AnsiNext; alias CharPrevA AnsiPrev; alias MAKELONG MAKEWPARAM; alias MAKELONG MAKELPARAM; alias MAKELONG MAKELRESULT; void POINTSTOPOINT()(out POINT p, LONG ps) { p.x = LOWORD(ps); p.y = HIWORD(ps); } POINTS POINTTOPOINTS()(in POINT p) { return MAKELONG(p.x, p.y); } extern (Windows) nothrow @nogc { HKL ActivateKeyboardLayout(HKL, UINT); BOOL AdjustWindowRect(LPRECT, DWORD, BOOL); BOOL AdjustWindowRectEx(LPRECT, DWORD, BOOL, DWORD); BOOL AnyPopup(); BOOL AppendMenuA(HMENU, UINT, UINT_PTR, LPCSTR); BOOL AppendMenuW(HMENU, UINT, UINT_PTR, LPCWSTR); UINT ArrangeIconicWindows(HWND); BOOL AttachThreadInput(DWORD, DWORD, BOOL); HDWP BeginDeferWindowPos(int); HDC BeginPaint(HWND, LPPAINTSTRUCT); BOOL BringWindowToTop(HWND); BOOL CallMsgFilterA(LPMSG, INT); BOOL CallMsgFilterW(LPMSG, INT); LRESULT CallNextHookEx(HHOOK, int, WPARAM, LPARAM); LRESULT CallWindowProcA(WNDPROC, HWND, UINT, WPARAM, LPARAM); LRESULT CallWindowProcW(WNDPROC, HWND, UINT, WPARAM, LPARAM); WORD CascadeWindows(HWND, UINT, LPCRECT, UINT, const(HWND)*); BOOL ChangeClipboardChain(HWND, HWND); LONG ChangeDisplaySettingsA(PDEVMODEA, DWORD); LONG ChangeDisplaySettingsW(PDEVMODEW, DWORD); LONG ChangeDisplaySettingsExA(LPCSTR, LPDEVMODEA, HWND, DWORD, LPVOID); LONG ChangeDisplaySettingsExW(LPCWSTR, LPDEVMODEW, HWND, DWORD, LPVOID); BOOL ChangeMenuA(HMENU, UINT, LPCSTR, UINT, UINT); BOOL ChangeMenuW(HMENU, UINT, LPCWSTR, UINT, UINT); LPSTR CharLowerA(LPSTR); LPWSTR CharLowerW(LPWSTR); DWORD CharLowerBuffA(LPSTR, DWORD); DWORD CharLowerBuffW(LPWSTR, DWORD); LPSTR CharNextA(LPCSTR); LPWSTR CharNextW(LPCWSTR); LPSTR CharNextExA(WORD, LPCSTR, DWORD); LPWSTR CharNextExW(WORD, LPCWSTR, DWORD); LPSTR CharPrevA(LPCSTR, LPCSTR); LPWSTR CharPrevW(LPCWSTR, LPCWSTR); LPSTR CharPrevExA(WORD, LPCSTR, LPCSTR, DWORD); LPWSTR CharPrevExW(WORD, LPCWSTR, LPCWSTR, DWORD); BOOL CharToOemA(LPCSTR, LPSTR); BOOL CharToOemW(LPCWSTR, LPSTR); BOOL CharToOemBuffA(LPCSTR, LPSTR, DWORD); BOOL CharToOemBuffW(LPCWSTR, LPSTR, DWORD); LPSTR CharUpperA(LPSTR); LPWSTR CharUpperW(LPWSTR); DWORD CharUpperBuffA(LPSTR, DWORD); DWORD CharUpperBuffW(LPWSTR, DWORD); BOOL CheckDlgButton(HWND, int, UINT); DWORD CheckMenuItem(HMENU, UINT, UINT); BOOL CheckMenuRadioItem(HMENU, UINT, UINT, UINT, UINT); BOOL CheckRadioButton(HWND, int, int, int); HWND ChildWindowFromPoint(HWND, POINT); HWND ChildWindowFromPointEx(HWND, POINT, UINT); BOOL ClientToScreen(HWND, LPPOINT); BOOL ClipCursor(LPCRECT); BOOL CloseClipboard(); BOOL CloseDesktop(HDESK); BOOL CloseWindow(HWND); BOOL CloseWindowStation(HWINSTA); int CopyAcceleratorTableA(HACCEL, LPACCEL, int); int CopyAcceleratorTableW(HACCEL, LPACCEL, int); HICON CopyIcon(HICON); HANDLE CopyImage(HANDLE, UINT, int, int, UINT); BOOL CopyRect(LPRECT, LPCRECT); int CountClipboardFormats(); HACCEL CreateAcceleratorTableA(LPACCEL, int); HACCEL CreateAcceleratorTableW(LPACCEL, int); BOOL CreateCaret(HWND, HBITMAP, int, int); HCURSOR CreateCursor(HINSTANCE, int, int, int, int, PCVOID, PCVOID); HDESK CreateDesktopA(LPCSTR, LPCSTR, LPDEVMODEA, DWORD, ACCESS_MASK, LPSECURITY_ATTRIBUTES); HDESK CreateDesktopW(LPCWSTR, LPCWSTR, LPDEVMODEW, DWORD, ACCESS_MASK, LPSECURITY_ATTRIBUTES); HWND CreateDialogParamA(HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM); HWND CreateDialogParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM); HWND CreateDialogIndirectParamA(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM); HWND CreateDialogIndirectParamW(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM); HICON CreateIcon(HINSTANCE, int, int, BYTE, BYTE, const(BYTE)*, BYTE*); HICON CreateIconFromResource(PBYTE, DWORD, BOOL, DWORD); HICON CreateIconFromResourceEx(PBYTE, DWORD, BOOL, DWORD, int, int, UINT); HICON CreateIconIndirect(PICONINFO); HWND CreateMDIWindowA(LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HINSTANCE, LPARAM); HWND CreateMDIWindowW(LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HINSTANCE, LPARAM); HMENU CreateMenu(); HMENU CreatePopupMenu(); HWND CreateWindowExA(DWORD, LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID); HWND CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID); HWINSTA CreateWindowStationA(LPSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES); HWINSTA CreateWindowStationW(LPWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES); LRESULT DefDlgProcA(HWND, UINT, WPARAM, LPARAM); LRESULT DefDlgProcW(HWND, UINT, WPARAM, LPARAM); HDWP DeferWindowPos(HDWP, HWND, HWND, int, int, int, int, UINT); LRESULT DefFrameProcA(HWND, HWND, UINT, WPARAM, LPARAM); LRESULT DefFrameProcW(HWND, HWND, UINT, WPARAM, LPARAM); LRESULT DefMDIChildProcA(HWND, UINT, WPARAM, LPARAM); LRESULT DefMDIChildProcW(HWND, UINT, WPARAM, LPARAM); LRESULT DefWindowProcA(HWND, UINT, WPARAM, LPARAM); LRESULT DefWindowProcW(HWND, UINT, WPARAM, LPARAM); BOOL DeleteMenu(HMENU, UINT, UINT); BOOL DeregisterShellHookWindow(HWND); BOOL DestroyAcceleratorTable(HACCEL); BOOL DestroyCaret(); BOOL DestroyCursor(HCURSOR); BOOL DestroyIcon(HICON); BOOL DestroyMenu(HMENU); BOOL DestroyWindow(HWND); INT_PTR DialogBoxParamA(HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM); INT_PTR DialogBoxParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM); INT_PTR DialogBoxIndirectParamA(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM); INT_PTR DialogBoxIndirectParamW(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM); } // extern (Windows) nothrow @nogc { HCURSOR CopyCursor(HCURSOR c) { return cast(HCURSOR)CopyIcon(cast(HICON)c); } HWND CreateDialogA(HINSTANCE h, LPCSTR n, HWND w, DLGPROC f) { return CreateDialogParamA(h, n, w, f, 0); } HWND CreateDialogW(HINSTANCE h, LPCWSTR n, HWND w, DLGPROC f) { return CreateDialogParamW(h, n, w, f, 0); } HWND CreateDialogIndirectA(HINSTANCE h, LPCDLGTEMPLATE t, HWND w, DLGPROC f) { return CreateDialogIndirectParamA(h, t, w, f, 0); } HWND CreateDialogIndirectW(HINSTANCE h, LPCDLGTEMPLATE t, HWND w, DLGPROC f) { return CreateDialogIndirectParamW(h, t, w, f, 0); } HWND CreateWindowA(LPCSTR a, LPCSTR b, DWORD c, int d, int e, int f, int g, HWND h, HMENU i, HINSTANCE j, LPVOID k) { return CreateWindowExA(0, a, b, c, d, e, f, g, h, i, j, k); } HWND CreateWindowW(LPCWSTR a, LPCWSTR b, DWORD c, int d, int e, int f, int g, HWND h, HMENU i, HINSTANCE j, LPVOID k) { return CreateWindowExW(0, a, b, c, d, e, f, g, h, i, j, k); } INT_PTR DialogBoxA(HINSTANCE i, LPCSTR t, HWND p, DLGPROC f) { return DialogBoxParamA(i, t, p, f, 0); } INT_PTR DialogBoxW(HINSTANCE i, LPCWSTR t, HWND p, DLGPROC f) { return DialogBoxParamW(i, t, p, f, 0); } INT_PTR DialogBoxIndirectA(HINSTANCE i, LPCDLGTEMPLATE t, HWND p, DLGPROC f) { return DialogBoxIndirectParamA(i, t, p, f, 0); } INT_PTR DialogBoxIndirectW(HINSTANCE i, LPCDLGTEMPLATE t, HWND p, DLGPROC f) { return DialogBoxIndirectParamW(i, t, p, f, 0); } BOOL ExitWindows(UINT r, DWORD c) { return ExitWindowsEx(EWX_LOGOFF, 0); } } alias GetWindow GetNextWindow; extern (Windows) nothrow @nogc: LONG DispatchMessageA(const(MSG)*); LONG DispatchMessageW(const(MSG)*); int DlgDirListA(HWND, LPSTR, int, int, UINT); int DlgDirListW(HWND, LPWSTR, int, int, UINT); int DlgDirListComboBoxA(HWND, LPSTR, int, int, UINT); int DlgDirListComboBoxW(HWND, LPWSTR, int, int, UINT); BOOL DlgDirSelectComboBoxExA(HWND, LPSTR, int, int); BOOL DlgDirSelectComboBoxExW(HWND, LPWSTR, int, int); BOOL DlgDirSelectExA(HWND, LPSTR, int, int); BOOL DlgDirSelectExW(HWND, LPWSTR, int, int); BOOL DragDetect(HWND, POINT); DWORD DragObject(HWND, HWND, UINT, DWORD, HCURSOR); BOOL DrawAnimatedRects(HWND, int, LPCRECT, LPCRECT); BOOL DrawCaption(HWND, HDC, LPCRECT, UINT); BOOL DrawEdge(HDC, LPRECT, UINT, UINT); BOOL DrawFocusRect(HDC, LPCRECT); BOOL DrawFrameControl(HDC, LPRECT, UINT, UINT); BOOL DrawIcon(HDC, int, int, HICON); BOOL DrawIconEx(HDC, int, int, HICON, int, int, UINT, HBRUSH, UINT); BOOL DrawMenuBar(HWND); BOOL DrawStateA(HDC, HBRUSH, DRAWSTATEPROC, LPARAM, WPARAM, int, int, int, int, UINT); BOOL DrawStateW(HDC, HBRUSH, DRAWSTATEPROC, LPARAM, WPARAM, int, int, int, int, UINT); int DrawTextA(HDC, LPCSTR, int, LPRECT, UINT); int DrawTextW(HDC, LPCWSTR, int, LPRECT, UINT); int DrawTextExA(HDC, LPSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS); int DrawTextExW(HDC, LPWSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS); BOOL EmptyClipboard(); BOOL EnableMenuItem(HMENU, UINT, UINT); BOOL EnableScrollBar(HWND, UINT, UINT); BOOL EnableWindow(HWND, BOOL); BOOL EndDeferWindowPos(HDWP); BOOL EndDialog(HWND, INT_PTR); BOOL EndMenu(); BOOL EndPaint(HWND, const(PAINTSTRUCT)*); BOOL EnumChildWindows(HWND, ENUMWINDOWSPROC, LPARAM); UINT EnumClipboardFormats(UINT); BOOL EnumDesktopsA(HWINSTA, DESKTOPENUMPROCA, LPARAM); BOOL EnumDesktopsW(HWINSTA, DESKTOPENUMPROCW, LPARAM); BOOL EnumDesktopWindows(HDESK, ENUMWINDOWSPROC, LPARAM); BOOL EnumDisplaySettingsA(LPCSTR, DWORD, PDEVMODEA); BOOL EnumDisplaySettingsW(LPCWSTR, DWORD, PDEVMODEW); BOOL EnumDisplayDevicesA(LPCSTR, DWORD, PDISPLAY_DEVICEA, DWORD); BOOL EnumDisplayDevicesW(LPCWSTR, DWORD, PDISPLAY_DEVICEW, DWORD); int EnumPropsA(HWND, PROPENUMPROCA); int EnumPropsW(HWND, PROPENUMPROCW); int EnumPropsExA(HWND, PROPENUMPROCEXA, LPARAM); int EnumPropsExW(HWND, PROPENUMPROCEXW, LPARAM); BOOL EnumThreadWindows(DWORD, WNDENUMPROC, LPARAM); BOOL EnumWindows(WNDENUMPROC, LPARAM); BOOL EnumWindowStationsA(WINSTAENUMPROCA, LPARAM); BOOL EnumWindowStationsW(WINSTAENUMPROCW, LPARAM); BOOL EqualRect(LPCRECT, LPCRECT); BOOL ExitWindowsEx(UINT, DWORD); HWND FindWindowA(LPCSTR, LPCSTR); HWND FindWindowExA(HWND, HWND, LPCSTR, LPCSTR); HWND FindWindowExW(HWND, HWND, LPCWSTR, LPCWSTR); HWND FindWindowW(LPCWSTR, LPCWSTR); BOOL FlashWindow(HWND, BOOL); int FrameRect(HDC, LPCRECT, HBRUSH); BOOL FrameRgn(HDC, HRGN, HBRUSH, int, int); HWND GetActiveWindow(); HWND GetAncestor(HWND, UINT); SHORT GetAsyncKeyState(int); HWND GetCapture(); UINT GetCaretBlinkTime(); BOOL GetCaretPos(LPPOINT); BOOL GetClassInfoA(HINSTANCE, LPCSTR, LPWNDCLASSA); BOOL GetClassInfoExA(HINSTANCE, LPCSTR, LPWNDCLASSEXA); BOOL GetClassInfoW(HINSTANCE, LPCWSTR, LPWNDCLASSW); BOOL GetClassInfoExW(HINSTANCE, LPCWSTR, LPWNDCLASSEXW); DWORD GetClassLongA(HWND, int); DWORD GetClassLongW(HWND, int); int GetClassNameA(HWND, LPSTR, int); int GetClassNameW(HWND, LPWSTR, int); WORD GetClassWord(HWND, int); BOOL GetClientRect(HWND, LPRECT); HANDLE GetClipboardData(UINT); int GetClipboardFormatNameA(UINT, LPSTR, int); int GetClipboardFormatNameW(UINT, LPWSTR, int); HWND GetClipboardOwner(); HWND GetClipboardViewer(); BOOL GetClipCursor(LPRECT); BOOL GetCursorPos(LPPOINT); HDC GetDC(HWND); HDC GetDCEx(HWND, HRGN, DWORD); HWND GetDesktopWindow(); int GetDialogBaseUnits(); int GetDlgCtrlID(HWND); HWND GetDlgItem(HWND, int); UINT GetDlgItemInt(HWND, int, PBOOL, BOOL); UINT GetDlgItemTextA(HWND, int, LPSTR, int); UINT GetDlgItemTextW(HWND, int, LPWSTR, int); UINT GetDoubleClickTime(); HWND GetFocus(); HWND GetForegroundWindow(); BOOL GetIconInfo(HICON, PICONINFO); BOOL GetInputState(); UINT GetKBCodePage(); HKL GetKeyboardLayout(DWORD); UINT GetKeyboardLayoutList(int, HKL*); BOOL GetKeyboardLayoutNameA(LPSTR); BOOL GetKeyboardLayoutNameW(LPWSTR); BOOL GetKeyboardState(PBYTE); int GetKeyboardType(int); int GetKeyNameTextA(LONG, LPSTR, int); int GetKeyNameTextW(LONG, LPWSTR, int); SHORT GetKeyState(int); HWND GetLastActivePopup(HWND); HMENU GetMenu(HWND); LONG GetMenuCheckMarkDimensions(); DWORD GetMenuContextHelpId(HMENU); UINT GetMenuDefaultItem(HMENU, UINT, UINT); int GetMenuItemCount(HMENU); UINT GetMenuItemID(HMENU, int); BOOL GetMenuItemInfoA(HMENU, UINT, BOOL, LPMENUITEMINFOA); BOOL GetMenuItemInfoW(HMENU, UINT, BOOL, LPMENUITEMINFOW); BOOL GetMenuItemRect(HWND, HMENU, UINT, LPRECT); UINT GetMenuState(HMENU, UINT, UINT); int GetMenuStringA(HMENU, UINT, LPSTR, int, UINT); int GetMenuStringW(HMENU, UINT, LPWSTR, int, UINT); BOOL GetMessageA(LPMSG, HWND, UINT, UINT); BOOL GetMessageW(LPMSG, HWND, UINT, UINT); LONG GetMessageExtraInfo(); DWORD GetMessagePos(); LONG GetMessageTime(); HWND GetNextDlgGroupItem(HWND, HWND, BOOL); HWND GetNextDlgTabItem(HWND, HWND, BOOL); HWND GetOpenClipboardWindow(); HWND GetParent(HWND); int GetPriorityClipboardFormat(UINT*, int); HANDLE GetPropA(HWND, LPCSTR); HANDLE GetPropW(HWND, LPCWSTR); DWORD GetQueueStatus(UINT); BOOL GetScrollInfo(HWND, int, LPSCROLLINFO); int GetScrollPos(HWND, int); BOOL GetScrollRange(HWND, int, LPINT, LPINT); HMENU GetSubMenu(HMENU, int); DWORD GetSysColor(int); HBRUSH GetSysColorBrush(int); HMENU GetSystemMenu(HWND, BOOL); int GetSystemMetrics(int); DWORD GetTabbedTextExtentA(HDC, LPCSTR, int, int, LPINT); DWORD GetTabbedTextExtentW(HDC, LPCWSTR, int, int, LPINT); LONG GetWindowLongA(HWND, int); LONG GetWindowLongW(HWND, int); HDESK GetThreadDesktop(DWORD); HWND GetTopWindow(HWND); BOOL GetUpdateRect(HWND, LPRECT, BOOL); int GetUpdateRgn(HWND, HRGN, BOOL); BOOL GetUserObjectInformationA(HANDLE, int, PVOID, DWORD, PDWORD); BOOL GetUserObjectInformationW(HANDLE, int, PVOID, DWORD, PDWORD); BOOL GetUserObjectSecurity(HANDLE, PSECURITY_INFORMATION, PSECURITY_DESCRIPTOR, DWORD, PDWORD); HWND GetWindow(HWND, UINT); DWORD GetWindowContextHelpId(HWND); HDC GetWindowDC(HWND); BOOL GetWindowPlacement(HWND, WINDOWPLACEMENT*); BOOL GetWindowRect(HWND, LPRECT); int GetWindowRgn(HWND, HRGN); int GetWindowTextA(HWND, LPSTR, int); int GetWindowTextLengthA(HWND); int GetWindowTextLengthW(HWND); int GetWindowTextW(HWND, LPWSTR, int); WORD GetWindowWord(HWND, int); BOOL GetAltTabInfoA(HWND, int, PALTTABINFO, LPSTR, UINT); BOOL GetAltTabInfoW(HWND, int, PALTTABINFO, LPWSTR, UINT); BOOL GetComboBoxInfo(HWND, PCOMBOBOXINFO); BOOL GetCursorInfo(PCURSORINFO); BOOL GetLastInputInfo(PLASTINPUTINFO); DWORD GetListBoxInfo(HWND); BOOL GetMenuBarInfo(HWND, LONG, LONG, PMENUBARINFO); BOOL GetMenuInfo(HMENU, LPMENUINFO); BOOL GetScrollBarInfo(HWND, LONG, PSCROLLBARINFO); BOOL GetTitleBarInfo(HWND, PTITLEBARINFO); BOOL GetWindowInfo(HWND, PWINDOWINFO); UINT GetWindowModuleFileNameA(HWND, LPSTR, UINT); UINT GetWindowModuleFileNameW(HWND, LPWSTR, UINT); BOOL GrayStringA(HDC, HBRUSH, GRAYSTRINGPROC, LPARAM, int, int, int, int, int); BOOL GrayStringW(HDC, HBRUSH, GRAYSTRINGPROC, LPARAM, int, int, int, int, int); BOOL HideCaret(HWND); BOOL HiliteMenuItem(HWND, HMENU, UINT, UINT); BOOL InflateRect(LPRECT, int, int); BOOL InSendMessage(); BOOL InsertMenuA(HMENU, UINT, UINT, UINT_PTR, LPCSTR); BOOL InsertMenuW(HMENU, UINT, UINT, UINT_PTR, LPCWSTR); BOOL InsertMenuItemA(HMENU, UINT, BOOL, LPCMENUITEMINFOA); BOOL InsertMenuItemW(HMENU, UINT, BOOL, LPCMENUITEMINFOW); INT InternalGetWindowText(HWND, LPWSTR, INT); BOOL IntersectRect(LPRECT, LPCRECT, LPCRECT); BOOL InvalidateRect(HWND, LPCRECT, BOOL); BOOL InvalidateRgn(HWND, HRGN, BOOL); BOOL InvertRect(HDC, LPCRECT); BOOL IsCharAlphaA(CHAR ch); BOOL IsCharAlphaNumericA(CHAR); BOOL IsCharAlphaNumericW(WCHAR); BOOL IsCharAlphaW(WCHAR); BOOL IsCharLowerA(CHAR); BOOL IsCharLowerW(WCHAR); BOOL IsCharUpperA(CHAR); BOOL IsCharUpperW(WCHAR); BOOL IsChild(HWND, HWND); BOOL IsClipboardFormatAvailable(UINT); BOOL IsDialogMessageA(HWND, LPMSG); BOOL IsDialogMessageW(HWND, LPMSG); UINT IsDlgButtonChecked(HWND, int); BOOL IsIconic(HWND); BOOL IsMenu(HMENU); BOOL IsRectEmpty(LPCRECT); BOOL IsWindow(HWND); BOOL IsWindowEnabled(HWND); BOOL IsWindowUnicode(HWND); BOOL IsWindowVisible(HWND); BOOL IsZoomed(HWND); void keybd_event(BYTE, BYTE, DWORD, DWORD); BOOL KillTimer(HWND, UINT_PTR); HACCEL LoadAcceleratorsA(HINSTANCE, LPCSTR); HACCEL LoadAcceleratorsW(HINSTANCE, LPCWSTR); HBITMAP LoadBitmapA(HINSTANCE, LPCSTR); HBITMAP LoadBitmapW(HINSTANCE, LPCWSTR); HCURSOR LoadCursorA(HINSTANCE, LPCSTR); HCURSOR LoadCursorFromFileA(LPCSTR); HCURSOR LoadCursorFromFileW(LPCWSTR); HCURSOR LoadCursorW(HINSTANCE, LPCWSTR); HICON LoadIconA(HINSTANCE, LPCSTR); HICON LoadIconW(HINSTANCE, LPCWSTR); HANDLE LoadImageA(HINSTANCE, LPCSTR, UINT, int, int, UINT); HANDLE LoadImageW(HINSTANCE, LPCWSTR, UINT, int, int, UINT); HKL LoadKeyboardLayoutA(LPCSTR, UINT); HKL LoadKeyboardLayoutW(LPCWSTR, UINT); HMENU LoadMenuA(HINSTANCE, LPCSTR); HMENU LoadMenuIndirectA(const(MENUTEMPLATE)*); HMENU LoadMenuIndirectW(const(MENUTEMPLATE)*); HMENU LoadMenuW(HINSTANCE, LPCWSTR); int LoadStringA(HINSTANCE, UINT, LPSTR, int); int LoadStringW(HINSTANCE, UINT, LPWSTR, int); BOOL LockWindowUpdate(HWND); int LookupIconIdFromDirectory(PBYTE, BOOL); int LookupIconIdFromDirectoryEx(PBYTE, BOOL, int, int, UINT); BOOL MapDialogRect(HWND, LPRECT); UINT MapVirtualKeyA(UINT, UINT); UINT MapVirtualKeyExA(UINT, UINT, HKL); UINT MapVirtualKeyExW(UINT, UINT, HKL); UINT MapVirtualKeyW(UINT, UINT); int MapWindowPoints(HWND, HWND, LPPOINT, UINT); int MenuItemFromPoint(HWND, HMENU, POINT); BOOL MessageBeep(UINT); int MessageBoxA(HWND, LPCSTR, LPCSTR, UINT); int MessageBoxW(HWND, LPCWSTR, LPCWSTR, UINT); int MessageBoxExA(HWND, LPCSTR, LPCSTR, UINT, WORD); int MessageBoxExW(HWND, LPCWSTR, LPCWSTR, UINT, WORD); int MessageBoxIndirectA(const(MSGBOXPARAMSA)*); int MessageBoxIndirectW(const(MSGBOXPARAMSW)*); BOOL ModifyMenuA(HMENU, UINT, UINT, UINT_PTR, LPCSTR); BOOL ModifyMenuW(HMENU, UINT, UINT, UINT_PTR, LPCWSTR); void mouse_event(DWORD, DWORD, DWORD, DWORD, ULONG_PTR); BOOL MoveWindow(HWND, int, int, int, int, BOOL); DWORD MsgWaitForMultipleObjects(DWORD, const(HANDLE)*, BOOL, DWORD, DWORD); DWORD MsgWaitForMultipleObjectsEx(DWORD, const(HANDLE)*, DWORD, DWORD, DWORD); DWORD OemKeyScan(WORD); BOOL OemToCharA(LPCSTR, LPSTR); BOOL OemToCharBuffA(LPCSTR, LPSTR, DWORD); BOOL OemToCharBuffW(LPCSTR, LPWSTR, DWORD); BOOL OemToCharW(LPCSTR, LPWSTR); BOOL OffsetRect(LPRECT, int, int); BOOL OpenClipboard(HWND); HDESK OpenDesktopA(LPSTR, DWORD, BOOL, DWORD); HDESK OpenDesktopW(LPWSTR, DWORD, BOOL, DWORD); BOOL OpenIcon(HWND); HDESK OpenInputDesktop(DWORD, BOOL, DWORD); HWINSTA OpenWindowStationA(LPSTR, BOOL, DWORD); HWINSTA OpenWindowStationW(LPWSTR, BOOL, DWORD); BOOL PaintDesktop(HDC); BOOL PeekMessageA(LPMSG, HWND, UINT, UINT, UINT); BOOL PeekMessageW(LPMSG, HWND, UINT, UINT, UINT); BOOL PostMessageA(HWND, UINT, WPARAM, LPARAM); BOOL PostMessageW(HWND, UINT, WPARAM, LPARAM); void PostQuitMessage(int); BOOL PostThreadMessageA(DWORD, UINT, WPARAM, LPARAM); BOOL PostThreadMessageW(DWORD, UINT, WPARAM, LPARAM); BOOL PtInRect(LPCRECT, POINT); HWND RealChildWindowFromPoint(HWND, POINT); UINT RealGetWindowClassA(HWND, LPSTR, UINT); UINT RealGetWindowClassW(HWND, LPWSTR, UINT); BOOL RedrawWindow(HWND, LPCRECT, HRGN, UINT); ATOM RegisterClassA(const(WNDCLASSA)*); ATOM RegisterClassW(const(WNDCLASSW)*); ATOM RegisterClassExA(const(WNDCLASSEXA)*); ATOM RegisterClassExW(const(WNDCLASSEXW)*); UINT RegisterClipboardFormatA(LPCSTR); UINT RegisterClipboardFormatW(LPCWSTR); BOOL RegisterHotKey(HWND, int, UINT, UINT); UINT RegisterWindowMessageA(LPCSTR); UINT RegisterWindowMessageW(LPCWSTR); BOOL ReleaseCapture(); int ReleaseDC(HWND, HDC); BOOL RemoveMenu(HMENU, UINT, UINT); HANDLE RemovePropA(HWND, LPCSTR); HANDLE RemovePropW(HWND, LPCWSTR); BOOL ReplyMessage(LRESULT); BOOL ScreenToClient(HWND, LPPOINT); BOOL ScrollDC(HDC, int, int, LPCRECT, LPCRECT, HRGN, LPRECT); BOOL ScrollWindow(HWND, int, int, LPCRECT, LPCRECT); int ScrollWindowEx(HWND, int, int, LPCRECT, LPCRECT, HRGN, LPRECT, UINT); LONG SendDlgItemMessageA(HWND, int, UINT, WPARAM, LPARAM); LONG SendDlgItemMessageW(HWND, int, UINT, WPARAM, LPARAM); LRESULT SendMessageA(HWND, UINT, WPARAM, LPARAM); BOOL SendMessageCallbackA(HWND, UINT, WPARAM, LPARAM, SENDASYNCPROC, DWORD); BOOL SendMessageCallbackW(HWND, UINT, WPARAM, LPARAM, SENDASYNCPROC, DWORD); LRESULT SendMessageTimeoutA(HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD); LRESULT SendMessageTimeoutW(HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD); LRESULT SendMessageW(HWND, UINT, WPARAM, LPARAM); BOOL SendNotifyMessageA(HWND, UINT, WPARAM, LPARAM); BOOL SendNotifyMessageW(HWND, UINT, WPARAM, LPARAM); HWND SetActiveWindow(HWND); HWND SetCapture(HWND hWnd); BOOL SetCaretBlinkTime(UINT); BOOL SetCaretPos(int, int); DWORD SetClassLongA(HWND, int, LONG); DWORD SetClassLongW(HWND, int, LONG); WORD SetClassWord(HWND, int, WORD); HANDLE SetClipboardData(UINT, HANDLE); HWND SetClipboardViewer(HWND); HCURSOR SetCursor(HCURSOR); BOOL SetCursorPos(int, int); void SetDebugErrorLevel(DWORD); BOOL SetDlgItemInt(HWND, int, UINT, BOOL); BOOL SetDlgItemTextA(HWND, int, LPCSTR); BOOL SetDlgItemTextW(HWND, int, LPCWSTR); BOOL SetDoubleClickTime(UINT); HWND SetFocus(HWND); BOOL SetForegroundWindow(HWND); BOOL SetKeyboardState(PBYTE); BOOL SetMenu(HWND, HMENU); BOOL SetMenuContextHelpId(HMENU, DWORD); BOOL SetMenuDefaultItem(HMENU, UINT, UINT); BOOL SetMenuInfo(HMENU, LPCMENUINFO); BOOL SetMenuItemBitmaps(HMENU, UINT, UINT, HBITMAP, HBITMAP); BOOL SetMenuItemInfoA(HMENU, UINT, BOOL, LPCMENUITEMINFOA); BOOL SetMenuItemInfoW(HMENU, UINT, BOOL, LPCMENUITEMINFOW); LPARAM SetMessageExtraInfo(LPARAM); BOOL SetMessageQueue(int); HWND SetParent(HWND, HWND); BOOL SetProcessWindowStation(HWINSTA); BOOL SetPropA(HWND, LPCSTR, HANDLE); BOOL SetPropW(HWND, LPCWSTR, HANDLE); BOOL SetRect(LPRECT, int, int, int, int); BOOL SetRectEmpty(LPRECT); int SetScrollInfo(HWND, int, LPCSCROLLINFO, BOOL); int SetScrollPos(HWND, int, int, BOOL); BOOL SetScrollRange(HWND, int, int, int, BOOL); BOOL SetSysColors(int, const(INT)*, const(COLORREF)*); BOOL SetSystemCursor(HCURSOR, DWORD); BOOL SetThreadDesktop(HDESK); UINT_PTR SetTimer(HWND, UINT_PTR, UINT, TIMERPROC); BOOL SetUserObjectInformationA(HANDLE, int, PVOID, DWORD); BOOL SetUserObjectInformationW(HANDLE, int, PVOID, DWORD); BOOL SetUserObjectSecurity(HANDLE, PSECURITY_INFORMATION, PSECURITY_DESCRIPTOR); BOOL SetWindowContextHelpId(HWND, DWORD); LONG SetWindowLongA(HWND, int, LONG); LONG SetWindowLongW(HWND, int, LONG); BOOL SetWindowPlacement(HWND hWnd, const(WINDOWPLACEMENT)*); BOOL SetWindowPos(HWND, HWND, int, int, int, int, UINT); int SetWindowRgn(HWND, HRGN, BOOL); HHOOK SetWindowsHookA(int, HOOKPROC); HHOOK SetWindowsHookW(int, HOOKPROC); HHOOK SetWindowsHookExA(int, HOOKPROC, HINSTANCE, DWORD); HHOOK SetWindowsHookExW(int, HOOKPROC, HINSTANCE, DWORD); BOOL SetWindowTextA(HWND, LPCSTR); BOOL SetWindowTextW(HWND, LPCWSTR); WORD SetWindowWord(HWND, int, WORD); BOOL ShowCaret(HWND); int ShowCursor(BOOL); BOOL ShowOwnedPopups(HWND, BOOL); BOOL ShowScrollBar(HWND, int, BOOL); BOOL ShowWindow(HWND, int); BOOL ShowWindowAsync(HWND, int); BOOL SubtractRect(LPRECT, LPCRECT, LPCRECT); BOOL SwapMouseButton(BOOL); BOOL SwitchDesktop(HDESK); BOOL SystemParametersInfoA(UINT, UINT, PVOID, UINT); BOOL SystemParametersInfoW(UINT, UINT, PVOID, UINT); LONG TabbedTextOutA(HDC, int, int, LPCSTR, int, int, LPINT, int); LONG TabbedTextOutW(HDC, int, int, LPCWSTR, int, int, LPINT, int); WORD TileWindows(HWND, UINT, LPCRECT, UINT, const(HWND)*); int ToAscii(UINT, UINT, PBYTE, LPWORD, UINT); int ToAsciiEx(UINT, UINT, PBYTE, LPWORD, UINT, HKL); int ToUnicode(UINT, UINT, PBYTE, LPWSTR, int, UINT); int ToUnicodeEx(UINT, UINT, PBYTE, LPWSTR, int, UINT, HKL); BOOL TrackMouseEvent(LPTRACKMOUSEEVENT); BOOL TrackPopupMenu(HMENU, UINT, int, int, int, HWND, LPCRECT); BOOL TrackPopupMenuEx(HMENU, UINT, int, int, HWND, LPTPMPARAMS); int TranslateAcceleratorA(HWND, HACCEL, LPMSG); int TranslateAcceleratorW(HWND, HACCEL, LPMSG); BOOL TranslateMDISysAccel(HWND, LPMSG); BOOL TranslateMessage(const(MSG)*); BOOL UnhookWindowsHook(int, HOOKPROC); BOOL UnhookWindowsHookEx(HHOOK); BOOL UnionRect(LPRECT, LPCRECT, LPCRECT); BOOL UnloadKeyboardLayout(HKL); BOOL UnregisterClassA(LPCSTR, HINSTANCE); BOOL UnregisterClassW(LPCWSTR, HINSTANCE); BOOL UnregisterHotKey(HWND, int); BOOL UpdateWindow(HWND); BOOL ValidateRect(HWND, LPCRECT); BOOL ValidateRgn(HWND, HRGN); SHORT VkKeyScanA(CHAR); SHORT VkKeyScanExA(CHAR, HKL); SHORT VkKeyScanExW(WCHAR, HKL); SHORT VkKeyScanW(WCHAR); DWORD WaitForInputIdle(HANDLE, DWORD); BOOL WaitMessage(); HWND WindowFromDC(HDC hDC); HWND WindowFromPoint(POINT); UINT WinExec(LPCSTR, UINT); BOOL WinHelpA(HWND, LPCSTR, UINT, DWORD); BOOL WinHelpW(HWND, LPCWSTR, UINT, DWORD); extern (C) { int wsprintfA(LPSTR, LPCSTR, ...); int wsprintfW(LPWSTR, LPCWSTR, ...); } // These shouldn't be necessary for D. alias TypeDef!(char*) va_list_; int wvsprintfA(LPSTR, LPCSTR, va_list_ arglist); int wvsprintfW(LPWSTR, LPCWSTR, va_list_ arglist); enum : DWORD { MONITOR_DEFAULTTONULL, MONITOR_DEFAULTTOPRIMARY, MONITOR_DEFAULTTONEAREST // = 2 } enum MONITORINFOF_PRIMARY = 1; enum EDS_RAWMODE = 0x00000002; enum { ISMEX_NOSEND = 0, ISMEX_SEND = 1, ISMEX_NOTIFY = 2, ISMEX_CALLBACK = 4, ISMEX_REPLIED = 8 } struct TITLEBARINFO { DWORD cbSize = TITLEBARINFO.sizeof; RECT rcTitleBar; DWORD[CCHILDREN_TITLEBAR+1] rgstate; } alias TITLEBARINFO* PTITLEBARINFO, LPTITLEBARINFO; static if (_WIN32_WINNT >= 0x501) { // *** correct? struct FLASHWINFO { UINT cbSize = this.sizeof; HWND hwnd; DWORD dwFlags; UINT uCount; DWORD dwTimeout; } alias FLASHWINFO* PFLASHWINFO; } enum DWORD ASFW_ANY = -1; enum : UINT { LSFW_LOCK = 1, LSFW_UNLOCK } enum { GMMP_USE_DISPLAY_POINTS = 1, GMMP_USE_HIGH_RESOLUTION_POINTS } struct MOUSEMOVEPOINT { int x; int y; DWORD time; ULONG_PTR dwExtraInfo; } alias MOUSEMOVEPOINT* PMOUSEMOVEPOINT, LPMOUSEMOVEPOINT; enum { MIM_MAXHEIGHT = 1, MIM_BACKGROUND = 2, MIM_HELPID = 4, MIM_MENUDATA = 8, MIM_STYLE = 16, MIM_APPLYTOSUBMENUS = 0x80000000L } enum { MNS_NOCHECK = 0x80000000, MNS_MODELESS = 0x40000000, MNS_DRAGDROP = 0x20000000, MNS_AUTODISMISS = 0x10000000, MNS_NOTIFYBYPOS = 0x08000000, MNS_CHECKORBMP = 0x04000000 } enum { PM_QS_INPUT = (QS_INPUT << 16), PM_QS_POSTMESSAGE = ((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16), PM_QS_PAINT = (QS_PAINT << 16), PM_QS_SENDMESSAGE = (QS_SENDMESSAGE << 16) } /* #define WM_GETOBJECT 0x003D #define WM_CHANGEUISTATE 0x0127 #define WM_UPDATEUISTATE 0x0128 #define WM_QUERYUISTATE 0x0129 #define WM_UNINITMENUPOPUP 0x0125 #define WM_MENURBUTTONUP 290 #define WM_MENUCOMMAND 0x0126 #define WM_MENUGETOBJECT 0x0124 #define WM_MENUDRAG 0x0123 #define WM_APPCOMMAND 0x0319 #define WM_NCXBUTTONDOWN 171 #define WM_NCXBUTTONUP 172 #define WM_NCXBUTTONDBLCLK 173 #define WM_NCMOUSEHOVER 0x02A0 #define WM_NCMOUSELEAVE 0x02A2*/ enum { FLASHW_STOP = 0, FLASHW_CAPTION = 0x01, FLASHW_TRAY = 0x02, FLASHW_ALL = 0x03, FLASHW_TIMER = 0x04, FLASHW_TIMERNOFG = 0x0C } enum CHILDID_SELF = 0; enum { OBJID_WINDOW = 0x00000000, OBJID_SOUND = 0xFFFFFFF5, OBJID_ALERT = 0xFFFFFFF6, OBJID_CURSOR = 0xFFFFFFF7, OBJID_CARET = 0xFFFFFFF8, OBJID_SIZEGRIP = 0xFFFFFFF9, OBJID_HSCROLL = 0xFFFFFFFA, OBJID_VSCROLL = 0xFFFFFFFB, OBJID_CLIENT = 0xFFFFFFFC, OBJID_MENU = 0xFFFFFFFD, OBJID_TITLEBAR = 0xFFFFFFFE, OBJID_SYSMENU = 0xFFFFFFFF } enum { GUI_CARETBLINKING = 0x0001, GUI_INMOVESIZE = 0x0002, GUI_INMENUMODE = 0x0004, GUI_SYSTEMMENUMODE = 0x0008, GUI_POPUPMENUMODE = 0x0010 } static if (_WIN32_WINNT >= 0x501) { enum GUI_16BITTASK = 0x0020; } enum { WINEVENT_OUTOFCONTEXT = 0x00, WINEVENT_SKIPOWNTHREAD = 0x01, WINEVENT_SKIPOWNPROCESS = 0x02, WINEVENT_INCONTEXT = 0x04 } enum { AW_HOR_POSITIVE = 0x00000001, AW_HOR_NEGATIVE = 0x00000002, AW_VER_POSITIVE = 0x00000004, AW_VER_NEGATIVE = 0x00000008, AW_CENTER = 0x00000010, AW_HIDE = 0x00010000, AW_ACTIVATE = 0x00020000, AW_SLIDE = 0x00040000, AW_BLEND = 0x00080000 } enum { DEVICE_NOTIFY_WINDOW_HANDLE = 0x00000000, DEVICE_NOTIFY_SERVICE_HANDLE = 0x00000001 } static if (_WIN32_WINNT >= 0x501) { enum DEVICE_NOTIFY_ALL_INTERFACE_CLASSES = 0x00000004; } enum : DWORD { EVENT_MIN = 0x00000001, EVENT_SYSTEM_SOUND = 0x00000001, EVENT_SYSTEM_ALERT, EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_MENUSTART, EVENT_SYSTEM_MENUEND, EVENT_SYSTEM_MENUPOPUPSTART, EVENT_SYSTEM_MENUPOPUPEND, EVENT_SYSTEM_CAPTURESTART, EVENT_SYSTEM_CAPTUREEND, EVENT_SYSTEM_MOVESIZESTART, EVENT_SYSTEM_MOVESIZEEND, EVENT_SYSTEM_CONTEXTHELPSTART, EVENT_SYSTEM_CONTEXTHELPEND, EVENT_SYSTEM_DRAGDROPSTART, EVENT_SYSTEM_DRAGDROPEND, EVENT_SYSTEM_DIALOGSTART, EVENT_SYSTEM_DIALOGEND, EVENT_SYSTEM_SCROLLINGSTART, EVENT_SYSTEM_SCROLLINGEND, EVENT_SYSTEM_SWITCHSTART, EVENT_SYSTEM_SWITCHEND, EVENT_SYSTEM_MINIMIZESTART, EVENT_SYSTEM_MINIMIZEEND, // = 0x00000017 EVENT_OBJECT_CREATE = 0x00008000, EVENT_OBJECT_DESTROY, EVENT_OBJECT_SHOW, EVENT_OBJECT_HIDE, EVENT_OBJECT_REORDER, EVENT_OBJECT_FOCUS, EVENT_OBJECT_SELECTION, EVENT_OBJECT_SELECTIONADD, EVENT_OBJECT_SELECTIONREMOVE, EVENT_OBJECT_SELECTIONWITHIN, EVENT_OBJECT_STATECHANGE, EVENT_OBJECT_LOCATIONCHANGE, EVENT_OBJECT_NAMECHANGE, EVENT_OBJECT_DESCRIPTIONCHANGE, EVENT_OBJECT_VALUECHANGE, EVENT_OBJECT_PARENTCHANGE, EVENT_OBJECT_HELPCHANGE, EVENT_OBJECT_DEFACTIONCHANGE, EVENT_OBJECT_ACCELERATORCHANGE, // = 0x00008012 EVENT_MAX = 0x7FFFFFFF } static if (_WIN32_WINNT >= 0x501) { enum : DWORD { EVENT_CONSOLE_CARET = 0x00004000, EVENT_CONSOLE_UPDATE_REGION, EVENT_CONSOLE_UPDATE_SIMPLE, EVENT_CONSOLE_UPDATE_SCROLL, EVENT_CONSOLE_LAYOUT, EVENT_CONSOLE_START_APPLICATION, EVENT_CONSOLE_END_APPLICATION, // = 0x00004007 } enum : LONG { CONSOLE_CARET_SELECTION = 1, CONSOLE_CARET_VISIBLE // = 2 } enum LONG CONSOLE_APPLICATION_16BIT = 1; } enum { LWA_COLORKEY = 1, LWA_ALPHA } enum { ULW_COLORKEY = 1, ULW_ALPHA = 2, ULW_OPAQUE = 4 } enum { GR_GDIOBJECTS, GR_USEROBJECTS } enum { XBUTTON1 = 1, XBUTTON2 } struct GUITHREADINFO { DWORD cbSize = this.sizeof; DWORD flags; HWND hwndActive; HWND hwndFocus; HWND hwndCapture; HWND hwndMenuOwner; HWND hwndMoveSize; HWND hwndCaret; RECT rcCaret; } alias GUITHREADINFO* PGUITHREADINFO, LPGUITHREADINFO; extern (Windows) { alias void function(HWINEVENTHOOK, DWORD, HWND, LONG, LONG, DWORD, DWORD) WINEVENTPROC; } // *** line 4680 of MinGW 4.0 int BroadcastSystemMessageA(DWORD, LPDWORD, UINT, WPARAM, LPARAM); int BroadcastSystemMessageW(DWORD, LPDWORD, UINT, WPARAM, LPARAM); UINT SendInput(UINT, LPINPUT, int); BOOL EnumDisplayMonitors(HDC, LPCRECT, MONITORENUMPROC, LPARAM); BOOL GetMonitorInfoA(HMONITOR, LPMONITORINFO); BOOL GetMonitorInfoW(HMONITOR, LPMONITORINFO); HMONITOR MonitorFromPoint(POINT, DWORD); HMONITOR MonitorFromRect(LPCRECT, DWORD); HMONITOR MonitorFromWindow(HWND, DWORD); BOOL AllowSetForegroundWindow(DWORD); BOOL AnimateWindow(HWND, DWORD, DWORD); BOOL EndTask(HWND, BOOL, BOOL); BOOL EnumDisplaySettingsExA(LPCSTR, DWORD, LPDEVMODEA, DWORD); BOOL EnumDisplaySettingsExW(LPCWSTR, DWORD, LPDEVMODEW, DWORD); DWORD GetClipboardSequenceNumber(); DWORD GetGuiResources(HANDLE, DWORD); BOOL GetGUIThreadInfo(DWORD, LPGUITHREADINFO); int GetMouseMovePointsEx(UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEPOINT, int, DWORD); BOOL GetProcessDefaultLayout(DWORD*); HWND GetShellWindow(); BOOL IsHungAppWindow(HWND); DWORD InSendMessageEx(LPVOID); BOOL LockSetForegroundWindow(UINT); BOOL LockWorkStation(); void NotifyWinEvent(DWORD, HWND, LONG, LONG); HDEVNOTIFY RegisterDeviceNotificationA(HANDLE, LPVOID, DWORD); HDEVNOTIFY RegisterDeviceNotificationW(HANDLE, LPVOID, DWORD); BOOL SetProcessDefaultLayout(DWORD); HWINEVENTHOOK SetWinEventHook(UINT, UINT, HMODULE, WINEVENTPROC, DWORD, DWORD, UINT); void SwitchToThisWindow(HWND, BOOL); BOOL SetLayeredWindowAttributes(HWND, COLORREF, BYTE, DWORD); BOOL UpdateLayeredWindow(HWND, HDC, POINT*, SIZE*, HDC, POINT*, COLORREF, BLENDFUNCTION*, DWORD); BOOL UserHandleGrantAccess(HANDLE, HANDLE, BOOL); BOOL UnhookWinEvent(HWINEVENTHOOK); BOOL UnregisterDeviceNotification(HANDLE); static if (_WIN32_WINNT >= 0x501) { int BroadcastSystemMessageExA(DWORD, LPDWORD, UINT, WPARAM, LPARAM, PBSMINFO); int BroadcastSystemMessageExW(DWORD, LPDWORD, UINT, WPARAM, LPARAM, PBSMINFO); LRESULT DefRawInputProc(PRAWINPUT*, INT, UINT); BOOL FlashWindowEx(PFLASHWINFO); BOOL GetLayeredWindowAttributes(HWND, COLORREF*, BYTE*, DWORD*); UINT GetRawInputBuffer(PRAWINPUT, PUINT, UINT); UINT GetRawInputData(HRAWINPUT, UINT, LPVOID, PUINT, UINT); UINT GetRawInputDeviceInfoA(HANDLE, UINT, LPVOID, PUINT); UINT GetRawInputDeviceInfoW(HANDLE, UINT, LPVOID, PUINT); UINT GetRawInputDeviceList(PRAWINPUTDEVICELIST, PUINT, UINT); UINT GetRegisteredRawInputDevices(PRAWINPUTDEVICE, PUINT, UINT); BOOL IsGUIThread(BOOL); BOOL IsWinEventHookInstalled(DWORD); BOOL PrintWindow(HWND, HDC, UINT); BOOL RegisterRawInputDevices(PCRAWINPUTDEVICE, UINT, UINT); } version (Win64) { LONG_PTR GetWindowLongPtrA(HWND, int); LONG_PTR GetWindowLongPtrW(HWND, int); LONG_PTR SetWindowLongPtrA(HWND, int, LONG_PTR); LONG_PTR SetWindowLongPtrW(HWND, int, LONG_PTR); } else { alias GetWindowLongA GetWindowLongPtrA; alias GetWindowLongW GetWindowLongPtrW; alias SetWindowLongA SetWindowLongPtrA; alias SetWindowLongW SetWindowLongPtrW; } // ----- // Aliases for Unicode or Ansi version(Unicode) { alias EDITWORDBREAKPROCW EDITWORDBREAKPROC; alias PROPENUMPROCW PROPENUMPROC; alias PROPENUMPROCEXW PROPENUMPROCEX; alias DESKTOPENUMPROCW DESKTOPENUMPROC; alias WINSTAENUMPROCW WINSTAENUMPROC; alias MAKEINTRESOURCEW MAKEINTRESOURCE; alias WNDCLASSW WNDCLASS; alias WNDCLASSEXW WNDCLASSEX; alias MENUITEMINFOW MENUITEMINFO; alias LPCMENUITEMINFOW LPCMENUITEMINFO; alias MSGBOXPARAMSW MSGBOXPARAMS; alias HIGHCONTRASTW HIGHCONTRAST; alias SERIALKEYSW SERIALKEYS; alias SOUNDSENTRYW SOUNDSENTRY; alias CREATESTRUCTW CREATESTRUCT; alias CBT_CREATEWNDW CBT_CREATEWND; alias MDICREATESTRUCTW MDICREATESTRUCT; alias MULTIKEYHELPW MULTIKEYHELP; alias MONITORINFOEXW MONITORINFOEX; alias ICONMETRICSW ICONMETRICS; alias NONCLIENTMETRICSW NONCLIENTMETRICS; alias AppendMenuW AppendMenu; alias BroadcastSystemMessageW BroadcastSystemMessage; static if (_WIN32_WINNT >= 0x501) { alias BroadcastSystemMessageExW BroadcastSystemMessageEx; } alias CallMsgFilterW CallMsgFilter; alias CallWindowProcW CallWindowProc; alias ChangeMenuW ChangeMenu; alias CharLowerW CharLower; alias CharLowerBuffW CharLowerBuff; alias CharNextW CharNext; alias CharNextExW CharNextEx; alias CharPrevW CharPrev; alias CharPrevExW CharPrevEx; alias CharToOemW CharToOem; alias CharToOemBuffW CharToOemBuff; alias CharUpperW CharUpper; alias CharUpperBuffW CharUpperBuff; alias CopyAcceleratorTableW CopyAcceleratorTable; alias CreateAcceleratorTableW CreateAcceleratorTable; alias CreateDialogW CreateDialog; alias CreateDialogIndirectW CreateDialogIndirect; alias CreateDialogIndirectParamW CreateDialogIndirectParam; alias CreateDialogParamW CreateDialogParam; alias CreateMDIWindowW CreateMDIWindow; alias CreateWindowW CreateWindow; alias CreateWindowExW CreateWindowEx; alias CreateWindowStationW CreateWindowStation; alias DefDlgProcW DefDlgProc; alias DefFrameProcW DefFrameProc; alias DefMDIChildProcW DefMDIChildProc; alias DefWindowProcW DefWindowProc; alias DialogBoxW DialogBox; alias DialogBoxIndirectW DialogBoxIndirect; alias DialogBoxIndirectParamW DialogBoxIndirectParam; alias DialogBoxParamW DialogBoxParam; alias DispatchMessageW DispatchMessage; alias DlgDirListW DlgDirList; alias DlgDirListComboBoxW DlgDirListComboBox; alias DlgDirSelectComboBoxExW DlgDirSelectComboBoxEx; alias DlgDirSelectExW DlgDirSelectEx; alias DrawStateW DrawState; alias DrawTextW DrawText; alias DrawTextExW DrawTextEx; alias EnumDesktopsW EnumDesktops; alias EnumPropsW EnumProps; alias EnumPropsExW EnumPropsEx; alias EnumWindowStationsW EnumWindowStations; alias FindWindowW FindWindow; alias FindWindowExW FindWindowEx; alias GetClassInfoW GetClassInfo; alias GetClassInfoExW GetClassInfoEx; alias GetClassLongW GetClassLong; alias GetClassNameW GetClassName; alias GetClipboardFormatNameW GetClipboardFormatName; alias GetDlgItemTextW GetDlgItemText; alias GetKeyboardLayoutNameW GetKeyboardLayoutName; alias GetKeyNameTextW GetKeyNameText; alias GetMenuItemInfoW GetMenuItemInfo; alias GetMenuStringW GetMenuString; alias GetMessageW GetMessage; alias GetMonitorInfoW GetMonitorInfo; alias GetPropW GetProp; static if (_WIN32_WINNT >= 0x501) { alias GetRawInputDeviceInfoW GetRawInputDeviceInfo; } alias GetTabbedTextExtentW GetTabbedTextExtent; alias GetUserObjectInformationW GetUserObjectInformation; alias GetWindowLongW GetWindowLong; alias GetWindowLongPtrW GetWindowLongPtr; alias GetWindowTextW GetWindowText; alias GetWindowTextLengthW GetWindowTextLength; alias GetAltTabInfoW GetAltTabInfo; alias GetWindowModuleFileNameW GetWindowModuleFileName; alias GrayStringW GrayString; alias InsertMenuW InsertMenu; alias InsertMenuItemW InsertMenuItem; alias IsCharAlphaW IsCharAlpha; alias IsCharAlphaNumericW IsCharAlphaNumeric; alias IsCharLowerW IsCharLower; alias IsCharUpperW IsCharUpper; alias IsDialogMessageW IsDialogMessage; alias LoadAcceleratorsW LoadAccelerators; alias LoadBitmapW LoadBitmap; alias LoadCursorW LoadCursor; alias LoadCursorFromFileW LoadCursorFromFile; alias LoadIconW LoadIcon; alias LoadImageW LoadImage; alias LoadKeyboardLayoutW LoadKeyboardLayout; alias LoadMenuW LoadMenu; alias LoadMenuIndirectW LoadMenuIndirect; alias LoadStringW LoadString; alias MapVirtualKeyW MapVirtualKey; alias MapVirtualKeyExW MapVirtualKeyEx; alias MessageBoxW MessageBox; alias MessageBoxExW MessageBoxEx; alias MessageBoxIndirectW MessageBoxIndirect; alias ModifyMenuW ModifyMenu; alias OemToCharW OemToChar; alias OemToCharBuffW OemToCharBuff; alias OpenDesktopW OpenDesktop; alias OpenWindowStationW OpenWindowStation; alias PeekMessageW PeekMessage; alias PostMessageW PostMessage; alias PostThreadMessageW PostThreadMessage; alias RealGetWindowClassW RealGetWindowClass; alias RegisterClassW RegisterClass; alias RegisterClassExW RegisterClassEx; alias RegisterClipboardFormatW RegisterClipboardFormat; alias RegisterDeviceNotificationW RegisterDeviceNotification; alias RegisterWindowMessageW RegisterWindowMessage; alias RemovePropW RemoveProp; alias SendDlgItemMessageW SendDlgItemMessage; alias SendMessageW SendMessage; alias SendMessageCallbackW SendMessageCallback; alias SendMessageTimeoutW SendMessageTimeout; alias SendNotifyMessageW SendNotifyMessage; alias SetClassLongW SetClassLong; alias SetDlgItemTextW SetDlgItemText; alias SetMenuItemInfoW SetMenuItemInfo; alias SetPropW SetProp; alias SetUserObjectInformationW SetUserObjectInformation; alias SetWindowLongW SetWindowLong; alias SetWindowLongPtrW SetWindowLongPtr; alias SetWindowsHookW SetWindowsHook; alias SetWindowsHookExW SetWindowsHookEx; alias SetWindowTextW SetWindowText; alias SystemParametersInfoW SystemParametersInfo; alias TabbedTextOutW TabbedTextOut; alias TranslateAcceleratorW TranslateAccelerator; alias UnregisterClassW UnregisterClass; alias VkKeyScanW VkKeyScan; alias VkKeyScanExW VkKeyScanEx; alias WinHelpW WinHelp; alias wsprintfW wsprintf; alias wvsprintfW wvsprintf; alias ChangeDisplaySettingsW ChangeDisplaySettings; alias ChangeDisplaySettingsExW ChangeDisplaySettingsEx; alias CreateDesktopW CreateDesktop; alias EnumDisplaySettingsW EnumDisplaySettings; alias EnumDisplaySettingsExW EnumDisplaySettingsEx; alias EnumDisplayDevicesW EnumDisplayDevices; } else { // ANSI alias EDITWORDBREAKPROCA EDITWORDBREAKPROC; alias PROPENUMPROCA PROPENUMPROC; alias PROPENUMPROCEXA PROPENUMPROCEX; alias DESKTOPENUMPROCA DESKTOPENUMPROC; alias WINSTAENUMPROCA WINSTAENUMPROC; alias MAKEINTRESOURCEA MAKEINTRESOURCE; alias WNDCLASSA WNDCLASS; alias WNDCLASSEXA WNDCLASSEX; alias MENUITEMINFOA MENUITEMINFO; alias LPCMENUITEMINFOA LPCMENUITEMINFO; alias MSGBOXPARAMSA MSGBOXPARAMS; alias HIGHCONTRASTA HIGHCONTRAST; alias SERIALKEYSA SERIALKEYS; alias SOUNDSENTRYA SOUNDSENTRY; alias CREATESTRUCTA CREATESTRUCT; alias CBT_CREATEWNDA CBT_CREATEWND; alias MDICREATESTRUCTA MDICREATESTRUCT; alias MULTIKEYHELPA MULTIKEYHELP; alias MONITORINFOEXA MONITORINFOEX; alias ICONMETRICSA ICONMETRICS; alias NONCLIENTMETRICSA NONCLIENTMETRICS; alias AppendMenuA AppendMenu; alias BroadcastSystemMessageA BroadcastSystemMessage; static if (_WIN32_WINNT >= 0x501) { alias BroadcastSystemMessageExA BroadcastSystemMessageEx; } alias CallMsgFilterA CallMsgFilter; alias CallWindowProcA CallWindowProc; alias ChangeMenuA ChangeMenu; alias CharLowerA CharLower; alias CharLowerBuffA CharLowerBuff; alias CharNextA CharNext; alias CharNextExA CharNextEx; alias CharPrevA CharPrev; alias CharPrevExA CharPrevEx; alias CharToOemA CharToOem; alias CharToOemBuffA CharToOemBuff; alias CharUpperA CharUpper; alias CharUpperBuffA CharUpperBuff; alias CopyAcceleratorTableA CopyAcceleratorTable; alias CreateAcceleratorTableA CreateAcceleratorTable; alias CreateDialogA CreateDialog; alias CreateDialogIndirectA CreateDialogIndirect; alias CreateDialogIndirectParamA CreateDialogIndirectParam; alias CreateDialogParamA CreateDialogParam; alias CreateMDIWindowA CreateMDIWindow; alias CreateWindowA CreateWindow; alias CreateWindowExA CreateWindowEx; alias CreateWindowStationA CreateWindowStation; alias DefDlgProcA DefDlgProc; alias DefFrameProcA DefFrameProc; alias DefMDIChildProcA DefMDIChildProc; alias DefWindowProcA DefWindowProc; alias DialogBoxA DialogBox; alias DialogBoxIndirectA DialogBoxIndirect; alias DialogBoxIndirectParamA DialogBoxIndirectParam; alias DialogBoxParamA DialogBoxParam; alias DispatchMessageA DispatchMessage; alias DlgDirListA DlgDirList; alias DlgDirListComboBoxA DlgDirListComboBox; alias DlgDirSelectComboBoxExA DlgDirSelectComboBoxEx; alias DlgDirSelectExA DlgDirSelectEx; alias DrawStateA DrawState; alias DrawTextA DrawText; alias DrawTextExA DrawTextEx; alias EnumDesktopsA EnumDesktops; alias EnumPropsA EnumProps; alias EnumPropsExA EnumPropsEx; alias EnumWindowStationsA EnumWindowStations; alias FindWindowA FindWindow; alias FindWindowExA FindWindowEx; alias GetClassInfoA GetClassInfo; alias GetClassInfoExA GetClassInfoEx; alias GetClassLongA GetClassLong; alias GetClassNameA GetClassName; alias GetClipboardFormatNameA GetClipboardFormatName; alias GetDlgItemTextA GetDlgItemText; alias GetKeyboardLayoutNameA GetKeyboardLayoutName; alias GetKeyNameTextA GetKeyNameText; alias GetMenuItemInfoA GetMenuItemInfo; alias GetMenuStringA GetMenuString; alias GetMessageA GetMessage; alias GetMonitorInfoA GetMonitorInfo; alias GetPropA GetProp; static if (_WIN32_WINNT >= 0x501) { alias GetRawInputDeviceInfoA GetRawInputDeviceInfo; } alias GetTabbedTextExtentA GetTabbedTextExtent; alias GetUserObjectInformationA GetUserObjectInformation; alias GetWindowLongA GetWindowLong; alias GetWindowLongPtrA GetWindowLongPtr; alias GetWindowTextA GetWindowText; alias GetWindowTextLengthA GetWindowTextLength; alias GetAltTabInfoA GetAltTabInfo; alias GetWindowModuleFileNameA GetWindowModuleFileName; alias GrayStringA GrayString; alias InsertMenuA InsertMenu; alias InsertMenuItemA InsertMenuItem; alias IsCharAlphaA IsCharAlpha; alias IsCharAlphaNumericA IsCharAlphaNumeric; alias IsCharLowerA IsCharLower; alias IsCharUpperA IsCharUpper; alias IsDialogMessageA IsDialogMessage; alias LoadAcceleratorsA LoadAccelerators; alias LoadBitmapA LoadBitmap; alias LoadCursorA LoadCursor; alias LoadIconA LoadIcon; alias LoadCursorFromFileA LoadCursorFromFile; alias LoadImageA LoadImage; alias LoadKeyboardLayoutA LoadKeyboardLayout; alias LoadMenuA LoadMenu; alias LoadMenuIndirectA LoadMenuIndirect; alias LoadStringA LoadString; alias MapVirtualKeyA MapVirtualKey; alias MapVirtualKeyExA MapVirtualKeyEx; alias MessageBoxA MessageBox; alias MessageBoxExA MessageBoxEx; alias MessageBoxIndirectA MessageBoxIndirect; alias ModifyMenuA ModifyMenu; alias OemToCharA OemToChar; alias OemToCharBuffA OemToCharBuff; alias OpenDesktopA OpenDesktop; alias OpenWindowStationA OpenWindowStation; alias PeekMessageA PeekMessage; alias PostMessageA PostMessage; alias PostThreadMessageA PostThreadMessage; alias RealGetWindowClassA RealGetWindowClass; alias RegisterClassA RegisterClass; alias RegisterClassExA RegisterClassEx; alias RegisterClipboardFormatA RegisterClipboardFormat; alias RegisterDeviceNotificationA RegisterDeviceNotification; alias RegisterWindowMessageA RegisterWindowMessage; alias RemovePropA RemoveProp; alias SendDlgItemMessageA SendDlgItemMessage; alias SendMessageA SendMessage; alias SendMessageCallbackA SendMessageCallback; alias SendMessageTimeoutA SendMessageTimeout; alias SendNotifyMessageA SendNotifyMessage; alias SetClassLongA SetClassLong; alias SetDlgItemTextA SetDlgItemText; alias SetMenuItemInfoA SetMenuItemInfo; alias SetPropA SetProp; alias SetUserObjectInformationA SetUserObjectInformation; alias SetWindowLongA SetWindowLong; alias SetWindowLongPtrA SetWindowLongPtr; alias SetWindowsHookA SetWindowsHook; alias SetWindowsHookExA SetWindowsHookEx; alias SetWindowTextA SetWindowText; alias SystemParametersInfoA SystemParametersInfo; alias TabbedTextOutA TabbedTextOut; alias TranslateAcceleratorA TranslateAccelerator; alias UnregisterClassA UnregisterClass; alias VkKeyScanA VkKeyScan; alias VkKeyScanExA VkKeyScanEx; alias WinHelpA WinHelp; alias wsprintfA wsprintf; alias wvsprintfA wvsprintf; alias ChangeDisplaySettingsA ChangeDisplaySettings; alias ChangeDisplaySettingsExA ChangeDisplaySettingsEx; alias CreateDesktopA CreateDesktop; alias EnumDisplaySettingsA EnumDisplaySettings; alias EnumDisplaySettingsExA EnumDisplaySettingsEx; alias EnumDisplayDevicesA EnumDisplayDevices; } alias WNDCLASS* LPWNDCLASS, PWNDCLASS; alias WNDCLASSEX* LPWNDCLASSEX, PWNDCLASSEX; alias MENUITEMINFO* LPMENUITEMINFO; alias MSGBOXPARAMS* PMSGBOXPARAMS, LPMSGBOXPARAMS; alias HIGHCONTRAST* LPHIGHCONTRAST; alias SERIALKEYS* LPSERIALKEYS; alias SOUNDSENTRY* LPSOUNDSENTRY; alias CREATESTRUCT* LPCREATESTRUCT; alias CBT_CREATEWND* LPCBT_CREATEWND; alias MDICREATESTRUCT* LPMDICREATESTRUCT; alias MULTIKEYHELP* PMULTIKEYHELP, LPMULTIKEYHELP; alias MONITORINFOEX* LPMONITORINFOEX; alias ICONMETRICS* LPICONMETRICS; alias NONCLIENTMETRICS* LPNONCLIENTMETRICS; static if (_WIN32_WINNT >= 0x501) { enum PW_CLIENTONLY = 0x00000001; enum RIM_INPUT = 0x00000000; enum RIM_INPUTSINK = 0x00000001; enum RIM_TYPEMOUSE = 0x00000000; enum RIM_TYPEKEYBOARD = 0x00000001; enum RIM_TYPEHID = 0x00000002; enum MOUSE_MOVE_RELATIVE = 0x00000000; enum MOUSE_MOVE_ABSOLUTE = 0x00000001; enum MOUSE_VIRTUAL_DESKTOP = 0x00000002; enum MOUSE_ATTRIBUTES_CHANGED = 0x00000004; enum RI_MOUSE_LEFT_BUTTON_DOWN = 0x0001; enum RI_MOUSE_LEFT_BUTTON_UP = 0x0002; enum RI_MOUSE_RIGHT_BUTTON_DOWN = 0x0004; enum RI_MOUSE_RIGHT_BUTTON_UP = 0x0008; enum RI_MOUSE_MIDDLE_BUTTON_DOWN = 0x0010; enum RI_MOUSE_MIDDLE_BUTTON_UP = 0x0020; enum RI_MOUSE_BUTTON_1_DOWN = RI_MOUSE_LEFT_BUTTON_DOWN; enum RI_MOUSE_BUTTON_1_UP = RI_MOUSE_LEFT_BUTTON_UP; enum RI_MOUSE_BUTTON_2_DOWN = RI_MOUSE_RIGHT_BUTTON_DOWN; enum RI_MOUSE_BUTTON_2_UP = RI_MOUSE_RIGHT_BUTTON_UP; enum RI_MOUSE_BUTTON_3_DOWN = RI_MOUSE_MIDDLE_BUTTON_DOWN; enum RI_MOUSE_BUTTON_3_UP = RI_MOUSE_MIDDLE_BUTTON_UP; enum RI_MOUSE_BUTTON_4_DOWN = 0x0040; enum RI_MOUSE_BUTTON_4_UP = 0x0080; enum RI_MOUSE_BUTTON_5_DOWN = 0x0100; enum RI_MOUSE_BUTTON_5_UP = 0x0200; enum RI_MOUSE_WHEEL = 0x0400; enum KEYBOARD_OVERRUN_MAKE_CODE = 0x00ff; enum RI_KEY_MAKE = 0x0000; enum RI_KEY_BREAK = 0x0001; enum RI_KEY_E0 = 0x0002; enum RI_KEY_E1 = 0x0004; enum RI_KEY_TERMSRV_SET_LED = 0x0008; enum RI_KEY_TERMSRV_SHADOW = 0x0010; enum RID_INPUT = 0x10000003; enum RID_HEADER = 0x10000005; enum RIDI_PREPARSEDDATA = 0x20000005; enum RIDI_DEVICENAME = 0x20000007; enum RIDI_DEVICEINFO = 0x2000000b; enum RIDEV_REMOVE = 0x00000001; enum RIDEV_EXCLUDE = 0x00000010; enum RIDEV_PAGEONLY = 0x00000020; enum RIDEV_NOLEGACY = 0x00000030; enum RIDEV_INPUTSINK = 0x00000100; enum RIDEV_CAPTUREMOUSE = 0x00000200; enum RIDEV_NOHOTKEYS = 0x00000200; enum RIDEV_APPKEYS = 0x00000400; }
D
module io.save; import source.app, source.screen; void save(string fileNameBase) { g_fileNameBase = fileNameBase; import core.stdc.stdio; import std.path: buildPath; import std.string; foreach(ref e; sceneManager.current.getList()) if (e.name == "dasher") e.destroy; //editMode = ; putObj('S', g_startPos); mixin(tce("g_startPos")); auto fileName = getFillName(fileNameBase); jm_backUp(fileName); FILE* f; if ((f = fopen(fileName.toStringz, "wb")) == null) { import std.stdio; writeln("save: '", fileName, "' can't be opened"); return; } scope(exit) fclose(f); writeln("Save: ", fileName); ubyte ver = 1; fwrite(&ver, 1, ubyte.sizeof, f); // 1 version import std.string : split; mixin(tce("ver")); import std.algorithm : canFind; int count; foreach(const e; sceneManager.current.getList()) if (SpriteNames.canFind(e.name)) { count += 1; } fwrite(&count, 1, int.sizeof, f); mixin(tce("count")); foreach(const e; sceneManager.current.getList()) { if ((SpriteNames ~ "Door").canFind(e.name)) { char c; foreach(i, n; SpriteNames) if (e.name == n) { c = g_chars[i]; fwrite(&c, 1, char.sizeof, f); fwrite(&e.position.x, 1, float.sizeof, f); fwrite(&e.position.y, 1, float.sizeof, f); break; } } } // version 1 auto pus = g_aswitch.popUps.length; fwrite(&pus, 1, ubyte.sizeof, f); foreach(pu; g_aswitch.popUps) { char c = pu.chr; fwrite(&c, 1, char.sizeof, f); fwrite(&pu.pos.x, 1, float.sizeof, f); fwrite(&pu.pos.y, 1, float.sizeof, f); } g_messageUpdate(text(fileNameBase, " saved")); } // save
D
/Users/martyn/Development/AppCoordinatorsLearning/DerivedData/AppCoordinatorsLearning/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxSwift.build/Objects-normal/x86_64/CompositeDisposable.o : /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Amb.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SingleAsync.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/DistinctUntilChanged.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Deferred.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Deprecated.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/AsMaybe.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Sequence.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/InfiniteSequence.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Debounce.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Reduce.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Range.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Merge.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Take.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/AnonymousInvocable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/Variable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Cancelable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/GroupedObservable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/AsSingle.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/TakeWhile.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SkipWhile.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Sample.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Throttle.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ShareReplayScope.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedSubscribeType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObservableType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ConnectableObservableType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/SchedulerType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObserverType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/SubjectType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Create.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Generate.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/Queue.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/PriorityQueue.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Reactive.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Materialize.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Dematerialize.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/AddRef.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/Bag.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Using.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Debug.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Catch.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Switch.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/StartWith.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/Lock.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/RecursiveLock.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Sink.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Optional.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/TakeUntil.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SkipUntil.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/WithLatestFrom.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SubscribeOn.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ObserveOn.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Scan.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Traits/Completable+AndThen.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/RetryWhen.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/Platform.Darwin.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Zip+Collection.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/CombineLatest+Collection.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/DelaySubscription.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Do.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Map.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Zip.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Skip.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Producer.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Buffer.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/ImmediateScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Timer.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Filter.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Never.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/AnyObserver.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Error.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/Disposables.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObservableType+Extensions.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DispatchQueue+Extensions.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Errors.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ElementAt.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Concat.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Repeat.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/AsyncSubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/PublishSubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/BehaviorSubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/ReplaySubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Event.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/TakeLast.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Multicast.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/CombineLatest.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Just.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Timeout.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Window.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Rx.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/RxMutableBox.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/Platform.Linux.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/GroupBy.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Delay.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ToArray.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence+Zip+arity.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Zip+arity.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/CombineLatest+arity.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Empty.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SwitchIfEmpty.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/DefaultIfEmpty.swift /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/martyn/Development/AppCoordinatorsLearning/Pods/Target\ Support\ Files/RxSwift/RxSwift-umbrella.h /Users/martyn/Development/AppCoordinatorsLearning/DerivedData/AppCoordinatorsLearning/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxSwift.build/unextended-module.modulemap /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/usr/include/Darwin.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/martyn/Development/AppCoordinatorsLearning/DerivedData/AppCoordinatorsLearning/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxSwift.build/Objects-normal/x86_64/CompositeDisposable~partial.swiftmodule : /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Amb.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SingleAsync.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/DistinctUntilChanged.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Deferred.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Deprecated.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/AsMaybe.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Sequence.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/InfiniteSequence.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Debounce.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Reduce.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Range.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Merge.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Take.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/AnonymousInvocable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/Variable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Cancelable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/GroupedObservable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/AsSingle.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/TakeWhile.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SkipWhile.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Sample.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Throttle.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ShareReplayScope.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedSubscribeType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObservableType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ConnectableObservableType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/SchedulerType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObserverType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/SubjectType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Create.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Generate.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/Queue.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/PriorityQueue.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Reactive.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Materialize.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Dematerialize.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/AddRef.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/Bag.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Using.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Debug.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Catch.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Switch.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/StartWith.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/Lock.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/RecursiveLock.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Sink.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Optional.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/TakeUntil.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SkipUntil.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/WithLatestFrom.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SubscribeOn.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ObserveOn.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Scan.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Traits/Completable+AndThen.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/RetryWhen.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/Platform.Darwin.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Zip+Collection.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/CombineLatest+Collection.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/DelaySubscription.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Do.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Map.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Zip.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Skip.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Producer.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Buffer.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/ImmediateScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Timer.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Filter.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Never.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/AnyObserver.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Error.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/Disposables.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObservableType+Extensions.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DispatchQueue+Extensions.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Errors.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ElementAt.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Concat.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Repeat.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/AsyncSubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/PublishSubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/BehaviorSubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/ReplaySubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Event.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/TakeLast.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Multicast.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/CombineLatest.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Just.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Timeout.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Window.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Rx.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/RxMutableBox.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/Platform.Linux.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/GroupBy.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Delay.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ToArray.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence+Zip+arity.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Zip+arity.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/CombineLatest+arity.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Empty.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SwitchIfEmpty.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/DefaultIfEmpty.swift /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/martyn/Development/AppCoordinatorsLearning/Pods/Target\ Support\ Files/RxSwift/RxSwift-umbrella.h /Users/martyn/Development/AppCoordinatorsLearning/DerivedData/AppCoordinatorsLearning/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxSwift.build/unextended-module.modulemap /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/usr/include/Darwin.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/martyn/Development/AppCoordinatorsLearning/DerivedData/AppCoordinatorsLearning/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxSwift.build/Objects-normal/x86_64/CompositeDisposable~partial.swiftdoc : /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Amb.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SingleAsync.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/DistinctUntilChanged.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Deferred.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Deprecated.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/AsMaybe.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Sequence.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/InfiniteSequence.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Debounce.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Reduce.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Range.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Merge.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Take.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/AnonymousInvocable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/Variable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Cancelable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/GroupedObservable.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/AsSingle.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/TakeWhile.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SkipWhile.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Sample.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Throttle.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ShareReplayScope.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedSubscribeType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObservableType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ConnectableObservableType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/SchedulerType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObserverType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/SubjectType.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Create.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Generate.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/Queue.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/PriorityQueue.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Reactive.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Materialize.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Dematerialize.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/AddRef.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DataStructures/Bag.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Using.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Debug.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Catch.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Switch.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/StartWith.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/Lock.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/RecursiveLock.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Sink.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Optional.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/TakeUntil.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SkipUntil.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/WithLatestFrom.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SubscribeOn.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ObserveOn.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Scan.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Traits/Completable+AndThen.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/RetryWhen.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/Platform.Darwin.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Zip+Collection.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/CombineLatest+Collection.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/DelaySubscription.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Do.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Map.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Zip.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Skip.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Producer.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Buffer.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/ImmediateScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Timer.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Filter.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Never.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/AnyObserver.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Error.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Disposables/Disposables.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/ObservableType+Extensions.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/DispatchQueue+Extensions.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Errors.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ElementAt.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Concat.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Repeat.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/AsyncSubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/PublishSubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/BehaviorSubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Subjects/ReplaySubject.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Event.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/TakeLast.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Multicast.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/CombineLatest.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Just.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Timeout.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Window.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Rx.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/RxMutableBox.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/Platform/Platform.Linux.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/GroupBy.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Delay.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/ToArray.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence+Zip+arity.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Zip+arity.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/CombineLatest+arity.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/Empty.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/SwitchIfEmpty.swift /Users/martyn/Development/AppCoordinatorsLearning/Pods/RxSwift/RxSwift/Observables/DefaultIfEmpty.swift /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/martyn/Development/AppCoordinatorsLearning/Pods/Target\ Support\ Files/RxSwift/RxSwift-umbrella.h /Users/martyn/Development/AppCoordinatorsLearning/DerivedData/AppCoordinatorsLearning/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxSwift.build/unextended-module.modulemap /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/usr/include/objc/ObjectiveC.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/usr/include/Darwin.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Users/martyn/Downloads/Xcode9.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
D
module gfm.freeimage.freeimage; import std.conv, std.string; import derelict.freeimage.freeimage, derelict.util.exception; import std.logger; import gfm.core.text; /// The one exception type thrown in this wrapper. /// A failing FreeImage function should <b>always</b> throw an FreeImageException. class FreeImageException : Exception { public { @safe pure nothrow this(string message, string file =__FILE__, size_t line = __LINE__, Throwable next = null) { super(message, file, line, next); } } } /// FreeImage library wrapper. final class FreeImage { public { /// Loads the FreeImage library and logs some information. /// Throws: FreeImageException on error. this(Logger logger, bool useExternalPlugins = false) { _logger = logger is null ? new NullLogger() : logger; try { DerelictFI.load(); } catch(DerelictException e) { throw new FreeImageException(e.msg); } //FreeImage_Initialise(useExternalPlugins ? TRUE : FALSE); // documentation says it's useless _libInitialized = true; _logger.infof("FreeImage %s initialized.", getVersion()); _logger.infof("%s.", getCopyrightMessage()); } ~this() { close(); } void close() { if (_libInitialized) { //FreeImage_DeInitialise(); // documentation says it's useless DerelictFI.unload(); _libInitialized = false; } } string getVersion() { const(char)* versionZ = FreeImage_GetVersion(); return sanitizeUTF8(versionZ, _logger, "FreeImage_GetVersion"); } string getCopyrightMessage() { const(char)* copyrightZ = FreeImage_GetCopyrightMessage(); return sanitizeUTF8(copyrightZ, _logger, "FreeImage_GetCopyrightMessage"); } } package { Logger _logger; } private { bool _libInitialized; } }
D
module html5.complex.column; import html5; class ColumnElement : DivElement{ import std.conv; int grid = 12; this(int grid = 12){ super(); this.grid = grid; this.tag.attr["class"] = "col-md-" ~ to!(string)(this.grid); } }
D
/Users/zecheng/iosDevelop/secondHand/DerivedData/secondHand/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/Objects-normal/x86_64/ConstraintRelation.o : /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutGuideDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutSupportDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintViewDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutGuide.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerExtendable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerRelatable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerEditable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerFinalizable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerPriortizable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintConfig.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/Debugging.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintItem.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/LayoutConstraintItem.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintRelation.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintDescription.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMaker.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/Typealiases.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintAttributes.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutGuide+Extensions.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/UILayoutSupport+Extensions.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintView+Extensions.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintInsets.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintRelatableTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMultiplierTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintOffsetTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintInsetTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintConstantTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintPriorityTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/Constraint.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/LayoutConstraint.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutSupport.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintView.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintPriority.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/zecheng/iosDevelop/secondHand/Pods/Target\ Support\ Files/SnapKit/SnapKit-umbrella.h /Users/zecheng/iosDevelop/secondHand/DerivedData/secondHand/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/zecheng/iosDevelop/secondHand/DerivedData/secondHand/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/Objects-normal/x86_64/ConstraintRelation~partial.swiftmodule : /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutGuideDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutSupportDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintViewDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutGuide.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerExtendable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerRelatable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerEditable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerFinalizable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerPriortizable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintConfig.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/Debugging.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintItem.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/LayoutConstraintItem.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintRelation.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintDescription.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMaker.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/Typealiases.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintAttributes.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutGuide+Extensions.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/UILayoutSupport+Extensions.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintView+Extensions.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintInsets.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintRelatableTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMultiplierTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintOffsetTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintInsetTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintConstantTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintPriorityTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/Constraint.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/LayoutConstraint.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutSupport.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintView.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintPriority.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/zecheng/iosDevelop/secondHand/Pods/Target\ Support\ Files/SnapKit/SnapKit-umbrella.h /Users/zecheng/iosDevelop/secondHand/DerivedData/secondHand/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/zecheng/iosDevelop/secondHand/DerivedData/secondHand/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/Objects-normal/x86_64/ConstraintRelation~partial.swiftdoc : /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutGuideDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutSupportDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintViewDSL.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutGuide.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerExtendable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerRelatable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerEditable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerFinalizable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMakerPriortizable.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintConfig.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/Debugging.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintItem.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/LayoutConstraintItem.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintRelation.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintDescription.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMaker.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/Typealiases.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintAttributes.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutGuide+Extensions.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/UILayoutSupport+Extensions.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintView+Extensions.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintInsets.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintRelatableTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintMultiplierTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintOffsetTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintInsetTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintConstantTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintPriorityTarget.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/Constraint.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/LayoutConstraint.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintLayoutSupport.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintView.swift /Users/zecheng/iosDevelop/secondHand/Pods/SnapKit/Source/ConstraintPriority.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/zecheng/iosDevelop/secondHand/Pods/Target\ Support\ Files/SnapKit/SnapKit-umbrella.h /Users/zecheng/iosDevelop/secondHand/DerivedData/secondHand/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
D
/* * The MIT License (MIT) * * Copyright (c) 2014 Devisualization (Richard Andrew Cattermole) * * 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. */ module devisualization.font.font; import devisualization.font.glyph; alias FontNotExportable = Exception; interface Font { //this(ubyte[] data); Glyph get(char c); // gets a glyph for charactor Glyph get(dchar c); // " Glyph get(wchar c); // " final FontWithModifiers modifier() @property { return new FontWithModifiers(this); } } class FontWithModifiers : Font { private { import devisualization.image; Font font_; bool italize_; bool bold_; uint width_; ushort kerning_; uint height_; uint lineHeight_; Color_RGBA primary_; Color_RGBA* background_; } this(Font font) { font_ = font; } @property { Font font() { return font_; } /** * Modifies how future getting of glyphs works. */ GlyphModifiers modifiers() { class FontModifiers : GlyphModifiers { void italize() { // makes it italisized italize_ = true; } void bold() { // makes it boldenized bold_ = true; } void width(uint width) { // scales width_ = width; } void kerning(ushort amount) { // adds width but doesn't scale kerning_ = amount; } void height(uint amount) { // scales height_ = amount; } void lineHeight(uint amount) { // adds height to glyph but doesn't scale lineHeight_ = amount; } void color(Color_RGBA primary, Color_RGBA* background = null) { primary_ = primary; background_ = background; } void reset() { // reload image for glyph italize_ = false; bold_ = false; width_ = 0; kerning_ = 0; height_ = 0; lineHeight_ = 0; primary_ = Color_RGBA.init; background_ = null; } } return new FontModifiers(); } } Glyph get(char c) { // gets a glyph for charactor Glyph ret = font_.get(c); modify(ret); return ret; } Glyph get(dchar c) { // " Glyph ret = font_.get(c); modify(ret); return ret; } Glyph get(wchar c) { // " Glyph ret = font_.get(c); modify(ret); return ret; } private { void modify(Glyph ret) { auto _ = ret.modifiers; if (italize_) _.italize(); if (bold_) _.bold(); if (width_ > 0) _.width(width_); if (kerning_ > 0) _.kerning(kerning_); if (height_ > 0) _.height(height_); if (lineHeight_ > 0) _.lineHeight(lineHeight_); _.color(primary_, background_); } } }
D
module rabbitmq.examples.connect_timeout; import std.stdio; import std.string; import std.conv:to; import std.exception; import std.getopt; import symmetry.api.rabbitmq; struct Options { string hostname; ushort port; int timeoutSec; int timeoutMicros; } int main(string[] args) { Options options; amqp_socket_t *socket; amqp_connection_state_t conn; timeval tval; timeval* tv; auto helpInformation = getopt( args, "hostname", &options.hostname, "port", &options.port, "timeout-sec", &options.timeoutSec, "timeout-micros", &options.timeoutMicros, ); if (helpInformation.helpWanted) { defaultGetoptPrinter("connect_timeout", helpInformation.options); return -1; } tval.tv_sec = options.timeoutSec; tval.tv_usec = options.timeoutMicros; tv = (options.timeoutSec ==0 && options.timeoutMicros ==0) ? null : &tval; conn = amqp_new_connection(); socket = amqp_tcp_socket_new(conn); enforce(socket !is null ,"errorcreating TCP socket"); die_on_error(amqp_socket_open_noblock(socket, options.hostname.toStringz, options.port, tv), "opening TCP socket"); die_on_amqp_error(amqp_login(conn, "/".ptr, 0, 131072, 0, SaslMethod.plain, "guest".ptr, "guest".ptr), "Logging in"); die_on_amqp_error(amqp_connection_close(conn, ReplySuccess), "Closing connection"); die_on_error(amqp_destroy_connection(conn), "Ending connection"); writeln("Done"); return 0; }
D
/Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/MarathonCore.build/Codable+TypeInference.swift.o : /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Add.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Command.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Codable+TypeInference.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Package.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Executable.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/MarathonFile.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Update.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Create.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Remove.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Task.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Install.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Perform.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/URL+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/String+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Folder+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ShellOut+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Array+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Run.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Help.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/PackageManager.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ScriptManager.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ZshAutocompleteInstaller.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/FishAutocompleteInstaller.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Printer.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/PrintableError.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Edit.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Script.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/List.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Require.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Files.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Releases.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/ShellOut.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/RunnerLib.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Require.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/MarathonCore.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Logger.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Danger.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/DangerShellExecutor.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Files.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/DangerFixtures.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Releases.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/OctoKit.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/RequestKit.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/dangertest.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/ShellOut.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/MarathonCore.build/Codable+TypeInference~partial.swiftmodule : /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Add.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Command.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Codable+TypeInference.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Package.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Executable.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/MarathonFile.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Update.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Create.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Remove.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Task.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Install.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Perform.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/URL+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/String+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Folder+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ShellOut+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Array+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Run.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Help.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/PackageManager.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ScriptManager.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ZshAutocompleteInstaller.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/FishAutocompleteInstaller.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Printer.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/PrintableError.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Edit.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Script.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/List.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Require.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Files.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Releases.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/ShellOut.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/RunnerLib.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Require.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/MarathonCore.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Logger.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Danger.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/DangerShellExecutor.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Files.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/DangerFixtures.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Releases.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/OctoKit.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/RequestKit.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/dangertest.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/ShellOut.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/MarathonCore.build/Codable+TypeInference~partial.swiftdoc : /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Add.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Command.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Codable+TypeInference.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Package.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Executable.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/MarathonFile.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Update.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Create.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Remove.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Task.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Install.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Perform.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/URL+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/String+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Folder+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ShellOut+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Array+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Run.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Help.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/PackageManager.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ScriptManager.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ZshAutocompleteInstaller.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/FishAutocompleteInstaller.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Printer.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/PrintableError.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Edit.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Script.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/List.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Require.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Files.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Releases.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/ShellOut.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/RunnerLib.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Require.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/MarathonCore.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Logger.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Danger.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/DangerShellExecutor.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Files.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/DangerFixtures.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Releases.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/OctoKit.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/RequestKit.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/dangertest.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/ShellOut.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/MarathonCore.build/Codable+TypeInference~partial.swiftsourceinfo : /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Add.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Command.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Codable+TypeInference.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Package.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Executable.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/MarathonFile.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Update.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Create.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Remove.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Task.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Install.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Perform.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/URL+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/String+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Folder+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ShellOut+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Array+Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Marathon.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Run.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Help.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/PackageManager.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ScriptManager.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/ZshAutocompleteInstaller.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/FishAutocompleteInstaller.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Printer.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/PrintableError.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Edit.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/Script.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/checkouts/Marathon/Sources/MarathonCore/List.swift /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Require.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Files.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Releases.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/ShellOut.swiftmodule /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/RunnerLib.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Require.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/MarathonCore.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Logger.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Danger.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/DangerShellExecutor.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Files.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/DangerFixtures.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/Releases.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/OctoKit.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/RequestKit.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/dangertest.build/module.modulemap /Users/angelo/Developer/DroppedBits/DangerTest/.build/x86_64-apple-macosx/debug/ShellOut.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
module android.java.android.view.accessibility.AccessibilityNodeInfo_TouchDelegateInfo_d_interface; import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers; static import arsd.jni; import import0 = android.java.java.util.Map_d_interface; import import4 = android.java.java.lang.Class_d_interface; import import2 = android.java.android.view.accessibility.AccessibilityNodeInfo_d_interface; import import3 = android.java.android.os.Parcel_d_interface; import import1 = android.java.android.graphics.Region_d_interface; @JavaName("AccessibilityNodeInfo$TouchDelegateInfo") final class AccessibilityNodeInfo_TouchDelegateInfo : IJavaObject { static immutable string[] _d_canCastTo = [ "android/os/Parcelable", ]; @Import this(import0.Map); @Import int getRegionCount(); @Import import1.Region getRegionAt(int); @Import import2.AccessibilityNodeInfo getTargetForRegion(import1.Region); @Import int describeContents(); @Import void writeToParcel(import3.Parcel, int); @Import import4.Class getClass(); @Import int hashCode(); @Import bool equals(IJavaObject); @Import @JavaName("toString") string toString_(); override string toString() { return arsd.jni.javaObjectToString(this); } @Import void notify(); @Import void notifyAll(); @Import void wait(long); @Import void wait(long, int); @Import void wait(); mixin IJavaObjectImplementation!(false); public static immutable string _javaParameterString = "Landroid/view/accessibility/AccessibilityNodeInfo$TouchDelegateInfo;"; }
D
/** * Semantic analysis for D types. * * 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/typesem.d, _typesem.d) * Documentation: https://dlang.org/phobos/dmd_typesem.html * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/typesem.d */ module dmd.typesem; import core.checkedint; import core.stdc.string; import core.stdc.stdio; import dmd.access; import dmd.aggregate; import dmd.aliasthis; import dmd.arrayop; import dmd.arraytypes; import dmd.astcodegen; import dmd.astenums; import dmd.dcast; import dmd.dclass; import dmd.declaration; import dmd.denum; import dmd.dimport; import dmd.dmangle; import dmd.dmodule; import dmd.dscope; import dmd.dstruct; import dmd.dsymbol; import dmd.dsymbolsem; import dmd.dtemplate; import dmd.errors; import dmd.errorsink; import dmd.expression; import dmd.expressionsem; import dmd.func; import dmd.globals; import dmd.hdrgen; import dmd.id; import dmd.identifier; import dmd.imphint; import dmd.importc; import dmd.init; import dmd.initsem; import dmd.location; import dmd.visitor; import dmd.mtype; import dmd.objc; import dmd.opover; import dmd.parse; import dmd.root.complex; import dmd.root.ctfloat; import dmd.root.rmem; import dmd.common.outbuffer; import dmd.root.rootobject; import dmd.root.string; import dmd.root.stringtable; import dmd.safe; import dmd.semantic3; import dmd.sideeffect; import dmd.target; import dmd.tokens; /************************************* * Resolve a tuple index, `s[oindex]`, by figuring out what `s[oindex]` represents. * Setting one of pe/pt/ps. * Params: * loc = location for error messages * sc = context * s = symbol being indexed - could be a tuple, could be an expression * pe = set if s[oindex] is an Expression, otherwise null * pt = set if s[oindex] is a Type, otherwise null * ps = set if s[oindex] is a Dsymbol, otherwise null * oindex = index into s */ private void resolveTupleIndex(const ref Loc loc, Scope* sc, Dsymbol s, out Expression pe, out Type pt, out Dsymbol ps, RootObject oindex) { auto tup = s.isTupleDeclaration(); auto eindex = isExpression(oindex); auto tindex = isType(oindex); auto sindex = isDsymbol(oindex); if (!tup) { // It's really an index expression if (tindex) eindex = new TypeExp(loc, tindex); else if (sindex) eindex = symbolToExp(sindex, loc, sc, false); Expression e = new IndexExp(loc, symbolToExp(s, loc, sc, false), eindex); e = e.expressionSemantic(sc); resolveExp(e, pt, pe, ps); return; } // Convert oindex to Expression, then try to resolve to constant. if (tindex) tindex.resolve(loc, sc, eindex, tindex, sindex); if (sindex) eindex = symbolToExp(sindex, loc, sc, false); if (!eindex) { .error(loc, "index `%s` is not an expression", oindex.toChars()); pt = Type.terror; return; } eindex = semanticLength(sc, tup, eindex); eindex = eindex.ctfeInterpret(); if (eindex.op == EXP.error) { pt = Type.terror; return; } const(uinteger_t) d = eindex.toUInteger(); if (d >= tup.objects.length) { .error(loc, "tuple index `%llu` out of bounds `[0 .. %llu]`", d, cast(ulong)tup.objects.length); pt = Type.terror; return; } RootObject o = (*tup.objects)[cast(size_t)d]; ps = isDsymbol(o); if (auto t = isType(o)) pt = t.typeSemantic(loc, sc); if (auto e = isExpression(o)) resolveExp(e, pt, pe, ps); } /************************************* * Takes an array of Identifiers and figures out if * it represents a Type, Expression, or Dsymbol. * Params: * mt = array of identifiers * loc = location for error messages * sc = context * s = symbol to start search at * scopesym = unused * pe = set if expression otherwise null * pt = set if type otherwise null * ps = set if symbol otherwise null * typeid = set if in TypeidExpression https://dlang.org/spec/expression.html#TypeidExpression */ private void resolveHelper(TypeQualified mt, const ref Loc loc, Scope* sc, Dsymbol s, Dsymbol scopesym, out Expression pe, out Type pt, out Dsymbol ps, bool intypeid = false) { version (none) { printf("TypeQualified::resolveHelper(sc = %p, idents = '%s')\n", sc, mt.toChars()); if (scopesym) printf("\tscopesym = '%s'\n", scopesym.toChars()); } if (!s) { /* Look for what user might have intended */ const p = mt.mutableOf().unSharedOf().toChars(); auto id = Identifier.idPool(p, cast(uint)strlen(p)); if (const n = importHint(id.toString())) error(loc, "`%s` is not defined, perhaps `import %.*s;` ?", p, cast(int)n.length, n.ptr); else if (auto s2 = sc.search_correct(id)) error(loc, "undefined identifier `%s`, did you mean %s `%s`?", p, s2.kind(), s2.toChars()); else if (const q = Scope.search_correct_C(id)) error(loc, "undefined identifier `%s`, did you mean `%s`?", p, q); else if ((id == Id.This && sc.getStructClassScope()) || (id == Id._super && sc.getClassScope())) error(loc, "undefined identifier `%s`, did you mean `typeof(%s)`?", p, p); else error(loc, "undefined identifier `%s`", p); pt = Type.terror; return; } //printf("\t1: s = '%s' %p, kind = '%s'\n",s.toChars(), s, s.kind()); Declaration d = s.isDeclaration(); if (d && (d.storage_class & STC.templateparameter)) s = s.toAlias(); else { // check for deprecated or disabled aliases // functions are checked after overloading // templates are checked after matching constraints if (!s.isFuncDeclaration() && !s.isTemplateDeclaration()) s.checkDeprecated(loc, sc); if (d) d.checkDisabled(loc, sc, true); } s = s.toAlias(); //printf("\t2: s = '%s' %p, kind = '%s'\n",s.toChars(), s, s.kind()); for (size_t i = 0; i < mt.idents.length; i++) { RootObject id = mt.idents[i]; switch (id.dyncast()) with (DYNCAST) { case expression: case type: Type tx; Expression ex; Dsymbol sx; resolveTupleIndex(loc, sc, s, ex, tx, sx, id); if (sx) { s = sx.toAlias(); continue; } if (tx) ex = new TypeExp(loc, tx); assert(ex); ex = typeToExpressionHelper(mt, ex, i + 1); ex = ex.expressionSemantic(sc); resolveExp(ex, pt, pe, ps); return; default: break; } Type t = s.getType(); // type symbol, type alias, or type tuple? uint errorsave = global.errors; int flags = t is null ? SearchLocalsOnly : IgnorePrivateImports; Dsymbol sm = s.searchX(loc, sc, id, flags); if (sm) { if (!(sc.flags & SCOPE.ignoresymbolvisibility) && !symbolIsVisible(sc, sm)) { .error(loc, "`%s` is not visible from module `%s`", sm.toPrettyChars(), sc._module.toChars()); sm = null; } // Same check as in dotIdSemanticProp(DotIdExp) else if (sm.isPackage() && checkAccess(sc, sm.isPackage())) { // @@@DEPRECATED_2.106@@@ // Should be an error in 2.106. Just remove the deprecation call // and uncomment the null assignment deprecation(loc, "%s %s is not accessible here, perhaps add 'static import %s;'", sm.kind(), sm.toPrettyChars(), sm.toPrettyChars()); //sm = null; } } if (global.errors != errorsave) { pt = Type.terror; return; } void helper3() { Expression e; VarDeclaration v = s.isVarDeclaration(); FuncDeclaration f = s.isFuncDeclaration(); if (intypeid || !v && !f) e = symbolToExp(s, loc, sc, true); else e = new VarExp(loc, s.isDeclaration(), true); e = typeToExpressionHelper(mt, e, i); e = e.expressionSemantic(sc); resolveExp(e, pt, pe, ps); } //printf("\t3: s = %p %s %s, sm = %p\n", s, s.kind(), s.toChars(), sm); if (intypeid && !t && sm && sm.needThis()) return helper3(); if (VarDeclaration v = s.isVarDeclaration()) { // https://issues.dlang.org/show_bug.cgi?id=19913 // v.type would be null if it is a forward referenced member. if (v.type is null) v.dsymbolSemantic(sc); if (v.storage_class & (STC.const_ | STC.immutable_ | STC.manifest) || v.type.isConst() || v.type.isImmutable()) { // https://issues.dlang.org/show_bug.cgi?id=13087 // this.field is not constant always if (!v.isThisDeclaration()) return helper3(); } } if (!sm) return helper3(); s = sm.toAlias(); } if (auto em = s.isEnumMember()) { // It's not a type, it's an expression pe = em.getVarExp(loc, sc); return; } if (auto v = s.isVarDeclaration()) { /* This is mostly same with DsymbolExp::semantic(), but we cannot use it * because some variables used in type context need to prevent lowering * to a literal or contextful expression. For example: * * enum a = 1; alias b = a; * template X(alias e){ alias v = e; } alias x = X!(1); * struct S { int v; alias w = v; } * // TypeIdentifier 'a', 'e', and 'v' should be EXP.variable, * // because getDsymbol() need to work in AliasDeclaration::semantic(). */ if (!v.type || !v.type.deco && v.inuse) { if (v.inuse) // https://issues.dlang.org/show_bug.cgi?id=9494 error(loc, "circular reference to %s `%s`", v.kind(), v.toPrettyChars()); else error(loc, "forward reference to %s `%s`", v.kind(), v.toPrettyChars()); pt = Type.terror; return; } if (v.type.ty == Terror) pt = Type.terror; else pe = new VarExp(loc, v); return; } if (auto fld = s.isFuncLiteralDeclaration()) { //printf("'%s' is a function literal\n", fld.toChars()); auto e = new FuncExp(loc, fld); pe = e.expressionSemantic(sc); return; } version (none) { if (FuncDeclaration fd = s.isFuncDeclaration()) { pe = new DsymbolExp(loc, fd); return; } } Type t; while (1) { t = s.getType(); if (t) break; ps = s; return; } if (auto ti = t.isTypeInstance()) if (ti != mt && !ti.deco) { if (!ti.tempinst.errors) error(loc, "forward reference to `%s`", ti.toChars()); pt = Type.terror; return; } if (t.ty == Ttuple) pt = t; else pt = t.merge(); } /****************************************** * We've mistakenly parsed `t` as a type. * Redo `t` as an Expression only if there are no type modifiers. * Params: * t = mistaken type * Returns: * t redone as Expression, null if cannot */ Expression typeToExpression(Type t) { static Expression visitSArray(TypeSArray t) { if (auto e = t.next.typeToExpression()) return new ArrayExp(t.dim.loc, e, t.dim); return null; } static Expression visitAArray(TypeAArray t) { if (auto e = t.next.typeToExpression()) { if (auto ei = t.index.typeToExpression()) return new ArrayExp(t.loc, e, ei); } return null; } static Expression visitIdentifier(TypeIdentifier t) { return typeToExpressionHelper(t, new IdentifierExp(t.loc, t.ident)); } static Expression visitInstance(TypeInstance t) { return typeToExpressionHelper(t, new ScopeExp(t.loc, t.tempinst)); } // easy way to enable 'auto v = new int[mixin("exp")];' in 2.088+ static Expression visitMixin(TypeMixin t) { return new TypeExp(t.loc, t); } if (t.mod) return null; switch (t.ty) { case Tsarray: return visitSArray(t.isTypeSArray()); case Taarray: return visitAArray(t.isTypeAArray()); case Tident: return visitIdentifier(t.isTypeIdentifier()); case Tinstance: return visitInstance(t.isTypeInstance()); case Tmixin: return visitMixin(t.isTypeMixin()); default: return null; } } /****************************************** * Perform semantic analysis on a type. * Params: * type = Type AST node * loc = the location of the type * sc = context * Returns: * `Type` with completed semantic analysis, `Terror` if errors * were encountered */ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc) { static Type error() { return Type.terror; } Type visitType(Type t) { // @@@DEPRECATED_2.110@@@ // Use of `cent` and `ucent` has always been an error. // Starting from 2.100, recommend core.int128 as a replace for the // lack of compiler support. if (t.ty == Tint128 || t.ty == Tuns128) { .error(loc, "`cent` and `ucent` types are obsolete, use `core.int128.Cent` instead"); return error(); } return t.merge(); } Type visitComplex(TypeBasic t) { if (!(sc.flags & SCOPE.Cfile)) return visitType(t); auto tc = getComplexLibraryType(loc, sc, t.ty); if (tc.ty == Terror) return tc; return tc.addMod(t.mod).merge(); } Type visitVector(TypeVector mtype) { const errors = global.errors; mtype.basetype = mtype.basetype.typeSemantic(loc, sc); if (errors != global.errors) return error(); mtype.basetype = mtype.basetype.toBasetype().mutableOf(); if (mtype.basetype.ty != Tsarray) { .error(loc, "T in __vector(T) must be a static array, not `%s`", mtype.basetype.toChars()); return error(); } TypeSArray t = mtype.basetype.isTypeSArray(); const sz = cast(int)t.size(loc); final switch (target.isVectorTypeSupported(sz, t.nextOf())) { case 0: // valid break; case 1: // no support at all .error(loc, "SIMD vector types not supported on this platform"); return error(); case 2: // invalid base type .error(loc, "vector type `%s` is not supported on this platform", mtype.toChars()); return error(); case 3: // invalid size .error(loc, "%d byte vector type `%s` is not supported on this platform", sz, mtype.toChars()); return error(); } return merge(mtype); } Type visitSArray(TypeSArray mtype) { //printf("TypeSArray::semantic() %s\n", toChars()); Type t; Expression e; Dsymbol s; mtype.next.resolve(loc, sc, e, t, s); if (auto tup = s ? s.isTupleDeclaration() : null) { mtype.dim = semanticLength(sc, tup, mtype.dim); mtype.dim = mtype.dim.ctfeInterpret(); if (mtype.dim.op == EXP.error) return error(); uinteger_t d = mtype.dim.toUInteger(); if (d >= tup.objects.length) { .error(loc, "tuple index `%llu` out of bounds `[0 .. %llu]`", cast(ulong)d, cast(ulong)tup.objects.length); return error(); } RootObject o = (*tup.objects)[cast(size_t)d]; if (o.dyncast() != DYNCAST.type) { .error(loc, "`%s` is not a type", mtype.toChars()); return error(); } return (cast(Type)o).addMod(mtype.mod); } if (t && t.ty == Terror) return error(); Type tn = mtype.next.typeSemantic(loc, sc); if (tn.ty == Terror) return error(); Type tbn = tn.toBasetype(); if (mtype.dim) { auto errors = global.errors; mtype.dim = semanticLength(sc, tbn, mtype.dim); mtype.dim = mtype.dim.implicitCastTo(sc, Type.tsize_t); if (errors != global.errors) return error(); mtype.dim = mtype.dim.optimize(WANTvalue); mtype.dim = mtype.dim.ctfeInterpret(); if (mtype.dim.op == EXP.error) return error(); errors = global.errors; dinteger_t d1 = mtype.dim.toInteger(); if (errors != global.errors) return error(); mtype.dim = mtype.dim.implicitCastTo(sc, Type.tsize_t); mtype.dim = mtype.dim.optimize(WANTvalue); if (mtype.dim.op == EXP.error) return error(); errors = global.errors; dinteger_t d2 = mtype.dim.toInteger(); if (errors != global.errors) return error(); if (mtype.dim.op == EXP.error) return error(); Type overflowError() { .error(loc, "`%s` size %llu * %llu exceeds 0x%llx size limit for static array", mtype.toChars(), cast(ulong)tbn.size(loc), cast(ulong)d1, target.maxStaticDataSize); return error(); } if (d1 != d2) return overflowError(); Type tbx = tbn.baseElemOf(); if (tbx.ty == Tstruct && !tbx.isTypeStruct().sym.members || tbx.ty == Tenum && !tbx.isTypeEnum().sym.members) { /* To avoid meaningless error message, skip the total size limit check * when the bottom of element type is opaque. */ } else if (tbn.isTypeBasic() || tbn.ty == Tpointer || tbn.ty == Tarray || tbn.ty == Tsarray || tbn.ty == Taarray || (tbn.ty == Tstruct && tbn.isTypeStruct().sym.sizeok == Sizeok.done) || tbn.ty == Tclass) { /* Only do this for types that don't need to have semantic() * run on them for the size, since they may be forward referenced. */ bool overflow = false; if (mulu(tbn.size(loc), d2, overflow) > target.maxStaticDataSize || overflow) return overflowError(); } } switch (tbn.ty) { case Ttuple: { // Index the tuple to get the type assert(mtype.dim); TypeTuple tt = tbn.isTypeTuple(); uinteger_t d = mtype.dim.toUInteger(); if (d >= tt.arguments.length) { .error(loc, "tuple index `%llu` out of bounds `[0 .. %llu]`", cast(ulong)d, cast(ulong)tt.arguments.length); return error(); } Type telem = (*tt.arguments)[cast(size_t)d].type; return telem.addMod(mtype.mod); } case Tfunction: case Tnone: .error(loc, "cannot have array of `%s`", tbn.toChars()); return error(); default: break; } if (tbn.isscope()) { .error(loc, "cannot have array of scope `%s`", tbn.toChars()); return error(); } /* Ensure things like const(immutable(T)[3]) become immutable(T[3]) * and const(T)[3] become const(T[3]) */ mtype.next = tn; mtype.transitive(); return mtype.addMod(tn.mod).merge(); } Type visitDArray(TypeDArray mtype) { Type tn = mtype.next.typeSemantic(loc, sc); Type tbn = tn.toBasetype(); switch (tbn.ty) { case Ttuple: return tbn; case Tfunction: case Tnone: .error(loc, "cannot have array of `%s`", tbn.toChars()); return error(); case Terror: return error(); default: break; } if (tn.isscope()) { .error(loc, "cannot have array of scope `%s`", tn.toChars()); return error(); } mtype.next = tn; mtype.transitive(); return merge(mtype); } Type visitAArray(TypeAArray mtype) { //printf("TypeAArray::semantic() %s index.ty = %d\n", mtype.toChars(), mtype.index.ty); if (mtype.deco) { return mtype; } mtype.loc = loc; if (sc) sc.setNoFree(); // Deal with the case where we thought the index was a type, but // in reality it was an expression. if (mtype.index.ty == Tident || mtype.index.ty == Tinstance || mtype.index.ty == Tsarray || mtype.index.ty == Ttypeof || mtype.index.ty == Treturn || mtype.index.ty == Tmixin) { Expression e; Type t; Dsymbol s; mtype.index.resolve(loc, sc, e, t, s); // https://issues.dlang.org/show_bug.cgi?id=15478 if (s) e = symbolToExp(s, loc, sc, false); if (e) { // It was an expression - // Rewrite as a static array auto tsa = new TypeSArray(mtype.next, e); return tsa.typeSemantic(loc, sc); } else if (t) mtype.index = t.typeSemantic(loc, sc); else { .error(loc, "index is not a type or an expression"); return error(); } } else mtype.index = mtype.index.typeSemantic(loc, sc); mtype.index = mtype.index.merge2(); if (mtype.index.nextOf() && !mtype.index.nextOf().isImmutable()) { mtype.index = mtype.index.constOf().mutableOf(); version (none) { printf("index is %p %s\n", mtype.index, mtype.index.toChars()); mtype.index.check(); printf("index.mod = x%x\n", mtype.index.mod); printf("index.ito = x%p\n", mtype.index.getMcache().ito); if (mtype.index.getMcache().ito) { printf("index.ito.mod = x%x\n", mtype.index.getMcache().ito.mod); printf("index.ito.ito = x%p\n", mtype.index.getMcache().ito.getMcache().ito); } } } switch (mtype.index.toBasetype().ty) { case Tfunction: case Tvoid: case Tnone: case Ttuple: .error(loc, "cannot have associative array key of `%s`", mtype.index.toBasetype().toChars()); goto case Terror; case Terror: return error(); default: break; } Type tbase = mtype.index.baseElemOf(); while (tbase.ty == Tarray) tbase = tbase.nextOf().baseElemOf(); if (auto ts = tbase.isTypeStruct()) { /* AA's need typeid(index).equals() and getHash(). Issue error if not correctly set up. */ StructDeclaration sd = ts.sym; if (sd.semanticRun < PASS.semanticdone) sd.dsymbolSemantic(null); // duplicate a part of StructDeclaration::semanticTypeInfoMembers //printf("AA = %s, key: xeq = %p, xerreq = %p xhash = %p\n", toChars(), sd.xeq, sd.xerreq, sd.xhash); if (sd.xeq && sd.xeq.isGenerated() && sd.xeq._scope && sd.xeq.semanticRun < PASS.semantic3done) { uint errors = global.startGagging(); sd.xeq.semantic3(sd.xeq._scope); if (global.endGagging(errors)) sd.xeq = sd.xerreq; } //printf("AA = %s, key: xeq = %p, xhash = %p\n", toChars(), sd.xeq, sd.xhash); const(char)* s = (mtype.index.toBasetype().ty != Tstruct) ? "bottom of " : ""; if (!sd.xeq) { // If sd.xhash != NULL: // sd or its fields have user-defined toHash. // AA assumes that its result is consistent with bitwise equality. // else: // bitwise equality & hashing } else if (sd.xeq == sd.xerreq) { if (search_function(sd, Id.eq)) { .error(loc, "%sAA key type `%s` does not have `bool opEquals(ref const %s) const`", s, sd.toChars(), sd.toChars()); } else { .error(loc, "%sAA key type `%s` does not support const equality", s, sd.toChars()); } return error(); } else if (!sd.xhash) { if (search_function(sd, Id.eq)) { .error(loc, "%sAA key type `%s` should have `extern (D) size_t toHash() const nothrow @safe` if `opEquals` defined", s, sd.toChars()); } else { .error(loc, "%sAA key type `%s` supports const equality but doesn't support const hashing", s, sd.toChars()); } return error(); } else { // defined equality & hashing assert(sd.xeq && sd.xhash); /* xeq and xhash may be implicitly defined by compiler. For example: * struct S { int[] arr; } * With 'arr' field equality and hashing, compiler will implicitly * generate functions for xopEquals and xtoHash in TypeInfo_Struct. */ } } else if (tbase.ty == Tclass && !tbase.isTypeClass().sym.isInterfaceDeclaration()) { ClassDeclaration cd = tbase.isTypeClass().sym; if (cd.semanticRun < PASS.semanticdone) cd.dsymbolSemantic(null); if (!ClassDeclaration.object) { .error(Loc.initial, "missing or corrupt object.d"); fatal(); } __gshared FuncDeclaration feq = null; __gshared FuncDeclaration fcmp = null; __gshared FuncDeclaration fhash = null; if (!feq) feq = search_function(ClassDeclaration.object, Id.eq).isFuncDeclaration(); if (!fcmp) fcmp = search_function(ClassDeclaration.object, Id.cmp).isFuncDeclaration(); if (!fhash) fhash = search_function(ClassDeclaration.object, Id.tohash).isFuncDeclaration(); assert(fcmp && feq && fhash); if (feq.vtblIndex < cd.vtbl.length && cd.vtbl[feq.vtblIndex] == feq) { version (all) { if (fcmp.vtblIndex < cd.vtbl.length && cd.vtbl[fcmp.vtblIndex] != fcmp) { const(char)* s = (mtype.index.toBasetype().ty != Tclass) ? "bottom of " : ""; .error(loc, "%sAA key type `%s` now requires equality rather than comparison", s, cd.toChars()); errorSupplemental(loc, "Please override `Object.opEquals` and `Object.toHash`."); } } } } mtype.next = mtype.next.typeSemantic(loc, sc).merge2(); mtype.transitive(); switch (mtype.next.toBasetype().ty) { case Tfunction: case Tvoid: case Tnone: case Ttuple: .error(loc, "cannot have associative array of `%s`", mtype.next.toChars()); goto case Terror; case Terror: return error(); default: break; } if (mtype.next.isscope()) { .error(loc, "cannot have array of scope `%s`", mtype.next.toChars()); return error(); } return merge(mtype); } Type visitPointer(TypePointer mtype) { //printf("TypePointer::semantic() %s\n", toChars()); if (mtype.deco) { return mtype; } Type n = mtype.next.typeSemantic(loc, sc); switch (n.toBasetype().ty) { case Ttuple: .error(loc, "cannot have pointer to `%s`", n.toChars()); goto case Terror; case Terror: return error(); default: break; } if (n != mtype.next) { mtype.deco = null; } mtype.next = n; if (mtype.next.ty != Tfunction) { mtype.transitive(); return merge(mtype); } version (none) { return merge(mtype); } else { mtype.deco = merge(mtype).deco; /* Don't return merge(), because arg identifiers and default args * can be different * even though the types match */ return mtype; } } Type visitReference(TypeReference mtype) { //printf("TypeReference::semantic()\n"); Type n = mtype.next.typeSemantic(loc, sc); if (n != mtype.next) mtype.deco = null; mtype.next = n; mtype.transitive(); return merge(mtype); } Type visitFunction(TypeFunction mtype) { if (mtype.deco) // if semantic() already run { //printf("already done\n"); return mtype; } //printf("TypeFunction::semantic() this = %p\n", mtype); //printf("TypeFunction::semantic() %s, sc.stc = %llx\n", mtype.toChars(), sc.stc); bool errors = false; if (mtype.inuse > global.recursionLimit) { mtype.inuse = 0; .error(loc, "recursive type"); return error(); } /* Copy in order to not mess up original. * This can produce redundant copies if inferring return type, * as semantic() will get called again on this. */ TypeFunction tf = mtype.copy().toTypeFunction(); if (mtype.parameterList.parameters) { tf.parameterList.parameters = mtype.parameterList.parameters.copy(); for (size_t i = 0; i < mtype.parameterList.parameters.length; i++) { Parameter p = cast(Parameter)mem.xmalloc(__traits(classInstanceSize, Parameter)); memcpy(cast(void*)p, cast(void*)(*mtype.parameterList.parameters)[i], __traits(classInstanceSize, Parameter)); (*tf.parameterList.parameters)[i] = p; } } if (sc.stc & STC.pure_) tf.purity = PURE.fwdref; if (sc.stc & STC.nothrow_) tf.isnothrow = true; if (sc.stc & STC.nogc) tf.isnogc = true; if (sc.stc & STC.ref_) tf.isref = true; if (sc.stc & STC.return_) tf.isreturn = true; if (sc.stc & STC.returnScope) tf.isreturnscope = true; if (sc.stc & STC.returninferred) tf.isreturninferred = true; if (sc.stc & STC.scope_) tf.isScopeQual = true; if (sc.stc & STC.scopeinferred) tf.isscopeinferred = true; // if (tf.isreturn && !tf.isref) // tf.isScopeQual = true; // return by itself means 'return scope' if (tf.trust == TRUST.default_) { if (sc.stc & STC.safe) tf.trust = TRUST.safe; else if (sc.stc & STC.system) tf.trust = TRUST.system; else if (sc.stc & STC.trusted) tf.trust = TRUST.trusted; } if (sc.stc & STC.property) tf.isproperty = true; if (sc.stc & STC.live) tf.islive = true; tf.linkage = sc.linkage; if (tf.linkage == LINK.system) tf.linkage = target.systemLinkage(); version (none) { /* If the parent is @safe, then this function defaults to safe * too. * If the parent's @safe-ty is inferred, then this function's @safe-ty needs * to be inferred first. */ if (tf.trust == TRUST.default_) for (Dsymbol p = sc.func; p; p = p.toParent2()) { FuncDeclaration fd = p.isFuncDeclaration(); if (fd) { if (fd.isSafeBypassingInference()) tf.trust = TRUST.safe; // default to @safe break; } } } bool wildreturn = false; if (tf.next) { sc = sc.push(); sc.stc &= ~(STC.TYPECTOR | STC.FUNCATTR); tf.next = tf.next.typeSemantic(loc, sc); sc = sc.pop(); errors |= tf.checkRetType(loc); if (tf.next.isscope() && !tf.isctor) { .error(loc, "functions cannot return `scope %s`", tf.next.toChars()); errors = true; } if (tf.next.hasWild()) wildreturn = true; if (tf.isreturn && !tf.isref && !tf.next.hasPointers()) { tf.isreturn = false; } } /// Perform semantic on the default argument to a parameter /// Modify the `defaultArg` field of `fparam`, which must not be `null` /// Returns `false` whether an error was encountered. static bool defaultArgSemantic (ref Parameter fparam, Scope* sc) { Expression e = fparam.defaultArg; const isRefOrOut = fparam.isReference(); const isAuto = fparam.storageClass & (STC.auto_ | STC.autoref); if (isRefOrOut && !isAuto) { e = e.expressionSemantic(sc); e = resolveProperties(sc, e); } else { e = inferType(e, fparam.type); Initializer iz = new ExpInitializer(e.loc, e); iz = iz.initializerSemantic(sc, fparam.type, INITnointerpret); e = iz.initializerToExpression(); } if (e.op == EXP.function_) // https://issues.dlang.org/show_bug.cgi?id=4820 { FuncExp fe = e.isFuncExp(); // Replace function literal with a function symbol, // since default arg expression must be copied when used // and copying the literal itself is wrong. e = new VarExp(e.loc, fe.fd, false); e = new AddrExp(e.loc, e); e = e.expressionSemantic(sc); } if (isRefOrOut && (!isAuto || e.isLvalue()) && !MODimplicitConv(e.type.mod, fparam.type.mod)) { const(char)* errTxt = fparam.storageClass & STC.ref_ ? "ref" : "out"; .error(e.loc, "expression `%s` of type `%s` is not implicitly convertible to type `%s %s` of parameter `%s`", e.toChars(), e.type.toChars(), errTxt, fparam.type.toChars(), fparam.toChars()); } e = e.implicitCastTo(sc, fparam.type); // default arg must be an lvalue if (isRefOrOut && !isAuto && !(global.params.previewIn && (fparam.storageClass & STC.in_)) && global.params.rvalueRefParam != FeatureState.enabled) e = e.toLvalue(sc, e); fparam.defaultArg = e; return (e.op != EXP.error); } ubyte wildparams = 0; if (tf.parameterList.parameters) { /* Create a scope for evaluating the default arguments for the parameters */ Scope* argsc = sc.push(); argsc.stc = 0; // don't inherit storage class argsc.visibility = Visibility(Visibility.Kind.public_); argsc.func = null; size_t dim = tf.parameterList.length; for (size_t i = 0; i < dim; i++) { Parameter fparam = tf.parameterList[i]; fparam.storageClass |= STC.parameter; mtype.inuse++; fparam.type = fparam.type.typeSemantic(loc, argsc); mtype.inuse--; if (fparam.type.ty == Terror) { errors = true; continue; } fparam.type = fparam.type.addStorageClass(fparam.storageClass); if (fparam.storageClass & (STC.auto_ | STC.alias_ | STC.static_)) { if (!fparam.type) continue; } fparam.type = fparam.type.cAdjustParamType(sc); // adjust C array and function parameter types Type t = fparam.type.toBasetype(); /* If fparam after semantic() turns out to be a tuple, the number of parameters may * change. */ if (auto tt = t.isTypeTuple()) { /* TypeFunction::parameter also is used as the storage of * Parameter objects for FuncDeclaration. So we should copy * the elements of TypeTuple::arguments to avoid unintended * sharing of Parameter object among other functions. */ if (tt.arguments && tt.arguments.length) { /* Propagate additional storage class from tuple parameters to their * element-parameters. * Make a copy, as original may be referenced elsewhere. */ size_t tdim = tt.arguments.length; auto newparams = new Parameters(tdim); for (size_t j = 0; j < tdim; j++) { Parameter narg = (*tt.arguments)[j]; // https://issues.dlang.org/show_bug.cgi?id=12744 // If the storage classes of narg // conflict with the ones in fparam, it's ignored. StorageClass stc = fparam.storageClass | narg.storageClass; StorageClass stc1 = fparam.storageClass & (STC.ref_ | STC.out_ | STC.lazy_); StorageClass stc2 = narg.storageClass & (STC.ref_ | STC.out_ | STC.lazy_); if (stc1 && stc2 && stc1 != stc2) { OutBuffer buf1; stcToBuffer(&buf1, stc1 | ((stc1 & STC.ref_) ? (fparam.storageClass & STC.auto_) : 0)); OutBuffer buf2; stcToBuffer(&buf2, stc2); .error(loc, "incompatible parameter storage classes `%s` and `%s`", buf1.peekChars(), buf2.peekChars()); errors = true; stc = stc1 | (stc & ~(STC.ref_ | STC.out_ | STC.lazy_)); } (*newparams)[j] = new Parameter( stc, narg.type, narg.ident, narg.defaultArg, narg.userAttribDecl); } fparam.type = new TypeTuple(newparams); fparam.type = fparam.type.typeSemantic(loc, argsc); } fparam.storageClass = STC.parameter; /* Reset number of parameters, and back up one to do this fparam again, * now that it is a tuple */ dim = tf.parameterList.length; i--; continue; } // -preview=in: Always add `ref` when used with `extern(C++)` functions // Done here to allow passing opaque types with `in` if ((fparam.storageClass & (STC.in_ | STC.ref_)) == STC.in_) { switch (tf.linkage) { case LINK.cpp: if (global.params.previewIn) fparam.storageClass |= STC.ref_; break; case LINK.default_, LINK.d: break; default: if (global.params.previewIn) { .error(loc, "cannot use `in` parameters with `extern(%s)` functions", linkageToChars(tf.linkage)); .errorSupplemental(loc, "parameter `%s` declared as `in` here", fparam.toChars()); } else { // Note that this deprecation will not trigger on `in ref` / `ref in` // parameters, however the parser will trigger a deprecation on them. .deprecation(loc, "using `in` parameters with `extern(%s)` functions is deprecated", linkageToChars(tf.linkage)); .deprecationSupplemental(loc, "parameter `%s` declared as `in` here", fparam.toChars()); } break; } } if (t.ty == Tfunction) { .error(loc, "cannot have parameter of function type `%s`", fparam.type.toChars()); errors = true; } else if (!fparam.isReference() && (t.ty == Tstruct || t.ty == Tsarray || t.ty == Tenum)) { Type tb2 = t.baseElemOf(); if (tb2.ty == Tstruct && !tb2.isTypeStruct().sym.members || tb2.ty == Tenum && !tb2.isTypeEnum().sym.memtype) { if (global.params.previewIn && (fparam.storageClass & STC.in_)) { .error(loc, "cannot infer `ref` for `in` parameter `%s` of opaque type `%s`", fparam.toChars(), fparam.type.toChars()); } else .error(loc, "cannot have parameter of opaque type `%s` by value", fparam.type.toChars()); errors = true; } } else if (!fparam.isLazy() && t.ty == Tvoid) { .error(loc, "cannot have parameter of type `%s`", fparam.type.toChars()); errors = true; } const bool isTypesafeVariadic = i + 1 == dim && tf.parameterList.varargs == VarArg.typesafe && (t.isTypeDArray() || t.isTypeClass()); if (isTypesafeVariadic) { /* typesafe variadic arguments are constructed on the stack, so must be `scope` */ fparam.storageClass |= STC.scope_ | STC.scopeinferred; } if (fparam.storageClass & STC.return_) { if (!fparam.isReference()) { if (!(fparam.storageClass & STC.scope_)) fparam.storageClass |= STC.scope_ | STC.scopeinferred; // 'return' implies 'scope' if (tf.isref) { } else if (tf.next && !tf.next.hasPointers() && tf.next.toBasetype().ty != Tvoid) { fparam.storageClass &= ~STC.return_; // https://issues.dlang.org/show_bug.cgi?id=18963 } } if (isTypesafeVariadic) { /* This is because they can be constructed on the stack * https://dlang.org/spec/function.html#typesafe_variadic_functions */ .error(loc, "typesafe variadic function parameter `%s` of type `%s` cannot be marked `return`", fparam.ident ? fparam.ident.toChars() : "", t.toChars()); errors = true; } } if (fparam.storageClass & STC.out_) { if (ubyte m = fparam.type.mod & (MODFlags.immutable_ | MODFlags.const_ | MODFlags.wild)) { .error(loc, "cannot have `%s out` parameter of type `%s`", MODtoChars(m), t.toChars()); errors = true; } else { Type tv = t.baseElemOf(); if (tv.ty == Tstruct && tv.isTypeStruct().sym.noDefaultCtor) { .error(loc, "cannot have `out` parameter of type `%s` because the default construction is disabled", fparam.type.toChars()); errors = true; } } } if (t.hasWild()) { wildparams |= 1; //if (tf.next && !wildreturn) // error(loc, "inout on parameter means inout must be on return type as well (if from D1 code, replace with `ref`)"); } /* Scope attribute is not necessary if the parameter type does not have pointers */ const sr = buildScopeRef(fparam.storageClass); switch (sr) { case ScopeRef.Scope: case ScopeRef.RefScope: case ScopeRef.ReturnRef_Scope: if (!fparam.type.hasPointers()) fparam.storageClass &= ~STC.scope_; break; case ScopeRef.ReturnScope: case ScopeRef.Ref_ReturnScope: if (!fparam.type.hasPointers()) fparam.storageClass &= ~(STC.return_ | STC.scope_ | STC.returnScope); break; default: break; } // Remove redundant storage classes for type, they are already applied fparam.storageClass &= ~(STC.TYPECTOR); // -preview=in: add `ref` storage class to suited `in` params if (global.params.previewIn && (fparam.storageClass & (STC.in_ | STC.ref_)) == STC.in_) { auto ts = t.baseElemOf().isTypeStruct(); const isPOD = !ts || ts.sym.isPOD(); if (!isPOD || target.preferPassByRef(t)) fparam.storageClass |= STC.ref_; } } // Now that we completed semantic for the argument types, // run semantic on their default values, // bearing in mind tuples have been expanded. // We need to keep a pair of [oidx, eidx] (original index, // extended index), as we need to run semantic when `oidx` changes. size_t tupleOrigIdx = size_t.max; size_t tupleExtIdx = size_t.max; foreach (oidx, oparam, eidx, eparam; tf.parameterList) { // oparam (original param) will always have the default arg // if there's one, but `eparam` will not if it's an expanded // tuple. When we see an expanded tuple, we need to save its // position to get the offset in it later on. if (oparam.defaultArg) { // Get the obvious case out of the way if (oparam is eparam) errors |= !defaultArgSemantic(eparam, argsc); // We're seeing a new tuple else if (tupleOrigIdx == size_t.max || tupleOrigIdx < oidx) { /* https://issues.dlang.org/show_bug.cgi?id=18572 * * If a tuple parameter has a default argument, when expanding the parameter * tuple the default argument tuple must also be expanded. */ tupleOrigIdx = oidx; tupleExtIdx = eidx; errors |= !defaultArgSemantic(oparam, argsc); TupleExp te = oparam.defaultArg.isTupleExp(); if (te && te.exps && te.exps.length) eparam.defaultArg = (*te.exps)[0]; } // Processing an already-seen tuple else { TupleExp te = oparam.defaultArg.isTupleExp(); if (te && te.exps && te.exps.length) eparam.defaultArg = (*te.exps)[eidx - tupleExtIdx]; } } // We need to know the default argument to resolve `auto ref`, // hence why this has to take place as the very last step. /* Resolve "auto ref" storage class to be either ref or value, * based on the argument matching the parameter */ if (eparam.storageClass & STC.auto_) { Expression farg = mtype.fargs && eidx < mtype.fargs.length ? (*mtype.fargs)[eidx] : eparam.defaultArg; if (farg && (eparam.storageClass & STC.ref_)) { if (!farg.isLvalue()) eparam.storageClass &= ~STC.ref_; // value parameter eparam.storageClass &= ~STC.auto_; // https://issues.dlang.org/show_bug.cgi?id=14656 eparam.storageClass |= STC.autoref; } else if (mtype.incomplete && (eparam.storageClass & STC.ref_)) { // the default argument may have been temporarily removed, // see usage of `TypeFunction.incomplete`. // https://issues.dlang.org/show_bug.cgi?id=19891 eparam.storageClass &= ~STC.auto_; eparam.storageClass |= STC.autoref; } else if (eparam.storageClass & STC.ref_) { .error(loc, "cannot explicitly instantiate template function with `auto ref` parameter"); errors = true; } else { .error(loc, "`auto` can only be used as part of `auto ref` for template function parameters"); errors = true; } } } argsc.pop(); } if (tf.isWild()) wildparams |= 2; if (wildreturn && !wildparams) { .error(loc, "`inout` on `return` means `inout` must be on a parameter as well for `%s`", mtype.toChars()); errors = true; } tf.isInOutParam = (wildparams & 1) != 0; tf.isInOutQual = (wildparams & 2) != 0; if (tf.isproperty && (tf.parameterList.varargs != VarArg.none || tf.parameterList.length > 2)) { .error(loc, "properties can only have zero, one, or two parameter"); errors = true; } if (tf.parameterList.varargs == VarArg.variadic && tf.linkage != LINK.d && tf.parameterList.length == 0 && !(sc.flags & SCOPE.Cfile)) { .error(loc, "variadic functions with non-D linkage must have at least one parameter"); errors = true; } if (errors) return error(); if (tf.next) tf.deco = tf.merge().deco; /* Don't return merge(), because arg identifiers and default args * can be different * even though the types match */ return tf; } Type visitDelegate(TypeDelegate mtype) { //printf("TypeDelegate::semantic() %s\n", mtype.toChars()); if (mtype.deco) // if semantic() already run { //printf("already done\n"); return mtype; } mtype.next = mtype.next.typeSemantic(loc, sc); if (mtype.next.ty != Tfunction) return error(); /* In order to deal with https://issues.dlang.org/show_bug.cgi?id=4028 * perhaps default arguments should * be removed from next before the merge. */ version (none) { return mtype.merge(); } else { /* Don't return merge(), because arg identifiers and default args * can be different * even though the types match */ mtype.deco = mtype.merge().deco; return mtype; } } Type visitIdentifier(TypeIdentifier mtype) { Type t; Expression e; Dsymbol s; //printf("TypeIdentifier::semantic(%s)\n", mtype.toChars()); mtype.resolve(loc, sc, e, t, s); if (t) { //printf("\tit's a type %d, %s, %s\n", t.ty, t.toChars(), t.deco); return t.addMod(mtype.mod); } else { if (s) { auto td = s.isTemplateDeclaration; if (td && td.onemember && td.onemember.isAggregateDeclaration) .error(loc, "template %s `%s` is used as a type without instantiation" ~ "; to instantiate it use `%s!(arguments)`", s.kind, s.toPrettyChars, s.ident.toChars); else .error(loc, "%s `%s` is used as a type", s.kind, s.toPrettyChars); //assert(0); } else if (e.op == EXP.variable) // special case: variable is used as a type { /* N.B. This branch currently triggers for the following code template test(x* x) { } i.e. the compiler prints "variable x is used as a type" which isn't a particularly good error message (x is a variable?). */ Dsymbol varDecl = mtype.toDsymbol(sc); const(Loc) varDeclLoc = varDecl.getLoc(); Module varDeclModule = varDecl.getModule(); //This can be null .error(loc, "variable `%s` is used as a type", mtype.toChars()); //Check for null to avoid https://issues.dlang.org/show_bug.cgi?id=22574 if ((varDeclModule !is null) && varDeclModule != sc._module) // variable is imported { const(Loc) varDeclModuleImportLoc = varDeclModule.getLoc(); .errorSupplemental( varDeclModuleImportLoc, "variable `%s` is imported here from: `%s`", varDecl.toChars, varDeclModule.toPrettyChars, ); } .errorSupplemental(varDeclLoc, "variable `%s` is declared here", varDecl.toChars); } else .error(loc, "`%s` is used as a type", mtype.toChars()); return error(); } } Type visitInstance(TypeInstance mtype) { Type t; Expression e; Dsymbol s; //printf("TypeInstance::semantic(%p, %s)\n", this, toChars()); { const errors = global.errors; mtype.resolve(loc, sc, e, t, s); // if we had an error evaluating the symbol, suppress further errors if (!t && errors != global.errors) return error(); } if (!t) { if (!e && s && s.errors) { // if there was an error evaluating the symbol, it might actually // be a type. Avoid misleading error messages. .error(loc, "`%s` had previous errors", mtype.toChars()); } else .error(loc, "`%s` is used as a type", mtype.toChars()); return error(); } return t; } Type visitTypeof(TypeTypeof mtype) { //printf("TypeTypeof::semantic() %s\n", mtype.toChars()); Expression e; Type t; Dsymbol s; mtype.resolve(loc, sc, e, t, s); if (s && (t = s.getType()) !is null) t = t.addMod(mtype.mod); if (!t) { .error(loc, "`%s` is used as a type", mtype.toChars()); return error(); } return t; } Type visitTraits(TypeTraits mtype) { Expression e; Type t; Dsymbol s; mtype.resolve(loc, sc, e, t, s); if (!t) { if (!global.errors) .error(mtype.loc, "`%s` does not give a valid type", mtype.toChars); return error(); } return t; } Type visitReturn(TypeReturn mtype) { //printf("TypeReturn::semantic() %s\n", toChars()); Expression e; Type t; Dsymbol s; mtype.resolve(loc, sc, e, t, s); if (s && (t = s.getType()) !is null) t = t.addMod(mtype.mod); if (!t) { .error(loc, "`%s` is used as a type", mtype.toChars()); return error(); } return t; } Type visitStruct(TypeStruct mtype) { //printf("TypeStruct::semantic('%s')\n", mtype.toChars()); if (mtype.deco) return mtype; /* Don't semantic for sym because it should be deferred until * sizeof needed or its members accessed. */ // instead, parent should be set correctly assert(mtype.sym.parent); if (mtype.sym.type.ty == Terror) return error(); return merge(mtype); } Type visitEnum(TypeEnum mtype) { //printf("TypeEnum::semantic() %s\n", toChars()); return mtype.deco ? mtype : merge(mtype); } Type visitClass(TypeClass mtype) { //printf("TypeClass::semantic(%s)\n", mtype.toChars()); if (mtype.deco) return mtype; /* Don't semantic for sym because it should be deferred until * sizeof needed or its members accessed. */ // instead, parent should be set correctly assert(mtype.sym.parent); if (mtype.sym.type.ty == Terror) return error(); return merge(mtype); } Type visitTuple(TypeTuple mtype) { //printf("TypeTuple::semantic(this = %p)\n", this); //printf("TypeTuple::semantic() %p, %s\n", this, toChars()); if (!mtype.deco) mtype.deco = merge(mtype).deco; /* Don't return merge(), because a tuple with one type has the * same deco as that type. */ return mtype; } Type visitSlice(TypeSlice mtype) { //printf("TypeSlice::semantic() %s\n", toChars()); Type tn = mtype.next.typeSemantic(loc, sc); //printf("next: %s\n", tn.toChars()); Type tbn = tn.toBasetype(); if (tbn.ty != Ttuple) { .error(loc, "can only slice tuple types, not `%s`", tbn.toChars()); return error(); } TypeTuple tt = cast(TypeTuple)tbn; mtype.lwr = semanticLength(sc, tbn, mtype.lwr); mtype.upr = semanticLength(sc, tbn, mtype.upr); mtype.lwr = mtype.lwr.ctfeInterpret(); mtype.upr = mtype.upr.ctfeInterpret(); if (mtype.lwr.op == EXP.error || mtype.upr.op == EXP.error) return error(); uinteger_t i1 = mtype.lwr.toUInteger(); uinteger_t i2 = mtype.upr.toUInteger(); if (!(i1 <= i2 && i2 <= tt.arguments.length)) { .error(loc, "slice `[%llu..%llu]` is out of range of `[0..%llu]`", cast(ulong)i1, cast(ulong)i2, cast(ulong)tt.arguments.length); return error(); } mtype.next = tn; mtype.transitive(); auto args = new Parameters(); args.reserve(cast(size_t)(i2 - i1)); foreach (arg; (*tt.arguments)[cast(size_t)i1 .. cast(size_t)i2]) { args.push(arg); } Type t = new TypeTuple(args); return t.typeSemantic(loc, sc); } Type visitMixin(TypeMixin mtype) { //printf("TypeMixin::semantic() %s\n", toChars()); Expression e; Type t; Dsymbol s; mtype.resolve(loc, sc, e, t, s); if (t && t.ty != Terror) return t; .error(mtype.loc, "`mixin(%s)` does not give a valid type", mtype.obj.toChars); return error(); } Type visitTag(TypeTag mtype) { //printf("TypeTag.semantic() %s\n", mtype.toChars()); if (mtype.resolved) { /* struct S s, *p; */ return mtype.resolved.addSTC(mtype.mod); } /* Find the current scope by skipping tag scopes. * In C, tag scopes aren't considered scopes. */ Scope* sc2 = sc; while (1) { sc2 = sc2.inner(); auto scopesym = sc2.scopesym; if (scopesym.isStructDeclaration()) { sc2 = sc2.enclosing; continue; } break; } /* Declare mtype as a struct/union/enum declaration */ void declareTag() { void declare(ScopeDsymbol sd) { sd.members = mtype.members; auto scopesym = sc2.inner().scopesym; if (scopesym.members) scopesym.members.push(sd); if (scopesym.symtab && !scopesym.symtabInsert(sd)) { Dsymbol s2 = scopesym.symtabLookup(sd, mtype.id); handleTagSymbols(*sc2, sd, s2, scopesym); } sd.parent = sc2.parent; sd.dsymbolSemantic(sc2); } switch (mtype.tok) { case TOK.enum_: auto ed = new EnumDeclaration(mtype.loc, mtype.id, mtype.base); declare(ed); mtype.resolved = visitEnum(new TypeEnum(ed)); break; case TOK.struct_: auto sd = new StructDeclaration(mtype.loc, mtype.id, false); sd.alignment = mtype.packalign; declare(sd); mtype.resolved = visitStruct(new TypeStruct(sd)); break; case TOK.union_: auto ud = new UnionDeclaration(mtype.loc, mtype.id); ud.alignment = mtype.packalign; declare(ud); mtype.resolved = visitStruct(new TypeStruct(ud)); break; default: assert(0); } } /* If it doesn't have a tag by now, supply one. * It'll be unique, and therefore introducing. * Declare it, and done. */ if (!mtype.id) { mtype.id = Identifier.generateId("__tag"[]); declareTag(); return mtype.resolved.addSTC(mtype.mod); } /* look for pre-existing declaration */ Dsymbol scopesym; auto s = sc2.search(mtype.loc, mtype.id, &scopesym, IgnoreErrors | TagNameSpace); if (!s || s.isModule()) { // no pre-existing declaration, so declare it if (mtype.tok == TOK.enum_ && !mtype.members) .error(mtype.loc, "`enum %s` is incomplete without members", mtype.id.toChars()); // C11 6.7.2.3-3 declareTag(); return mtype.resolved.addSTC(mtype.mod); } /* A redeclaration only happens if both declarations are in * the same scope */ const bool redeclar = (scopesym == sc2.inner().scopesym); if (redeclar) { if (mtype.tok == TOK.enum_ && s.isEnumDeclaration()) { auto ed = s.isEnumDeclaration(); if (mtype.members && ed.members) .error(mtype.loc, "`%s` already has members", mtype.id.toChars()); else if (!ed.members) { ed.members = mtype.members; } else { } mtype.resolved = ed.type; } else if (mtype.tok == TOK.union_ && s.isUnionDeclaration() || mtype.tok == TOK.struct_ && s.isStructDeclaration()) { // Add members to original declaration auto sd = s.isStructDeclaration(); if (mtype.members && sd.members) { /* struct S { int b; }; * struct S { int a; } *s; */ .error(mtype.loc, "`%s` already has members", mtype.id.toChars()); } else if (!sd.members) { /* struct S; * struct S { int a; } *s; */ sd.members = mtype.members; if (sd.semanticRun == PASS.semanticdone) { /* The first semantic pass marked `sd` as an opaque struct. * Re-run semantic so that all newly assigned members are * picked up and added to the symtab. */ sd.semanticRun = PASS.semantic; sd.dsymbolSemantic(sc2); } } else { /* struct S { int a; }; * struct S *s; */ } mtype.resolved = sd.type; } else { /* int S; * struct S { int a; } *s; */ .error(mtype.loc, "redeclaration of `%s`", mtype.id.toChars()); mtype.resolved = error(); } } else if (mtype.members) { /* struct S; * { struct S { int a; } *s; } */ declareTag(); } else { if (mtype.tok == TOK.enum_ && s.isEnumDeclaration()) { mtype.resolved = s.isEnumDeclaration().type; } else if (mtype.tok == TOK.union_ && s.isUnionDeclaration() || mtype.tok == TOK.struct_ && s.isStructDeclaration()) { /* struct S; * { struct S *s; } */ mtype.resolved = s.isStructDeclaration().type; } else { /* union S; * { struct S *s; } */ .error(mtype.loc, "redeclaring `%s %s` as `%s %s`", s.kind(), s.toChars(), Token.toChars(mtype.tok), mtype.id.toChars()); declareTag(); } } return mtype.resolved.addSTC(mtype.mod); } switch (type.ty) { default: return visitType(type); case Tcomplex32: case Tcomplex64: case Tcomplex80: return visitComplex(type.isTypeBasic()); case Tvector: return visitVector(type.isTypeVector()); case Tsarray: return visitSArray(type.isTypeSArray()); case Tarray: return visitDArray(type.isTypeDArray()); case Taarray: return visitAArray(type.isTypeAArray()); case Tpointer: return visitPointer(type.isTypePointer()); case Treference: return visitReference(type.isTypeReference()); case Tfunction: return visitFunction(type.isTypeFunction()); case Tdelegate: return visitDelegate(type.isTypeDelegate()); case Tident: return visitIdentifier(type.isTypeIdentifier()); case Tinstance: return visitInstance(type.isTypeInstance()); case Ttypeof: return visitTypeof(type.isTypeTypeof()); case Ttraits: return visitTraits(type.isTypeTraits()); case Treturn: return visitReturn(type.isTypeReturn()); case Tstruct: return visitStruct(type.isTypeStruct()); case Tenum: return visitEnum(type.isTypeEnum()); case Tclass: return visitClass(type.isTypeClass()); case Ttuple: return visitTuple(type.isTypeTuple()); case Tslice: return visitSlice(type.isTypeSlice()); case Tmixin: return visitMixin(type.isTypeMixin()); case Ttag: return visitTag(type.isTypeTag()); } } /************************************ * If an identical type to `type` is in `type.stringtable`, return * the latter one. Otherwise, add it to `type.stringtable`. * Some types don't get merged and are returned as-is. * Params: * type = Type to check against existing types * Returns: * the type that was merged */ extern (C++) Type merge(Type type) { switch (type.ty) { case Terror: case Ttypeof: case Tident: case Tinstance: case Tmixin: case Ttag: return type; // don't merge placeholder types case Tsarray: // prevents generating the mangle if the array dim is not yet known if (!type.isTypeSArray().dim.isIntegerExp()) return type; goto default; case Tenum: break; case Taarray: if (!type.isTypeAArray().index.merge().deco) return type; goto default; default: if (type.nextOf() && !type.nextOf().deco) return type; break; } //printf("merge(%s)\n", toChars()); if (!type.deco) { OutBuffer buf; buf.reserve(32); mangleToBuffer(type, &buf); auto sv = type.stringtable.update(buf[]); if (sv.value) { Type t = sv.value; debug { import core.stdc.stdio; if (!t.deco) printf("t = %s\n", t.toChars()); } assert(t.deco); //printf("old value, deco = '%s' %p\n", t.deco, t.deco); return t; } else { Type t = stripDefaultArgs(type); sv.value = t; type.deco = t.deco = cast(char*)sv.toDchars(); //printf("new value, deco = '%s' %p\n", t.deco, t.deco); return t; } } return type; } /*************************************** * Calculate built-in properties which just the type is necessary. * * Params: * t = the type for which the property is calculated * scope_ = the scope from which the property is being accessed. Used for visibility checks only. * loc = the location where the property is encountered * ident = the identifier of the property * flag = if flag & 1, don't report "not a property" error and just return NULL. * src = expression for type `t` or null. * Returns: * expression representing the property, or null if not a property and (flag & 1) */ Expression getProperty(Type t, Scope* scope_, const ref Loc loc, Identifier ident, int flag, Expression src = null) { Expression visitType(Type mt) { Expression e; static if (LOGDOTEXP) { printf("Type::getProperty(type = '%s', ident = '%s')\n", mt.toChars(), ident.toChars()); } if (ident == Id.__sizeof) { const sz = mt.size(loc); if (sz == SIZE_INVALID) return ErrorExp.get(); e = new IntegerExp(loc, sz, Type.tsize_t); } else if (ident == Id.__xalignof) { const explicitAlignment = mt.alignment(); const naturalAlignment = mt.alignsize(); const actualAlignment = (explicitAlignment.isDefault() ? naturalAlignment : explicitAlignment.get()); e = new IntegerExp(loc, actualAlignment, Type.tsize_t); } else if (ident == Id._init) { Type tb = mt.toBasetype(); e = mt.defaultInitLiteral(loc); if (tb.ty == Tstruct && tb.needsNested()) { e.isStructLiteralExp().useStaticInit = true; } } else if (ident == Id._mangleof) { if (!mt.deco) { error(loc, "forward reference of type `%s.mangleof`", mt.toChars()); e = ErrorExp.get(); } else { e = new StringExp(loc, mt.deco.toDString()); Scope sc; e = e.expressionSemantic(&sc); } } else if (ident == Id.stringof) { const s = mt.toChars(); e = new StringExp(loc, s.toDString()); Scope sc; e = e.expressionSemantic(&sc); } else if (flag && mt != Type.terror) { return null; } else { Dsymbol s = null; if (mt.ty == Tstruct || mt.ty == Tclass || mt.ty == Tenum) s = mt.toDsymbol(null); if (s) s = s.search_correct(ident); if (s && !symbolIsVisible(scope_, s)) s = null; if (mt != Type.terror) { if (s) error(loc, "no property `%s` for type `%s`, did you mean `%s`?", ident.toChars(), mt.toChars(), s.toPrettyChars()); else if (ident == Id.call && mt.ty == Tclass) error(loc, "no property `%s` for type `%s`, did you mean `new %s`?", ident.toChars(), mt.toChars(), mt.toPrettyChars()); else if (const n = importHint(ident.toString())) error(loc, "no property `%s` for type `%s`, perhaps `import %.*s;` is needed?", ident.toChars(), mt.toChars(), cast(int)n.length, n.ptr); else { if (src) error(loc, "no property `%s` for `%s` of type `%s`", ident.toChars(), src.toChars(), mt.toPrettyChars(true)); else error(loc, "no property `%s` for type `%s`", ident.toChars(), mt.toPrettyChars(true)); if (auto dsym = mt.toDsymbol(scope_)) if (auto sym = dsym.isAggregateDeclaration()) { if (auto fd = search_function(sym, Id.opDispatch)) errorSupplemental(loc, "potentially malformed `opDispatch`. Use an explicit instantiation to get a better error message"); else if (!sym.members) errorSupplemental(sym.loc, "`%s %s` is opaque and has no members.", sym.kind, mt.toPrettyChars(true)); } } } e = ErrorExp.get(); } return e; } Expression visitError(TypeError) { return ErrorExp.get(); } Expression visitBasic(TypeBasic mt) { Expression integerValue(dinteger_t i) { return new IntegerExp(loc, i, mt); } Expression intValue(dinteger_t i) { return new IntegerExp(loc, i, Type.tint32); } Expression floatValue(real_t r) { if (mt.isreal() || mt.isimaginary()) return new RealExp(loc, r, mt); else { return new ComplexExp(loc, complex_t(r, r), mt); } } //printf("TypeBasic::getProperty('%s')\n", ident.toChars()); if (ident == Id.max) { switch (mt.ty) { case Tint8: return integerValue(byte.max); case Tuns8: return integerValue(ubyte.max); case Tint16: return integerValue(short.max); case Tuns16: return integerValue(ushort.max); case Tint32: return integerValue(int.max); case Tuns32: return integerValue(uint.max); case Tint64: return integerValue(long.max); case Tuns64: return integerValue(ulong.max); case Tbool: return integerValue(bool.max); case Tchar: return integerValue(char.max); case Twchar: return integerValue(wchar.max); case Tdchar: return integerValue(dchar.max); case Tcomplex32: case Timaginary32: case Tfloat32: return floatValue(target.FloatProperties.max); case Tcomplex64: case Timaginary64: case Tfloat64: return floatValue(target.DoubleProperties.max); case Tcomplex80: case Timaginary80: case Tfloat80: return floatValue(target.RealProperties.max); default: break; } } else if (ident == Id.min) { switch (mt.ty) { case Tint8: return integerValue(byte.min); case Tuns8: case Tuns16: case Tuns32: case Tuns64: case Tbool: case Tchar: case Twchar: case Tdchar: return integerValue(0); case Tint16: return integerValue(short.min); case Tint32: return integerValue(int.min); case Tint64: return integerValue(long.min); default: break; } } else if (ident == Id.min_normal) { switch (mt.ty) { case Tcomplex32: case Timaginary32: case Tfloat32: return floatValue(target.FloatProperties.min_normal); case Tcomplex64: case Timaginary64: case Tfloat64: return floatValue(target.DoubleProperties.min_normal); case Tcomplex80: case Timaginary80: case Tfloat80: return floatValue(target.RealProperties.min_normal); default: break; } } else if (ident == Id.nan) { switch (mt.ty) { case Tcomplex32: case Tcomplex64: case Tcomplex80: case Timaginary32: case Timaginary64: case Timaginary80: case Tfloat32: case Tfloat64: case Tfloat80: return floatValue(target.RealProperties.nan); default: break; } } else if (ident == Id.infinity) { switch (mt.ty) { case Tcomplex32: case Tcomplex64: case Tcomplex80: case Timaginary32: case Timaginary64: case Timaginary80: case Tfloat32: case Tfloat64: case Tfloat80: return floatValue(target.RealProperties.infinity); default: break; } } else if (ident == Id.dig) { switch (mt.ty) { case Tcomplex32: case Timaginary32: case Tfloat32: return intValue(target.FloatProperties.dig); case Tcomplex64: case Timaginary64: case Tfloat64: return intValue(target.DoubleProperties.dig); case Tcomplex80: case Timaginary80: case Tfloat80: return intValue(target.RealProperties.dig); default: break; } } else if (ident == Id.epsilon) { switch (mt.ty) { case Tcomplex32: case Timaginary32: case Tfloat32: return floatValue(target.FloatProperties.epsilon); case Tcomplex64: case Timaginary64: case Tfloat64: return floatValue(target.DoubleProperties.epsilon); case Tcomplex80: case Timaginary80: case Tfloat80: return floatValue(target.RealProperties.epsilon); default: break; } } else if (ident == Id.mant_dig) { switch (mt.ty) { case Tcomplex32: case Timaginary32: case Tfloat32: return intValue(target.FloatProperties.mant_dig); case Tcomplex64: case Timaginary64: case Tfloat64: return intValue(target.DoubleProperties.mant_dig); case Tcomplex80: case Timaginary80: case Tfloat80: return intValue(target.RealProperties.mant_dig); default: break; } } else if (ident == Id.max_10_exp) { switch (mt.ty) { case Tcomplex32: case Timaginary32: case Tfloat32: return intValue(target.FloatProperties.max_10_exp); case Tcomplex64: case Timaginary64: case Tfloat64: return intValue(target.DoubleProperties.max_10_exp); case Tcomplex80: case Timaginary80: case Tfloat80: return intValue(target.RealProperties.max_10_exp); default: break; } } else if (ident == Id.max_exp) { switch (mt.ty) { case Tcomplex32: case Timaginary32: case Tfloat32: return intValue(target.FloatProperties.max_exp); case Tcomplex64: case Timaginary64: case Tfloat64: return intValue(target.DoubleProperties.max_exp); case Tcomplex80: case Timaginary80: case Tfloat80: return intValue(target.RealProperties.max_exp); default: break; } } else if (ident == Id.min_10_exp) { switch (mt.ty) { case Tcomplex32: case Timaginary32: case Tfloat32: return intValue(target.FloatProperties.min_10_exp); case Tcomplex64: case Timaginary64: case Tfloat64: return intValue(target.DoubleProperties.min_10_exp); case Tcomplex80: case Timaginary80: case Tfloat80: return intValue(target.RealProperties.min_10_exp); default: break; } } else if (ident == Id.min_exp) { switch (mt.ty) { case Tcomplex32: case Timaginary32: case Tfloat32: return intValue(target.FloatProperties.min_exp); case Tcomplex64: case Timaginary64: case Tfloat64: return intValue(target.DoubleProperties.min_exp); case Tcomplex80: case Timaginary80: case Tfloat80: return intValue(target.RealProperties.min_exp); default: break; } } return visitType(mt); } Expression visitVector(TypeVector mt) { return visitType(mt); } Expression visitEnum(TypeEnum mt) { Expression e; if (ident == Id.max || ident == Id.min) { return mt.sym.getMaxMinValue(loc, ident); } else if (ident == Id._init) { e = mt.defaultInitLiteral(loc); } else if (ident == Id.stringof) { e = new StringExp(loc, mt.toString()); Scope sc; e = e.expressionSemantic(&sc); } else if (ident == Id._mangleof) { e = visitType(mt); } else { e = mt.toBasetype().getProperty(scope_, loc, ident, flag); } return e; } Expression visitTuple(TypeTuple mt) { Expression e; static if (LOGDOTEXP) { printf("TypeTuple::getProperty(type = '%s', ident = '%s')\n", mt.toChars(), ident.toChars()); } if (ident == Id.length) { e = new IntegerExp(loc, mt.arguments.length, Type.tsize_t); } else if (ident == Id._init) { e = mt.defaultInitLiteral(loc); } else if (flag) { e = null; } else { error(loc, "no property `%s` for tuple `%s`", ident.toChars(), mt.toChars()); e = ErrorExp.get(); } return e; } switch (t.ty) { default: return t.isTypeBasic() ? visitBasic(cast(TypeBasic)t) : visitType(t); case Terror: return visitError (t.isTypeError()); case Tvector: return visitVector(t.isTypeVector()); case Tenum: return visitEnum (t.isTypeEnum()); case Ttuple: return visitTuple (t.isTypeTuple()); } } /*************************************** * Determine if Expression `exp` should instead be a Type, a Dsymbol, or remain an Expression. * Params: * exp = Expression to look at * t = if exp should be a Type, set t to that Type else null * s = if exp should be a Dsymbol, set s to that Dsymbol else null * e = if exp should remain an Expression, set e to that Expression else null * */ private void resolveExp(Expression exp, out Type t, out Expression e, out Dsymbol s) { if (exp.isTypeExp()) t = exp.type; else if (auto ve = exp.isVarExp()) { if (auto v = ve.var.isVarDeclaration()) e = exp; else s = ve.var; } else if (auto te = exp.isTemplateExp()) s = te.td; else if (auto se = exp.isScopeExp()) s = se.sds; else if (exp.isFuncExp()) s = getDsymbol(exp); else if (auto dte = exp.isDotTemplateExp()) s = dte.td; else if (exp.isErrorExp()) t = Type.terror; else e = exp; } /************************************ * Resolve type 'mt' to either type, symbol, or expression. * If errors happened, resolved to Type.terror. * * Params: * mt = type to be resolved * loc = the location where the type is encountered * sc = the scope of the type * pe = is set if t is an expression * pt = is set if t is a type * ps = is set if t is a symbol * intypeid = true if in type id */ void resolve(Type mt, const ref Loc loc, Scope* sc, out Expression pe, out Type pt, out Dsymbol ps, bool intypeid = false) { void returnExp(Expression e) { pe = e; pt = null; ps = null; } void returnType(Type t) { pe = null; pt = t; ps = null; } void returnSymbol(Dsymbol s) { pe = null; pt = null; ps = s; } void returnError() { returnType(Type.terror); } void visitType(Type mt) { //printf("Type::resolve() %s, %d\n", mt.toChars(), mt.ty); Type t = typeSemantic(mt, loc, sc); assert(t); returnType(t); } void visitSArray(TypeSArray mt) { //printf("TypeSArray::resolve() %s\n", mt.toChars()); mt.next.resolve(loc, sc, pe, pt, ps, intypeid); //printf("s = %p, e = %p, t = %p\n", ps, pe, pt); if (pe) { // It's really an index expression if (Dsymbol s = getDsymbol(pe)) pe = new DsymbolExp(loc, s); returnExp(new ArrayExp(loc, pe, mt.dim)); } else if (ps) { Dsymbol s = ps; if (auto tup = s.isTupleDeclaration()) { mt.dim = semanticLength(sc, tup, mt.dim); mt.dim = mt.dim.ctfeInterpret(); if (mt.dim.op == EXP.error) return returnError(); const d = mt.dim.toUInteger(); if (d >= tup.objects.length) { error(loc, "tuple index `%llu` out of bounds `[0 .. %llu]`", d, cast(ulong) tup.objects.length); return returnError(); } RootObject o = (*tup.objects)[cast(size_t)d]; switch (o.dyncast()) with (DYNCAST) { case dsymbol: return returnSymbol(cast(Dsymbol)o); case expression: Expression e = cast(Expression)o; if (e.op == EXP.dSymbol) return returnSymbol(e.isDsymbolExp().s); else return returnExp(e); case type: return returnType((cast(Type)o).addMod(mt.mod)); default: break; } /* Create a new TupleDeclaration which * is a slice [d..d+1] out of the old one. * Do it this way because TemplateInstance::semanticTiargs() * can handle unresolved Objects this way. */ auto objects = new Objects(1); (*objects)[0] = o; return returnSymbol(new TupleDeclaration(loc, tup.ident, objects)); } else return visitType(mt); } else { if (pt.ty != Terror) mt.next = pt; // prevent re-running semantic() on 'next' visitType(mt); } } void visitDArray(TypeDArray mt) { //printf("TypeDArray::resolve() %s\n", mt.toChars()); mt.next.resolve(loc, sc, pe, pt, ps, intypeid); //printf("s = %p, e = %p, t = %p\n", ps, pe, pt); if (pe) { // It's really a slice expression if (Dsymbol s = getDsymbol(pe)) pe = new DsymbolExp(loc, s); returnExp(new ArrayExp(loc, pe)); } else if (ps) { if (auto tup = ps.isTupleDeclaration()) { // keep ps } else visitType(mt); } else { if (pt.ty != Terror) mt.next = pt; // prevent re-running semantic() on 'next' visitType(mt); } } void visitAArray(TypeAArray mt) { //printf("TypeAArray::resolve() %s\n", mt.toChars()); // Deal with the case where we thought the index was a type, but // in reality it was an expression. if (mt.index.ty == Tident || mt.index.ty == Tinstance || mt.index.ty == Tsarray) { Expression e; Type t; Dsymbol s; mt.index.resolve(loc, sc, e, t, s, intypeid); if (e) { // It was an expression - // Rewrite as a static array auto tsa = new TypeSArray(mt.next, e); tsa.mod = mt.mod; // just copy mod field so tsa's semantic is not yet done return tsa.resolve(loc, sc, pe, pt, ps, intypeid); } else if (t) mt.index = t; else .error(loc, "index is not a type or an expression"); } visitType(mt); } /************************************* * Takes an array of Identifiers and figures out if * it represents a Type or an Expression. * Output: * if expression, pe is set * if type, pt is set */ void visitIdentifier(TypeIdentifier mt) { //printf("TypeIdentifier::resolve(sc = %p, idents = '%s')\n", sc, mt.toChars()); if (mt.ident == Id.ctfe) { error(loc, "variable `__ctfe` cannot be read at compile time"); return returnError(); } if (mt.ident == Id.builtin_va_list) // gcc has __builtin_va_xxxx for stdarg.h { /* Since we don't support __builtin_va_start, -arg, -end, we don't * have to actually care what -list is. A void* will do. * If we ever do care, import core.stdc.stdarg and pull * the definition out of that, similarly to how std.math is handled for PowExp */ pt = target.va_listType(loc, sc); return; } Dsymbol scopesym; Dsymbol s = sc.search(loc, mt.ident, &scopesym); /* * https://issues.dlang.org/show_bug.cgi?id=1170 * https://issues.dlang.org/show_bug.cgi?id=10739 * * If a symbol is not found, it might be declared in * a mixin-ed string or a mixin-ed template, so before * issuing an error semantically analyze all string/template * mixins that are members of the current ScopeDsymbol. */ if (!s && sc.enclosing) { ScopeDsymbol sds = sc.enclosing.scopesym; if (sds && sds.members) { void semanticOnMixin(Dsymbol member) { if (auto compileDecl = member.isMixinDeclaration()) compileDecl.dsymbolSemantic(sc); else if (auto mixinTempl = member.isTemplateMixin()) mixinTempl.dsymbolSemantic(sc); } sds.members.foreachDsymbol( s => semanticOnMixin(s) ); s = sc.search(loc, mt.ident, &scopesym); } } if (s) { // https://issues.dlang.org/show_bug.cgi?id=16042 // If `f` is really a function template, then replace `f` // with the function template declaration. if (auto f = s.isFuncDeclaration()) { if (auto td = getFuncTemplateDecl(f)) { // If not at the beginning of the overloaded list of // `TemplateDeclaration`s, then get the beginning if (td.overroot) td = td.overroot; s = td; } } } mt.resolveHelper(loc, sc, s, scopesym, pe, pt, ps, intypeid); if (pt) pt = pt.addMod(mt.mod); } void visitInstance(TypeInstance mt) { // Note close similarity to TypeIdentifier::resolve() //printf("TypeInstance::resolve(sc = %p, tempinst = '%s')\n", sc, mt.tempinst.toChars()); mt.tempinst.dsymbolSemantic(sc); if (!global.gag && mt.tempinst.errors) return returnError(); mt.resolveHelper(loc, sc, mt.tempinst, null, pe, pt, ps, intypeid); if (pt) pt = pt.addMod(mt.mod); //if (pt) printf("pt = %d '%s'\n", pt.ty, pt.toChars()); } void visitTypeof(TypeTypeof mt) { //printf("TypeTypeof::resolve(this = %p, sc = %p, idents = '%s')\n", mt, sc, mt.toChars()); //static int nest; if (++nest == 50) *(char*)0=0; if (sc is null) { error(loc, "invalid scope"); return returnError(); } if (mt.inuse) { mt.inuse = 2; error(loc, "circular `typeof` definition"); Lerr: mt.inuse--; return returnError(); } mt.inuse++; /* Currently we cannot evaluate 'exp' in speculative context, because * the type implementation may leak to the final execution. Consider: * * struct S(T) { * string toString() const { return "x"; } * } * void main() { * alias X = typeof(S!int()); * assert(typeid(X).toString() == "x"); * } */ Scope* sc2 = sc.push(); if (!mt.exp.isTypeidExp()) /* Treat typeof(typeid(exp)) as needing * the full semantic analysis of the typeid. * https://issues.dlang.org/show_bug.cgi?id=20958 */ sc2.intypeof = 1; auto exp2 = mt.exp.expressionSemantic(sc2); exp2 = resolvePropertiesOnly(sc2, exp2); sc2.pop(); if (exp2.op == EXP.error) { if (!global.gag) mt.exp = exp2; goto Lerr; } mt.exp = exp2; if (mt.exp.op == EXP.type || mt.exp.op == EXP.scope_) { if (!(sc.flags & SCOPE.Cfile) && // in (extended) C typeof may be used on types as with sizeof mt.exp.checkType()) goto Lerr; /* Today, 'typeof(func)' returns void if func is a * function template (TemplateExp), or * template lambda (FuncExp). * It's actually used in Phobos as an idiom, to branch code for * template functions. */ } if (auto f = mt.exp.op == EXP.variable ? mt.exp.isVarExp().var.isFuncDeclaration() : mt.exp.op == EXP.dotVariable ? mt.exp.isDotVarExp().var.isFuncDeclaration() : null) { // f might be a unittest declaration which is incomplete when compiled // without -unittest. That causes a segfault in checkForwardRef, see // https://issues.dlang.org/show_bug.cgi?id=20626 if ((!f.isUnitTestDeclaration() || global.params.useUnitTests) && f.checkForwardRef(loc)) goto Lerr; } if (auto f = isFuncAddress(mt.exp)) { if (f.checkForwardRef(loc)) goto Lerr; } Type t = mt.exp.type; if (!t) { error(loc, "expression `%s` has no type", mt.exp.toChars()); goto Lerr; } if (t.ty == Ttypeof) { error(loc, "forward reference to `%s`", mt.toChars()); goto Lerr; } if (mt.idents.length == 0) { returnType(t.addMod(mt.mod)); } else { if (Dsymbol s = t.toDsymbol(sc)) mt.resolveHelper(loc, sc, s, null, pe, pt, ps, intypeid); else { auto e = typeToExpressionHelper(mt, new TypeExp(loc, t)); e = e.expressionSemantic(sc); resolveExp(e, pt, pe, ps); } if (pt) pt = pt.addMod(mt.mod); } mt.inuse--; } void visitReturn(TypeReturn mt) { //printf("TypeReturn::resolve(sc = %p, idents = '%s')\n", sc, mt.toChars()); Type t; { FuncDeclaration func = sc.func; if (!func) { error(loc, "`typeof(return)` must be inside function"); return returnError(); } if (func.fes) func = func.fes.func; t = func.type.nextOf(); if (!t) { error(loc, "cannot use `typeof(return)` inside function `%s` with inferred return type", sc.func.toChars()); return returnError(); } } if (mt.idents.length == 0) { return returnType(t.addMod(mt.mod)); } else { if (Dsymbol s = t.toDsymbol(sc)) mt.resolveHelper(loc, sc, s, null, pe, pt, ps, intypeid); else { auto e = typeToExpressionHelper(mt, new TypeExp(loc, t)); e = e.expressionSemantic(sc); resolveExp(e, pt, pe, ps); } if (pt) pt = pt.addMod(mt.mod); } } void visitSlice(TypeSlice mt) { mt.next.resolve(loc, sc, pe, pt, ps, intypeid); if (pe) { // It's really a slice expression if (Dsymbol s = getDsymbol(pe)) pe = new DsymbolExp(loc, s); return returnExp(new ArrayExp(loc, pe, new IntervalExp(loc, mt.lwr, mt.upr))); } else if (ps) { Dsymbol s = ps; TupleDeclaration td = s.isTupleDeclaration(); if (td) { /* It's a slice of a TupleDeclaration */ ScopeDsymbol sym = new ArrayScopeSymbol(sc, td); sym.parent = sc.scopesym; sc = sc.push(sym); sc = sc.startCTFE(); mt.lwr = mt.lwr.expressionSemantic(sc); mt.upr = mt.upr.expressionSemantic(sc); sc = sc.endCTFE(); sc = sc.pop(); mt.lwr = mt.lwr.ctfeInterpret(); mt.upr = mt.upr.ctfeInterpret(); const i1 = mt.lwr.toUInteger(); const i2 = mt.upr.toUInteger(); if (!(i1 <= i2 && i2 <= td.objects.length)) { error(loc, "slice `[%llu..%llu]` is out of range of [0..%llu]", i1, i2, cast(ulong) td.objects.length); return returnError(); } if (i1 == 0 && i2 == td.objects.length) { return returnSymbol(td); } /* Create a new TupleDeclaration which * is a slice [i1..i2] out of the old one. */ auto objects = new Objects(cast(size_t)(i2 - i1)); for (size_t i = 0; i < objects.length; i++) { (*objects)[i] = (*td.objects)[cast(size_t)i1 + i]; } return returnSymbol(new TupleDeclaration(loc, td.ident, objects)); } else visitType(mt); } else { if (pt.ty != Terror) mt.next = pt; // prevent re-running semantic() on 'next' visitType(mt); } } void visitMixin(TypeMixin mt) { RootObject o = mt.obj; // if already resolved just set pe/pt/ps and return. if (o) { pe = o.isExpression(); pt = o.isType(); ps = o.isDsymbol(); return; } o = mt.compileTypeMixin(loc, sc); if (auto t = o.isType()) { resolve(t, loc, sc, pe, pt, ps, intypeid); if (pt) pt = pt.addMod(mt.mod); } else if (auto e = o.isExpression()) { e = e.expressionSemantic(sc); if (auto et = e.isTypeExp()) returnType(et.type.addMod(mt.mod)); else returnExp(e); } else returnError(); // save the result mt.obj = pe ? pe : (pt ? pt : ps); } void visitTraits(TypeTraits mt) { // if already resolved just return the cached object. if (mt.obj) { pt = mt.obj.isType(); ps = mt.obj.isDsymbol(); pe = mt.obj.isExpression(); return; } import dmd.traits : semanticTraits; if (Expression e = semanticTraits(mt.exp, sc)) { switch (e.op) { case EXP.dotVariable: mt.obj = e.isDotVarExp().var; break; case EXP.variable: mt.obj = e.isVarExp().var; break; case EXP.function_: auto fe = e.isFuncExp(); mt.obj = fe.td ? fe.td : fe.fd; break; case EXP.dotTemplateDeclaration: mt.obj = e.isDotTemplateExp().td; break; case EXP.dSymbol: mt.obj = e.isDsymbolExp().s; break; case EXP.template_: mt.obj = e.isTemplateExp().td; break; case EXP.scope_: mt.obj = e.isScopeExp().sds; break; case EXP.tuple: TupleExp te = e.isTupleExp(); Objects* elems = new Objects(te.exps.length); foreach (i; 0 .. elems.length) { auto src = (*te.exps)[i]; switch (src.op) { case EXP.type: (*elems)[i] = src.isTypeExp().type; break; case EXP.dotType: (*elems)[i] = src.isDotTypeExp().sym.isType(); break; case EXP.overloadSet: (*elems)[i] = src.isOverExp().type; break; default: if (auto sym = isDsymbol(src)) (*elems)[i] = sym; else (*elems)[i] = src; } } TupleDeclaration td = new TupleDeclaration(e.loc, Identifier.generateId("__aliastup"), elems); mt.obj = td; break; case EXP.dotType: mt.obj = e.isDotTypeExp().sym.isType(); break; case EXP.type: mt.obj = e.isTypeExp().type; break; case EXP.overloadSet: mt.obj = e.isOverExp().type; break; case EXP.error: break; default: mt.obj = e; break; } } if (mt.obj) { if (auto t = mt.obj.isType()) { t = t.addMod(mt.mod); mt.obj = t; returnType(t); } else if (auto s = mt.obj.isDsymbol()) returnSymbol(s); else if (auto e = mt.obj.isExpression()) returnExp(e); } else { assert(global.errors); mt.obj = Type.terror; return returnError(); } } switch (mt.ty) { default: visitType (mt); break; case Tsarray: visitSArray (mt.isTypeSArray()); break; case Tarray: visitDArray (mt.isTypeDArray()); break; case Taarray: visitAArray (mt.isTypeAArray()); break; case Tident: visitIdentifier(mt.isTypeIdentifier()); break; case Tinstance: visitInstance (mt.isTypeInstance()); break; case Ttypeof: visitTypeof (mt.isTypeTypeof()); break; case Treturn: visitReturn (mt.isTypeReturn()); break; case Tslice: visitSlice (mt.isTypeSlice()); break; case Tmixin: visitMixin (mt.isTypeMixin()); break; case Ttraits: visitTraits (mt.isTypeTraits()); break; } } /************************ * Access the members of the object e. This type is same as e.type. * Params: * mt = type for which the dot expression is used * sc = instantiating scope * e = expression to convert * ident = identifier being used * flag = DotExpFlag bit flags * * Returns: * resulting expression with e.ident resolved */ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, int flag) { Expression visitType(Type mt) { VarDeclaration v = null; static if (LOGDOTEXP) { printf("Type::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } Expression ex = e.lastComma(); if (ex.op == EXP.dotVariable) { DotVarExp dv = cast(DotVarExp)ex; v = dv.var.isVarDeclaration(); } else if (ex.op == EXP.variable) { VarExp ve = cast(VarExp)ex; v = ve.var.isVarDeclaration(); } if (v) { if (ident == Id.offsetof) { v.dsymbolSemantic(null); if (v.isField()) { auto ad = v.isMember(); objc.checkOffsetof(e, ad); ad.size(e.loc); if (ad.sizeok != Sizeok.done) return ErrorExp.get(); return new IntegerExp(e.loc, v.offset, Type.tsize_t); } } else if (ident == Id._init) { Type tb = mt.toBasetype(); e = mt.defaultInitLiteral(e.loc); if (tb.ty == Tstruct && tb.needsNested()) { e.isStructLiteralExp().useStaticInit = true; } goto Lreturn; } } if (ident == Id.stringof) { /* https://issues.dlang.org/show_bug.cgi?id=3796 * this should demangle e.type.deco rather than * pretty-printing the type. */ e = new StringExp(e.loc, e.toString()); } else e = mt.getProperty(sc, e.loc, ident, flag & DotExpFlag.gag); Lreturn: if (e) e = e.expressionSemantic(sc); return e; } Expression visitError(TypeError) { return ErrorExp.get(); } Expression visitBasic(TypeBasic mt) { static if (LOGDOTEXP) { printf("TypeBasic::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } Type t; if (ident == Id.re) { switch (mt.ty) { case Tcomplex32: t = mt.tfloat32; goto L1; case Tcomplex64: t = mt.tfloat64; goto L1; case Tcomplex80: t = mt.tfloat80; goto L1; L1: e = e.castTo(sc, t); break; case Tfloat32: case Tfloat64: case Tfloat80: break; case Timaginary32: t = mt.tfloat32; goto L2; case Timaginary64: t = mt.tfloat64; goto L2; case Timaginary80: t = mt.tfloat80; goto L2; L2: e = new RealExp(e.loc, CTFloat.zero, t); break; default: e = mt.Type.getProperty(sc, e.loc, ident, flag); break; } } else if (ident == Id.im) { Type t2; switch (mt.ty) { case Tcomplex32: t = mt.timaginary32; t2 = mt.tfloat32; goto L3; case Tcomplex64: t = mt.timaginary64; t2 = mt.tfloat64; goto L3; case Tcomplex80: t = mt.timaginary80; t2 = mt.tfloat80; goto L3; L3: e = e.castTo(sc, t); e.type = t2; break; case Timaginary32: t = mt.tfloat32; goto L4; case Timaginary64: t = mt.tfloat64; goto L4; case Timaginary80: t = mt.tfloat80; goto L4; L4: e = e.copy(); e.type = t; break; case Tfloat32: case Tfloat64: case Tfloat80: e = new RealExp(e.loc, CTFloat.zero, mt); break; default: e = mt.Type.getProperty(sc, e.loc, ident, flag); break; } } else { return visitType(mt); } if (!(flag & 1) || e) e = e.expressionSemantic(sc); return e; } Expression visitVector(TypeVector mt) { static if (LOGDOTEXP) { printf("TypeVector::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } if (ident == Id.ptr && e.op == EXP.call) { /* The trouble with EXP.call is the return ABI for float[4] is different from * __vector(float[4]), and a type paint won't do. */ e = new AddrExp(e.loc, e); e = e.expressionSemantic(sc); return e.castTo(sc, mt.basetype.nextOf().pointerTo()); } if (ident == Id.array) { //e = e.castTo(sc, basetype); // Keep lvalue-ness e = new VectorArrayExp(e.loc, e); e = e.expressionSemantic(sc); return e; } if (ident == Id._init || ident == Id.offsetof || ident == Id.stringof || ident == Id.__xalignof) { // init should return a new VectorExp // https://issues.dlang.org/show_bug.cgi?id=12776 // offsetof does not work on a cast expression, so use e directly // stringof should not add a cast to the output return visitType(mt); } // Properties based on the vector element type and are values of the element type if (ident == Id.max || ident == Id.min || ident == Id.min_normal || ident == Id.nan || ident == Id.infinity || ident == Id.epsilon) { auto vet = mt.basetype.isTypeSArray().next; // vector element type if (auto ev = getProperty(vet, sc, e.loc, ident, DotExpFlag.gag)) return ev.castTo(sc, mt); // 'broadcast' ev to the vector elements } return mt.basetype.dotExp(sc, e.castTo(sc, mt.basetype), ident, flag); } Expression visitArray(TypeArray mt) { static if (LOGDOTEXP) { printf("TypeArray::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } e = visitType(mt); if (!(flag & 1) || e) e = e.expressionSemantic(sc); return e; } Expression visitSArray(TypeSArray mt) { static if (LOGDOTEXP) { printf("TypeSArray::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } if (ident == Id.length) { Loc oldLoc = e.loc; e = mt.dim.copy(); e.loc = oldLoc; } else if (ident == Id.ptr) { if (e.op == EXP.type) { e.error("`%s` is not an expression", e.toChars()); return ErrorExp.get(); } else if (mt.dim.toUInteger() < 1 && checkUnsafeDotExp(sc, e, ident, flag)) { // .ptr on static array is @safe unless size is 0 // https://issues.dlang.org/show_bug.cgi?id=20853 return ErrorExp.get(); } e = e.castTo(sc, e.type.nextOf().pointerTo()); } else if (ident == Id._tupleof) { if (e.isTypeExp()) { e.error("`.tupleof` cannot be used on type `%s`", mt.toChars); return ErrorExp.get(); } else { Expression e0; Expression ev = e; ev = extractSideEffect(sc, "__tup", e0, ev); const length = cast(size_t)mt.dim.toUInteger(); auto exps = new Expressions(); exps.reserve(length); foreach (i; 0 .. length) exps.push(new IndexExp(e.loc, ev, new IntegerExp(e.loc, i, Type.tsize_t))); e = new TupleExp(e.loc, e0, exps); } } else { e = visitArray(mt); } if (!(flag & 1) || e) e = e.expressionSemantic(sc); return e; } Expression visitDArray(TypeDArray mt) { static if (LOGDOTEXP) { printf("TypeDArray::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } if (e.op == EXP.type && (ident == Id.length || ident == Id.ptr)) { e.error("`%s` is not an expression", e.toChars()); return ErrorExp.get(); } if (ident == Id.length) { if (e.op == EXP.string_) { StringExp se = cast(StringExp)e; return new IntegerExp(se.loc, se.len, Type.tsize_t); } if (e.op == EXP.null_) { return new IntegerExp(e.loc, 0, Type.tsize_t); } if (checkNonAssignmentArrayOp(e)) { return ErrorExp.get(); } e = new ArrayLengthExp(e.loc, e); e.type = Type.tsize_t; return e; } else if (ident == Id.ptr) { if (checkUnsafeDotExp(sc, e, ident, flag)) return ErrorExp.get(); return e.castTo(sc, mt.next.pointerTo()); } else { return visitArray(mt); } } Expression visitAArray(TypeAArray mt) { static if (LOGDOTEXP) { printf("TypeAArray::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } if (ident == Id.length) { __gshared FuncDeclaration fd_aaLen = null; if (fd_aaLen is null) { auto fparams = new Parameters(); fparams.push(new Parameter(STC.const_ | STC.scope_, mt, null, null, null)); fd_aaLen = FuncDeclaration.genCfunc(fparams, Type.tsize_t, Id.aaLen); TypeFunction tf = fd_aaLen.type.toTypeFunction(); tf.purity = PURE.const_; tf.isnothrow = true; tf.isnogc = false; } Expression ev = new VarExp(e.loc, fd_aaLen, false); e = new CallExp(e.loc, ev, e); e.type = fd_aaLen.type.toTypeFunction().next; return e; } else { return visitType(mt); } } Expression visitReference(TypeReference mt) { static if (LOGDOTEXP) { printf("TypeReference::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } // References just forward things along return mt.next.dotExp(sc, e, ident, flag); } Expression visitDelegate(TypeDelegate mt) { static if (LOGDOTEXP) { printf("TypeDelegate::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } if (ident == Id.ptr) { e = new DelegatePtrExp(e.loc, e); e = e.expressionSemantic(sc); } else if (ident == Id.funcptr) { if (checkUnsafeDotExp(sc, e, ident, flag)) { return ErrorExp.get(); } e = new DelegateFuncptrExp(e.loc, e); e = e.expressionSemantic(sc); } else { return visitType(mt); } return e; } /*************************************** * `ident` was not found as a member of `mt`. * Attempt to use overloaded opDot(), overloaded opDispatch(), or `alias this`. * If that fails, forward to visitType(). * Params: * mt = class or struct * sc = context * e = `this` for `ident` * ident = name of member * flag = flag & 1, don't report "not a property" error and just return NULL. * flag & DotExpFlag.noAliasThis, don't do 'alias this' resolution. * Returns: * resolved expression if found, otherwise null */ Expression noMember(Type mt, Scope* sc, Expression e, Identifier ident, int flag) { //printf("Type.noMember(e: %s ident: %s flag: %d)\n", e.toChars(), ident.toChars(), flag); bool gagError = flag & 1; __gshared int nest; // https://issues.dlang.org/show_bug.cgi?id=17380 static Expression returnExp(Expression e) { --nest; return e; } if (++nest > global.recursionLimit) { .error(e.loc, "cannot resolve identifier `%s`", ident.toChars()); return returnExp(gagError ? null : ErrorExp.get()); } assert(mt.ty == Tstruct || mt.ty == Tclass); auto sym = mt.toDsymbol(sc).isAggregateDeclaration(); assert(sym); if (// https://issues.dlang.org/show_bug.cgi?id=22054 // if a class or struct does not have a body // there is no point in searching for its members sym.members && ident != Id.__sizeof && ident != Id.__xalignof && ident != Id._init && ident != Id._mangleof && ident != Id.stringof && ident != Id.offsetof && // https://issues.dlang.org/show_bug.cgi?id=15045 // Don't forward special built-in member functions. ident != Id.ctor && ident != Id.dtor && ident != Id.__xdtor && ident != Id.postblit && ident != Id.__xpostblit) { /* Look for overloaded opDot() to see if we should forward request * to it. */ if (auto fd = search_function(sym, Id.opDot)) { /* Rewrite e.ident as: * e.opDot().ident */ e = build_overload(e.loc, sc, e, null, fd); // @@@DEPRECATED_2.110@@@. // Deprecated in 2.082, made an error in 2.100. e.error("`opDot` is obsolete. Use `alias this`"); return ErrorExp.get(); } /* Look for overloaded opDispatch to see if we should forward request * to it. */ if (auto fd = search_function(sym, Id.opDispatch)) { /* Rewrite e.ident as: * e.opDispatch!("ident") */ TemplateDeclaration td = fd.isTemplateDeclaration(); if (!td) { fd.error("must be a template `opDispatch(string s)`, not a %s", fd.kind()); return returnExp(ErrorExp.get()); } auto se = new StringExp(e.loc, ident.toString()); auto tiargs = new Objects(); tiargs.push(se); auto dti = new DotTemplateInstanceExp(e.loc, e, Id.opDispatch, tiargs); dti.ti.tempdecl = td; /* opDispatch, which doesn't need IFTI, may occur instantiate error. * e.g. * template opDispatch(name) if (isValid!name) { ... } */ uint errors = gagError ? global.startGagging() : 0; e = dti.dotTemplateSemanticProp(sc, 0); if (gagError && global.endGagging(errors)) e = null; return returnExp(e); } /* See if we should forward to the alias this. */ auto alias_e = flag & DotExpFlag.noAliasThis ? null : resolveAliasThis(sc, e, gagError); if (alias_e && alias_e != e) { /* Rewrite e.ident as: * e.aliasthis.ident */ auto die = new DotIdExp(e.loc, alias_e, ident); auto errors = gagError ? 0 : global.startGagging(); auto exp = die.dotIdSemanticProp(sc, gagError); if (!gagError) { global.endGagging(errors); if (exp && exp.op == EXP.error) exp = null; } if (exp && gagError) // now that we know that the alias this leads somewhere useful, // go back and print deprecations/warnings that we skipped earlier due to the gag resolveAliasThis(sc, e, false); return returnExp(exp); } } return returnExp(visitType(mt)); } Expression visitStruct(TypeStruct mt) { Dsymbol s; static if (LOGDOTEXP) { printf("TypeStruct::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } assert(e.op != EXP.dot); // https://issues.dlang.org/show_bug.cgi?id=14010 if (!(sc.flags & SCOPE.Cfile) && ident == Id._mangleof) { return mt.getProperty(sc, e.loc, ident, flag & 1); } /* If e.tupleof */ if (ident == Id._tupleof) { /* Create a TupleExp out of the fields of the struct e: * (e.field0, e.field1, e.field2, ...) */ e = e.expressionSemantic(sc); // do this before turning on noaccesscheck if (!mt.sym.determineFields()) { error(e.loc, "unable to determine fields of `%s` because of forward references", mt.toChars()); } Expression e0; Expression ev = e.op == EXP.type ? null : e; if (ev) ev = extractSideEffect(sc, "__tup", e0, ev); auto exps = new Expressions(); exps.reserve(mt.sym.fields.length); for (size_t i = 0; i < mt.sym.fields.length; i++) { VarDeclaration v = mt.sym.fields[i]; Expression ex; if (ev) ex = new DotVarExp(e.loc, ev, v); else { ex = new VarExp(e.loc, v); ex.type = ex.type.addMod(e.type.mod); } exps.push(ex); } e = new TupleExp(e.loc, e0, exps); Scope* sc2 = sc.push(); sc2.flags |= SCOPE.noaccesscheck; e = e.expressionSemantic(sc2); sc2.pop(); return e; } immutable flags = sc.flags & SCOPE.ignoresymbolvisibility ? IgnoreSymbolVisibility : 0; s = mt.sym.search(e.loc, ident, flags | IgnorePrivateImports); L1: if (!s) { return noMember(mt, sc, e, ident, flag); } if (!(sc.flags & SCOPE.ignoresymbolvisibility) && !symbolIsVisible(sc, s)) { return noMember(mt, sc, e, ident, flag); } // check before alias resolution; the alias itself might be deprecated! if (s.isAliasDeclaration) e.checkDeprecated(sc, s); s = s.toAlias(); if (auto em = s.isEnumMember()) { return em.getVarExp(e.loc, sc); } if (auto v = s.isVarDeclaration()) { v.checkDeprecated(e.loc, sc); v.checkDisabled(e.loc, sc); if (!v.type || !v.type.deco && v.inuse) { if (v.inuse) // https://issues.dlang.org/show_bug.cgi?id=9494 e.error("circular reference to %s `%s`", v.kind(), v.toPrettyChars()); else e.error("forward reference to %s `%s`", v.kind(), v.toPrettyChars()); return ErrorExp.get(); } if (v.type.ty == Terror) { return ErrorExp.get(); } if ((v.storage_class & STC.manifest) && v._init) { if (v.inuse) { e.error("circular initialization of %s `%s`", v.kind(), v.toPrettyChars()); return ErrorExp.get(); } checkAccess(e.loc, sc, null, v); Expression ve = new VarExp(e.loc, v); if (!isTrivialExp(e)) { ve = new CommaExp(e.loc, e, ve); } return ve.expressionSemantic(sc); } } if (auto t = s.getType()) { return (new TypeExp(e.loc, t)).expressionSemantic(sc); } TemplateMixin tm = s.isTemplateMixin(); if (tm) { return new DotExp(e.loc, e, new ScopeExp(e.loc, tm)).expressionSemantic(sc); } TemplateDeclaration td = s.isTemplateDeclaration(); if (td) { if (e.op == EXP.type) e = new TemplateExp(e.loc, td); else e = new DotTemplateExp(e.loc, e, td); return e.expressionSemantic(sc); } TemplateInstance ti = s.isTemplateInstance(); if (ti) { if (!ti.semanticRun) { ti.dsymbolSemantic(sc); if (!ti.inst || ti.errors) // if template failed to expand { return ErrorExp.get(); } } s = ti.inst.toAlias(); if (!s.isTemplateInstance()) goto L1; if (e.op == EXP.type) e = new ScopeExp(e.loc, ti); else e = new DotExp(e.loc, e, new ScopeExp(e.loc, ti)); return e.expressionSemantic(sc); } if (s.isImport() || s.isModule() || s.isPackage()) { return symbolToExp(s, e.loc, sc, false); } OverloadSet o = s.isOverloadSet(); if (o) { auto oe = new OverExp(e.loc, o); if (e.op == EXP.type) { return oe; } return new DotExp(e.loc, e, oe); } Declaration d = s.isDeclaration(); if (!d) { e.error("`%s.%s` is not a declaration", e.toChars(), ident.toChars()); return ErrorExp.get(); } if (e.op == EXP.type) { /* It's: * Struct.d */ if (TupleDeclaration tup = d.isTupleDeclaration()) { e = new TupleExp(e.loc, tup); return e.expressionSemantic(sc); } if (d.needThis() && sc.intypeof != 1) { /* Rewrite as: * this.d * * only if the scope in which we are * has a `this` that matches the type * of the lhs of the dot expression. * * https://issues.dlang.org/show_bug.cgi?id=23617 */ auto fd = hasThis(sc); if (fd && fd.isThis() == mt.sym) { e = new DotVarExp(e.loc, new ThisExp(e.loc), d); return e.expressionSemantic(sc); } } if (d.semanticRun == PASS.initial) d.dsymbolSemantic(null); checkAccess(e.loc, sc, e, d); auto ve = new VarExp(e.loc, d); if (d.isVarDeclaration() && d.needThis()) ve.type = d.type.addMod(e.type.mod); return ve; } bool unreal = e.op == EXP.variable && (cast(VarExp)e).var.isField(); if (d.isDataseg() || unreal && d.isField()) { // (e, d) checkAccess(e.loc, sc, e, d); Expression ve = new VarExp(e.loc, d); e = unreal ? ve : new CommaExp(e.loc, e, ve); return e.expressionSemantic(sc); } e = new DotVarExp(e.loc, e, d); return e.expressionSemantic(sc); } Expression visitEnum(TypeEnum mt) { static if (LOGDOTEXP) { printf("TypeEnum::dotExp(e = '%s', ident = '%s') '%s'\n", e.toChars(), ident.toChars(), mt.toChars()); } // https://issues.dlang.org/show_bug.cgi?id=14010 if (ident == Id._mangleof) { return mt.getProperty(sc, e.loc, ident, flag & 1); } if (mt.sym.semanticRun < PASS.semanticdone) mt.sym.dsymbolSemantic(null); Dsymbol s = mt.sym.search(e.loc, ident); if (!s) { if (ident == Id._init) { return mt.getProperty(sc, e.loc, ident, flag & 1); } /* Allow special enums to not need a member list */ if ((ident == Id.max || ident == Id.min) && (mt.sym.members || !mt.sym.isSpecial())) { return mt.getProperty(sc, e.loc, ident, flag & 1); } Expression res = mt.sym.getMemtype(Loc.initial).dotExp(sc, e, ident, 1); if (!(flag & 1) && !res) { if (auto ns = mt.sym.search_correct(ident)) e.error("no property `%s` for type `%s`. Did you mean `%s.%s` ?", ident.toChars(), mt.toChars(), mt.toChars(), ns.toChars()); else e.error("no property `%s` for type `%s`", ident.toChars(), mt.toChars()); return ErrorExp.get(); } return res; } EnumMember m = s.isEnumMember(); return m.getVarExp(e.loc, sc); } Expression visitClass(TypeClass mt) { Dsymbol s; static if (LOGDOTEXP) { printf("TypeClass::dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); } assert(e.op != EXP.dot); // https://issues.dlang.org/show_bug.cgi?id=12543 if (ident == Id.__sizeof || ident == Id.__xalignof || ident == Id._mangleof) { return mt.Type.getProperty(sc, e.loc, ident, 0); } /* If e.tupleof */ if (ident == Id._tupleof) { objc.checkTupleof(e, mt); /* Create a TupleExp */ e = e.expressionSemantic(sc); // do this before turning on noaccesscheck mt.sym.size(e.loc); // do semantic of type Expression e0; Expression ev = e.op == EXP.type ? null : e; if (ev) ev = extractSideEffect(sc, "__tup", e0, ev); auto exps = new Expressions(); exps.reserve(mt.sym.fields.length); for (size_t i = 0; i < mt.sym.fields.length; i++) { VarDeclaration v = mt.sym.fields[i]; // Don't include hidden 'this' pointer if (v.isThisDeclaration()) continue; Expression ex; if (ev) ex = new DotVarExp(e.loc, ev, v); else { ex = new VarExp(e.loc, v); ex.type = ex.type.addMod(e.type.mod); } exps.push(ex); } e = new TupleExp(e.loc, e0, exps); Scope* sc2 = sc.push(); sc2.flags |= SCOPE.noaccesscheck; e = e.expressionSemantic(sc2); sc2.pop(); return e; } int flags = sc.flags & SCOPE.ignoresymbolvisibility ? IgnoreSymbolVisibility : 0; s = mt.sym.search(e.loc, ident, flags | IgnorePrivateImports); L1: if (!s) { // See if it's a 'this' class or a base class if (mt.sym.ident == ident) { if (e.op == EXP.type) { return mt.Type.getProperty(sc, e.loc, ident, 0); } e = new DotTypeExp(e.loc, e, mt.sym); e = e.expressionSemantic(sc); return e; } if (auto cbase = mt.sym.searchBase(ident)) { if (e.op == EXP.type) { return mt.Type.getProperty(sc, e.loc, ident, 0); } if (auto ifbase = cbase.isInterfaceDeclaration()) e = new CastExp(e.loc, e, ifbase.type); else e = new DotTypeExp(e.loc, e, cbase); e = e.expressionSemantic(sc); return e; } if (ident == Id.classinfo) { if (!Type.typeinfoclass) { error(e.loc, "`object.TypeInfo_Class` could not be found, but is implicitly used"); return ErrorExp.get(); } Type t = Type.typeinfoclass.type; if (e.op == EXP.type || e.op == EXP.dotType) { /* For type.classinfo, we know the classinfo * at compile time. */ if (!mt.sym.vclassinfo) mt.sym.vclassinfo = new TypeInfoClassDeclaration(mt.sym.type); e = new VarExp(e.loc, mt.sym.vclassinfo); e = e.addressOf(); e.type = t; // do this so we don't get redundant dereference } else { /* For class objects, the classinfo reference is the first * entry in the vtbl[] */ e = new PtrExp(e.loc, e); e.type = t.pointerTo(); if (mt.sym.isInterfaceDeclaration()) { if (mt.sym.isCPPinterface()) { /* C++ interface vtbl[]s are different in that the * first entry is always pointer to the first virtual * function, not classinfo. * We can't get a .classinfo for it. */ error(e.loc, "no `.classinfo` for C++ interface objects"); } /* For an interface, the first entry in the vtbl[] * is actually a pointer to an instance of struct Interface. * The first member of Interface is the .classinfo, * so add an extra pointer indirection. */ e.type = e.type.pointerTo(); e = new PtrExp(e.loc, e); e.type = t.pointerTo(); } e = new PtrExp(e.loc, e, t); } return e; } if (ident == Id.__vptr) { /* The pointer to the vtbl[] * *cast(immutable(void*)**)e */ e = e.castTo(sc, mt.tvoidptr.immutableOf().pointerTo().pointerTo()); e = new PtrExp(e.loc, e); e = e.expressionSemantic(sc); return e; } if (ident == Id.__monitor && mt.sym.hasMonitor()) { /* The handle to the monitor (call it a void*) * *(cast(void**)e + 1) */ e = e.castTo(sc, mt.tvoidptr.pointerTo()); e = new AddExp(e.loc, e, IntegerExp.literal!1); e = new PtrExp(e.loc, e); e = e.expressionSemantic(sc); return e; } if (ident == Id.outer && mt.sym.vthis) { if (mt.sym.vthis.semanticRun == PASS.initial) mt.sym.vthis.dsymbolSemantic(null); if (auto cdp = mt.sym.toParentLocal().isClassDeclaration()) { auto dve = new DotVarExp(e.loc, e, mt.sym.vthis); dve.type = cdp.type.addMod(e.type.mod); return dve; } /* https://issues.dlang.org/show_bug.cgi?id=15839 * Find closest parent class through nested functions. */ for (auto p = mt.sym.toParentLocal(); p; p = p.toParentLocal()) { auto fd = p.isFuncDeclaration(); if (!fd) break; auto ad = fd.isThis(); if (!ad && fd.isNested()) continue; if (!ad) break; if (auto cdp = ad.isClassDeclaration()) { auto ve = new ThisExp(e.loc); ve.var = fd.vthis; const nestedError = fd.vthis.checkNestedReference(sc, e.loc); assert(!nestedError); ve.type = cdp.type.addMod(fd.vthis.type.mod).addMod(e.type.mod); return ve; } break; } // Continue to show enclosing function's frame (stack or closure). auto dve = new DotVarExp(e.loc, e, mt.sym.vthis); dve.type = mt.sym.vthis.type.addMod(e.type.mod); return dve; } return noMember(mt, sc, e, ident, flag & 1); } if (!(sc.flags & SCOPE.ignoresymbolvisibility) && !symbolIsVisible(sc, s)) { return noMember(mt, sc, e, ident, flag); } if (!s.isFuncDeclaration()) // because of overloading { s.checkDeprecated(e.loc, sc); if (auto d = s.isDeclaration()) d.checkDisabled(e.loc, sc); } s = s.toAlias(); if (auto em = s.isEnumMember()) { return em.getVarExp(e.loc, sc); } if (auto v = s.isVarDeclaration()) { if (!v.type || !v.type.deco && v.inuse) { if (v.inuse) // https://issues.dlang.org/show_bug.cgi?id=9494 e.error("circular reference to %s `%s`", v.kind(), v.toPrettyChars()); else e.error("forward reference to %s `%s`", v.kind(), v.toPrettyChars()); return ErrorExp.get(); } if (v.type.ty == Terror) { e.error("type of variable `%s` has errors", v.toPrettyChars); return ErrorExp.get(); } if ((v.storage_class & STC.manifest) && v._init) { if (v.inuse) { e.error("circular initialization of %s `%s`", v.kind(), v.toPrettyChars()); return ErrorExp.get(); } checkAccess(e.loc, sc, null, v); Expression ve = new VarExp(e.loc, v); ve = ve.expressionSemantic(sc); return ve; } } if (auto t = s.getType()) { return (new TypeExp(e.loc, t)).expressionSemantic(sc); } TemplateMixin tm = s.isTemplateMixin(); if (tm) { return new DotExp(e.loc, e, new ScopeExp(e.loc, tm)).expressionSemantic(sc); } TemplateDeclaration td = s.isTemplateDeclaration(); Expression toTemplateExp(TemplateDeclaration td) { if (e.op == EXP.type) e = new TemplateExp(e.loc, td); else e = new DotTemplateExp(e.loc, e, td); e = e.expressionSemantic(sc); return e; } if (td) { return toTemplateExp(td); } TemplateInstance ti = s.isTemplateInstance(); if (ti) { if (!ti.semanticRun) { ti.dsymbolSemantic(sc); if (!ti.inst || ti.errors) // if template failed to expand { return ErrorExp.get(); } } s = ti.inst.toAlias(); if (!s.isTemplateInstance()) goto L1; if (e.op == EXP.type) e = new ScopeExp(e.loc, ti); else e = new DotExp(e.loc, e, new ScopeExp(e.loc, ti)); return e.expressionSemantic(sc); } if (s.isImport() || s.isModule() || s.isPackage()) { e = symbolToExp(s, e.loc, sc, false); return e; } OverloadSet o = s.isOverloadSet(); if (o) { auto oe = new OverExp(e.loc, o); if (e.op == EXP.type) { return oe; } return new DotExp(e.loc, e, oe); } Declaration d = s.isDeclaration(); if (!d) { e.error("`%s.%s` is not a declaration", e.toChars(), ident.toChars()); return ErrorExp.get(); } if (e.op == EXP.type) { /* It's: * Class.d */ if (TupleDeclaration tup = d.isTupleDeclaration()) { e = new TupleExp(e.loc, tup); e = e.expressionSemantic(sc); return e; } if (mt.sym.classKind == ClassKind.objc && d.isFuncDeclaration() && d.isFuncDeclaration().isStatic && d.isFuncDeclaration().objc.selector) { auto classRef = new ObjcClassReferenceExp(e.loc, mt.sym); return new DotVarExp(e.loc, classRef, d).expressionSemantic(sc); } else if (d.needThis() && sc.intypeof != 1) { /* Rewrite as: * this.d */ AggregateDeclaration ad = d.isMemberLocal(); if (auto f = hasThis(sc)) { // This is almost same as getRightThis() in expressionsem.d Expression e1; Type t; /* returns: true to continue, false to return */ if (f.hasDualContext()) { if (f.followInstantiationContext(ad)) { e1 = new VarExp(e.loc, f.vthis); e1 = new PtrExp(e1.loc, e1); e1 = new IndexExp(e1.loc, e1, IntegerExp.literal!1); auto pd = f.toParent2().isDeclaration(); assert(pd); t = pd.type.toBasetype(); e1 = getThisSkipNestedFuncs(e1.loc, sc, f.toParent2(), ad, e1, t, d, true); if (!e1) { e = new VarExp(e.loc, d); return e; } goto L2; } } e1 = new ThisExp(e.loc); e1 = e1.expressionSemantic(sc); L2: t = e1.type.toBasetype(); ClassDeclaration cd = e.type.isClassHandle(); ClassDeclaration tcd = t.isClassHandle(); if (cd && tcd && (tcd == cd || cd.isBaseOf(tcd, null))) { e = new DotTypeExp(e1.loc, e1, cd); e = new DotVarExp(e.loc, e, d); e = e.expressionSemantic(sc); return e; } if (tcd && tcd.isNested()) { /* e1 is the 'this' pointer for an inner class: tcd. * Rewrite it as the 'this' pointer for the outer class. */ auto vthis = tcd.followInstantiationContext(ad) ? tcd.vthis2 : tcd.vthis; e1 = new DotVarExp(e.loc, e1, vthis); e1.type = vthis.type; e1.type = e1.type.addMod(t.mod); // Do not call ensureStaticLinkTo() //e1 = e1.expressionSemantic(sc); // Skip up over nested functions, and get the enclosing // class type. e1 = getThisSkipNestedFuncs(e1.loc, sc, tcd.toParentP(ad), ad, e1, t, d, true); if (!e1) { e = new VarExp(e.loc, d); return e; } goto L2; } } } //printf("e = %s, d = %s\n", e.toChars(), d.toChars()); if (d.semanticRun == PASS.initial) d.dsymbolSemantic(null); // If static function, get the most visible overload. // Later on the call is checked for correctness. // https://issues.dlang.org/show_bug.cgi?id=12511 Dsymbol d2 = d; if (auto fd = d.isFuncDeclaration()) { import dmd.access : mostVisibleOverload; d2 = mostVisibleOverload(fd, sc._module); } checkAccess(e.loc, sc, e, d2); if (d2.isDeclaration()) { d = cast(Declaration)d2; auto ve = new VarExp(e.loc, d); if (d.isVarDeclaration() && d.needThis()) ve.type = d.type.addMod(e.type.mod); return ve; } else if (d2.isTemplateDeclaration()) { return toTemplateExp(cast(TemplateDeclaration)d2); } else assert(0); } bool unreal = e.op == EXP.variable && (cast(VarExp)e).var.isField(); if (d.isDataseg() || unreal && d.isField()) { // (e, d) checkAccess(e.loc, sc, e, d); Expression ve = new VarExp(e.loc, d); e = unreal ? ve : new CommaExp(e.loc, e, ve); e = e.expressionSemantic(sc); return e; } e = new DotVarExp(e.loc, e, d); e = e.expressionSemantic(sc); return e; } switch (mt.ty) { case Tvector: return visitVector (mt.isTypeVector()); case Tsarray: return visitSArray (mt.isTypeSArray()); case Tstruct: return visitStruct (mt.isTypeStruct()); case Tenum: return visitEnum (mt.isTypeEnum()); case Terror: return visitError (mt.isTypeError()); case Tarray: return visitDArray (mt.isTypeDArray()); case Taarray: return visitAArray (mt.isTypeAArray()); case Treference: return visitReference(mt.isTypeReference()); case Tdelegate: return visitDelegate (mt.isTypeDelegate()); case Tclass: return visitClass (mt.isTypeClass()); default: return mt.isTypeBasic() ? visitBasic(cast(TypeBasic)mt) : visitType(mt); } } /************************ * Get the default initialization expression for a type. * Params: * mt = the type for which the init expression is returned * loc = the location where the expression needs to be evaluated * isCfile = default initializers are different with C * * Returns: * The initialization expression for the type. */ extern (C++) Expression defaultInit(Type mt, const ref Loc loc, const bool isCfile = false) { Expression visitBasic(TypeBasic mt) { static if (LOGDEFAULTINIT) { printf("TypeBasic::defaultInit() '%s' isCfile: %d\n", mt.toChars(), isCfile); } dinteger_t value = 0; switch (mt.ty) { case Tchar: value = isCfile ? 0 : 0xFF; break; case Twchar: case Tdchar: value = isCfile ? 0 : 0xFFFF; break; case Timaginary32: case Timaginary64: case Timaginary80: case Tfloat32: case Tfloat64: case Tfloat80: return new RealExp(loc, isCfile ? CTFloat.zero : target.RealProperties.nan, mt); case Tcomplex32: case Tcomplex64: case Tcomplex80: { // Can't use fvalue + I*fvalue (the im part becomes a quiet NaN). const cvalue = isCfile ? complex_t(CTFloat.zero, CTFloat.zero) : complex_t(target.RealProperties.nan, target.RealProperties.nan); return new ComplexExp(loc, cvalue, mt); } case Tvoid: error(loc, "`void` does not have a default initializer"); return ErrorExp.get(); default: break; } return new IntegerExp(loc, value, mt); } Expression visitVector(TypeVector mt) { //printf("TypeVector::defaultInit()\n"); assert(mt.basetype.ty == Tsarray); Expression e = mt.basetype.defaultInit(loc, isCfile); auto ve = new VectorExp(loc, e, mt); ve.type = mt; ve.dim = cast(int)(mt.basetype.size(loc) / mt.elementType().size(loc)); return ve; } Expression visitSArray(TypeSArray mt) { static if (LOGDEFAULTINIT) { printf("TypeSArray::defaultInit() '%s' isCfile %d\n", mt.toChars(), isCfile); } if (mt.next.ty == Tvoid) return mt.tuns8.defaultInit(loc, isCfile); else return mt.next.defaultInit(loc, isCfile); } Expression visitFunction(TypeFunction mt) { error(loc, "`function` does not have a default initializer"); return ErrorExp.get(); } Expression visitStruct(TypeStruct mt) { static if (LOGDEFAULTINIT) { printf("TypeStruct::defaultInit() '%s'\n", mt.toChars()); } Declaration d = new SymbolDeclaration(mt.sym.loc, mt.sym); assert(d); d.type = mt; d.storage_class |= STC.rvalue; // https://issues.dlang.org/show_bug.cgi?id=14398 return new VarExp(mt.sym.loc, d); } Expression visitEnum(TypeEnum mt) { static if (LOGDEFAULTINIT) { printf("TypeEnum::defaultInit() '%s'\n", mt.toChars()); } // Initialize to first member of enum Expression e = mt.sym.getDefaultValue(loc); e = e.copy(); e.loc = loc; e.type = mt; // to deal with const, immutable, etc., variants return e; } Expression visitTuple(TypeTuple mt) { static if (LOGDEFAULTINIT) { printf("TypeTuple::defaultInit() '%s'\n", mt.toChars()); } auto exps = new Expressions(mt.arguments.length); for (size_t i = 0; i < mt.arguments.length; i++) { Parameter p = (*mt.arguments)[i]; assert(p.type); Expression e = p.type.defaultInitLiteral(loc); if (e.op == EXP.error) { return e; } (*exps)[i] = e; } return new TupleExp(loc, exps); } Expression visitNoreturn(TypeNoreturn mt) { static if (LOGDEFAULTINIT) { printf("TypeNoreturn::defaultInit() '%s'\n", mt.toChars()); } auto cond = IntegerExp.createBool(false); auto msg = new StringExp(loc, "Accessed expression of type `noreturn`"); msg.type = Type.tstring; auto ae = new AssertExp(loc, cond, msg); ae.type = mt; return ae; } switch (mt.ty) { case Tvector: return visitVector (mt.isTypeVector()); case Tsarray: return visitSArray (mt.isTypeSArray()); case Tfunction: return visitFunction(mt.isTypeFunction()); case Tstruct: return visitStruct (mt.isTypeStruct()); case Tenum: return visitEnum (mt.isTypeEnum()); case Ttuple: return visitTuple (mt.isTypeTuple()); case Tnull: return new NullExp(Loc.initial, Type.tnull); case Terror: return ErrorExp.get(); case Tarray: case Taarray: case Tpointer: case Treference: case Tdelegate: case Tclass: return new NullExp(loc, mt); case Tnoreturn: return visitNoreturn(mt.isTypeNoreturn()); default: return mt.isTypeBasic() ? visitBasic(cast(TypeBasic)mt) : null; } } /********************************************** * Extract complex type from core.stdc.config * Params: * loc = for error messages * sc = context * ty = a complex or imaginary type * Returns: * Complex!float, Complex!double, Complex!real or null for error */ Type getComplexLibraryType(const ref Loc loc, Scope* sc, TY ty) { // singleton __gshared Type complex_float; __gshared Type complex_double; __gshared Type complex_real; Type* pt; Identifier id; switch (ty) { case Timaginary32: case Tcomplex32: id = Id.c_complex_float; pt = &complex_float; break; case Timaginary64: case Tcomplex64: id = Id.c_complex_double; pt = &complex_double; break; case Timaginary80: case Tcomplex80: id = Id.c_complex_real; pt = &complex_real; break; default: return Type.terror; } if (*pt) return *pt; *pt = Type.terror; Module mConfig = Module.loadCoreStdcConfig(); if (!mConfig) { error(loc, "`core.stdc.config` is required for complex numbers"); return *pt; } Dsymbol s = mConfig.searchX(Loc.initial, sc, id, IgnorePrivateImports); if (!s) { error(loc, "`%s` not found in core.stdc.config", id.toChars()); return *pt; } s = s.toAlias(); if (auto t = s.getType()) { if (auto ts = t.toBasetype().isTypeStruct()) { *pt = ts; return ts; } } if (auto sd = s.isStructDeclaration()) { *pt = sd.type; return sd.type; } error(loc, "`%s` must be an alias for a complex struct", s.toChars()); return *pt; } /******************************* Private *****************************************/ private: /* Helper function for `typeToExpression`. Contains common code * for TypeQualified derived classes. */ Expression typeToExpressionHelper(TypeQualified t, Expression e, size_t i = 0) { //printf("toExpressionHelper(e = %s %s)\n", EXPtoString(e.op).ptr, e.toChars()); foreach (id; t.idents[i .. t.idents.length]) { //printf("\t[%d] e: '%s', id: '%s'\n", i, e.toChars(), id.toChars()); final switch (id.dyncast()) { // ... '. ident' case DYNCAST.identifier: e = new DotIdExp(e.loc, e, cast(Identifier)id); break; // ... '. name!(tiargs)' case DYNCAST.dsymbol: auto ti = (cast(Dsymbol)id).isTemplateInstance(); assert(ti); e = new DotTemplateInstanceExp(e.loc, e, ti.name, ti.tiargs); break; // ... '[type]' case DYNCAST.type: // https://issues.dlang.org/show_bug.cgi?id=1215 e = new ArrayExp(t.loc, e, new TypeExp(t.loc, cast(Type)id)); break; // ... '[expr]' case DYNCAST.expression: // https://issues.dlang.org/show_bug.cgi?id=1215 e = new ArrayExp(t.loc, e, cast(Expression)id); break; case DYNCAST.object: case DYNCAST.tuple: case DYNCAST.parameter: case DYNCAST.statement: case DYNCAST.condition: case DYNCAST.templateparameter: case DYNCAST.initializer: assert(0); } } return e; } /************************** * This evaluates exp while setting length to be the number * of elements in the tuple t. */ Expression semanticLength(Scope* sc, Type t, Expression exp) { if (auto tt = t.isTypeTuple()) { ScopeDsymbol sym = new ArrayScopeSymbol(sc, tt); sym.parent = sc.scopesym; sc = sc.push(sym); sc = sc.startCTFE(); exp = exp.expressionSemantic(sc); exp = resolveProperties(sc, exp); sc = sc.endCTFE(); sc.pop(); } else { sc = sc.startCTFE(); exp = exp.expressionSemantic(sc); exp = resolveProperties(sc, exp); sc = sc.endCTFE(); } return exp; } Expression semanticLength(Scope* sc, TupleDeclaration tup, Expression exp) { ScopeDsymbol sym = new ArrayScopeSymbol(sc, tup); sym.parent = sc.scopesym; sc = sc.push(sym); sc = sc.startCTFE(); exp = exp.expressionSemantic(sc); exp = resolveProperties(sc, exp); sc = sc.endCTFE(); sc.pop(); return exp; } /************************************ * Transitively search a type for all function types. * If any function types with parameters are found that have parameter identifiers * or default arguments, remove those and create a new type stripped of those. * This is used to determine the "canonical" version of a type which is useful for * comparisons. * Params: * t = type to scan * Returns: * `t` if no parameter identifiers or default arguments found, otherwise a new type that is * the same as t but with no parameter identifiers or default arguments. */ Type stripDefaultArgs(Type t) { static Parameters* stripParams(Parameters* parameters) { static Parameter stripParameter(Parameter p) { Type t = stripDefaultArgs(p.type); return (t != p.type || p.defaultArg || p.ident || p.userAttribDecl) ? new Parameter(p.storageClass, t, null, null, null) : null; } if (parameters) { foreach (i, p; *parameters) { Parameter ps = stripParameter(p); if (ps) { // Replace params with a copy we can modify Parameters* nparams = new Parameters(parameters.length); foreach (j, ref np; *nparams) { Parameter pj = (*parameters)[j]; if (j < i) np = pj; else if (j == i) np = ps; else { Parameter nps = stripParameter(pj); np = nps ? nps : pj; } } return nparams; } } } return parameters; } if (t is null) return t; if (auto tf = t.isTypeFunction()) { Type tret = stripDefaultArgs(tf.next); Parameters* params = stripParams(tf.parameterList.parameters); if (tret == tf.next && params == tf.parameterList.parameters) return t; TypeFunction tr = tf.copy().isTypeFunction(); tr.parameterList.parameters = params; tr.next = tret; //printf("strip %s\n <- %s\n", tr.toChars(), t.toChars()); return tr; } else if (auto tt = t.isTypeTuple()) { Parameters* args = stripParams(tt.arguments); if (args == tt.arguments) return t; TypeTuple tr = t.copy().isTypeTuple(); tr.arguments = args; return tr; } else if (t.ty == Tenum) { // TypeEnum::nextOf() may be != NULL, but it's not necessary here. return t; } else { Type tn = t.nextOf(); Type n = stripDefaultArgs(tn); if (n == tn) return t; TypeNext tr = cast(TypeNext)t.copy(); tr.next = n; return tr; } } /****************************** * Get the value of the .max/.min property of `ed` as an Expression. * Lazily computes the value and caches it in maxval/minval. * Reports any errors. * Params: * ed = the EnumDeclaration being examined * loc = location to use for error messages * id = Id::max or Id::min * Returns: * corresponding value of .max/.min */ Expression getMaxMinValue(EnumDeclaration ed, const ref Loc loc, Identifier id) { //printf("EnumDeclaration::getMaxValue()\n"); static Expression pvalToResult(Expression e, const ref Loc loc) { if (e.op != EXP.error) { e = e.copy(); e.loc = loc; } return e; } Expression* pval = (id == Id.max) ? &ed.maxval : &ed.minval; Expression errorReturn() { *pval = ErrorExp.get(); return *pval; } if (ed.inuse) { ed.error(loc, "recursive definition of `.%s` property", id.toChars()); return errorReturn(); } if (*pval) return pvalToResult(*pval, loc); if (ed._scope) dsymbolSemantic(ed, ed._scope); if (ed.errors) return errorReturn(); if (!ed.members) { ed.error(loc, "is opaque and has no `.%s`", id.toChars()); return errorReturn(); } if (!(ed.memtype && ed.memtype.isintegral())) { ed.error(loc, "has no `.%s` property because base type `%s` is not an integral type", id.toChars(), ed.memtype ? ed.memtype.toChars() : ""); return errorReturn(); } bool first = true; for (size_t i = 0; i < ed.members.length; i++) { EnumMember em = (*ed.members)[i].isEnumMember(); if (!em) continue; if (em.errors) { ed.errors = true; continue; } if (em.semanticRun < PASS.semanticdone) { em.error("is forward referenced looking for `.%s`", id.toChars()); ed.errors = true; continue; } if (first) { *pval = em.value; first = false; } else { /* In order to work successfully with UDTs, * build expressions to do the comparisons, * and let the semantic analyzer and constant * folder give us the result. */ /* Compute: * if (e > maxval) * maxval = e; */ Expression e = em.value; Expression ec = new CmpExp(id == Id.max ? EXP.greaterThan : EXP.lessThan, em.loc, e, *pval); ed.inuse = true; ec = ec.expressionSemantic(em._scope); ed.inuse = false; ec = ec.ctfeInterpret(); if (ec.op == EXP.error) { ed.errors = true; continue; } if (ec.toInteger()) *pval = e; } } return ed.errors ? errorReturn() : pvalToResult(*pval, loc); } /****************************************** * Compile the MixinType, returning the type or expression AST. * * Doesn't run semantic() on the returned object. * Params: * tm = mixin to compile as a type or expression * loc = location for error messages * sc = context * Return: * null if error, else RootObject AST as parsed */ RootObject compileTypeMixin(TypeMixin tm, Loc loc, Scope* sc) { OutBuffer buf; if (expressionsToString(buf, sc, tm.exps)) return null; const errors = global.errors; const len = buf.length; buf.writeByte(0); const str = buf.extractSlice()[0 .. len]; const bool doUnittests = global.params.useUnitTests || global.params.ddoc.doOutput || global.params.dihdr.doOutput; scope p = new Parser!ASTCodegen(loc, sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests); p.transitionIn = global.params.vin; p.nextToken(); //printf("p.loc.linnum = %d\n", p.loc.linnum); auto o = p.parseTypeOrAssignExp(TOK.endOfFile); if (errors != global.errors) { assert(global.errors != errors); // should have caught all these cases return null; } if (p.token.value != TOK.endOfFile) { .error(loc, "incomplete mixin type `%s`", str.ptr); return null; } return o; }
D
module gfx.context; import core.types; import core.dbg; import gfx.fence; import gfx.upload_buffer; import opengl; private { extern(System) void debugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const(GLubyte)* msg, void* data) { import std.conv : to; import core.runtime : defaultTraceHandler; if (severity != GL_DEBUG_SEVERITY_LOW && severity != GL_DEBUG_SEVERITY_NOTIFICATION) { debugMessage("GL(%s): %s", severity.stringof, to!string(cast(const(char)*)msg)); debugMessage("GL: stack trace:"); debugMessage(defaultTraceHandler.toString()); } } void setDebugCallback() { glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); glDebugMessageCallback(cast(GLDEBUGPROC)&debugCallback, null); glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, null, true); glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 1111, GL_DEBUG_SEVERITY_NOTIFICATION, -1, "Started logging OpenGL messages"); } } struct GLImplementationLimits { int max_vertex_attributes = 16; int max_vertex_buffers = 16; int max_texture_units = 16; int max_draw_buffers = 16; int max_3d_texture_size_w; int max_3d_texture_size_h; int max_3d_texture_size_d; int max_combined_texture_image_units = 16; int max_combined_uniform_blocks = 16; int max_combined_shader_storage_blocks = 16; int max_compute_texture_image_units = 16; int max_compute_uniform_blocks = 16; int max_compute_shader_storage_blocks = 16; int max_compute_work_group_invocations; int max_compute_work_group_count; int max_compute_work_group_size; int uniform_buffer_alignment = 256; int default_compute_local_size_x; int default_compute_local_size_y; int default_compute_local_size_z; } class Context { public: struct Config { int maxFramesInFlight = 0; int defaultUploadBufferSize = 0; } this(Config cfg_) { cfg = cfg_; setDebugCallback(); frameFence = new Fence(); uploadBuffer_ = new UploadBuffer(cfg_.defaultUploadBufferSize); //frameFence = Fence{0}; // TODO query all implementation limits glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &implLimits.uniform_buffer_alignment); // automatically set this instance as the current graphics context // this is relatively safe since the GfxContext object cannot be moved // (the copy and move constructors have been disabled) //setGfxContext(this); if (currentCtx) { assert(false, "Global GFX context already set"); } currentCtx = this; } ~this() { if (currentCtx == this) { currentCtx = null; } } void setFrameCapture(long targetFrameIndex) { nextFrameCapture = targetFrameIndex; } void setNextFrameCapture() { nextFrameCapture = currentFrameIndex + 1; } bool isFrameCaptureRequested() { return nextFrameCapture == currentFrameIndex; } // disable copy and move @property ref const(GLImplementationLimits) implementationLimits() const { return implLimits; } void resizeRenderWindow(int w, int h) { width = w; height = h; } @property ivec2 renderWindowSize() const { return ivec2(width, height); } @property ref const(Config) config() const { return cfg; } @property long currentFrameIndex() const { return frameIndex; } void beginFrame() { } void endFrame() { frameIndex++; //AG_FRAME_TRACE("frameIndex={}", frameIndex); frameFence.signal(frameIndex); if (frameIndex >= cfg.maxFramesInFlight) { frameFence.wait(frameIndex - cfg.maxFramesInFlight + 1); } } //Framebuffer getDefaultFramebuffer() { return screenFbo; } @property UploadBuffer uploadBuffer() { return uploadBuffer_; } private: GLImplementationLimits implLimits; Config cfg; Fence frameFence; long frameIndex; int width; int height; UploadBuffer uploadBuffer_; //Framebuffer screenFbo; // Graphics frame capture long nextFrameCapture = -1; } auto getGfxContext() { return currentCtx; } private __gshared Context currentCtx;
D
# FIXED grlib/msp-exp432p401r_grlib_example/fonts/fontcmss36i.obj: ../grlib/msp-exp432p401r_grlib_example/fonts/fontcmss36i.c ../grlib/msp-exp432p401r_grlib_example/fonts/fontcmss36i.c:
D
// Written in the D programming language. /** This module implements a $(HTTP erdani.org/publications/cuj-04-2002.html,discriminated union) type (a.k.a. $(HTTP en.wikipedia.org/wiki/Tagged_union,tagged union), $(HTTP en.wikipedia.org/wiki/Algebraic_data_type,algebraic type)). Such types are useful for type-uniform binary interfaces, interfacing with scripting languages, and comfortable exploratory programming. A $(LREF Variant) object can hold a value of any type, with very few restrictions (such as `shared` types and noncopyable types). Setting the value is as immediate as assigning to the `Variant` object. To read back the value of the appropriate type `T`, use the $(LREF get) method. To query whether a `Variant` currently holds a value of type `T`, use $(LREF peek). To fetch the exact type currently held, call $(LREF type), which returns the `TypeInfo` of the current value. In addition to $(LREF Variant), this module also defines the $(LREF Algebraic) type constructor. Unlike `Variant`, `Algebraic` only allows a finite set of types, which are specified in the instantiation (e.g. $(D Algebraic!(int, string)) may only hold an `int` or a `string`). Credits: Reviewed by Brad Roberts. Daniel Keep provided a detailed code review prompting the following improvements: (1) better support for arrays; (2) support for associative arrays; (3) friendlier behavior towards the garbage collector. Copyright: Copyright Andrei Alexandrescu 2007 - 2015. License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). Authors: $(HTTP erdani.org, Andrei Alexandrescu) Source: $(PHOBOSSRC std/variant.d) */ module std.variant; import std.meta, std.traits, std.typecons; /// @system unittest { Variant a; // Must assign before use, otherwise exception ensues // Initialize with an integer; make the type int Variant b = 42; assert(b.type == typeid(int)); // Peek at the value assert(b.peek!(int) !is null && *b.peek!(int) == 42); // Automatically convert per language rules auto x = b.get!(real); // Assign any other type, including other variants a = b; a = 3.14; assert(a.type == typeid(double)); // Implicit conversions work just as with built-in types assert(a < b); // Check for convertibility assert(!a.convertsTo!(int)); // double not convertible to int // Strings and all other arrays are supported a = "now I'm a string"; assert(a == "now I'm a string"); // can also assign arrays a = new int[42]; assert(a.length == 42); a[5] = 7; assert(a[5] == 7); // Can also assign class values class Foo {} auto foo = new Foo; a = foo; assert(*a.peek!(Foo) == foo); // and full type information is preserved } /++ Gives the `sizeof` the largest type given. +/ template maxSize(T...) { static if (T.length == 1) { enum size_t maxSize = T[0].sizeof; } else { import std.algorithm.comparison : max; enum size_t maxSize = max(T[0].sizeof, maxSize!(T[1 .. $])); } } /// @safe unittest { static assert(maxSize!(int, long) == 8); static assert(maxSize!(bool, byte) == 1); struct Cat { int a, b, c; } static assert(maxSize!(bool, Cat) == 12); } struct This; private alias This2Variant(V, T...) = AliasSeq!(ReplaceType!(This, V, T)); // We can't just use maxAlignment because no types might be specified // to VariantN, so handle that here and then pass along the rest. private template maxVariantAlignment(U...) if (isTypeTuple!U) { static if (U.length == 0) { import std.algorithm.comparison : max; enum maxVariantAlignment = max(real.alignof, size_t.alignof); } else enum maxVariantAlignment = maxAlignment!(U); } /** * Back-end type seldom used directly by user * code. Two commonly-used types using `VariantN` are: * * $(OL $(LI $(LREF Algebraic): A closed discriminated union with a * limited type universe (e.g., $(D Algebraic!(int, double, * string)) only accepts these three types and rejects anything * else).) $(LI $(LREF Variant): An open discriminated union allowing an * unbounded set of types. If any of the types in the `Variant` * are larger than the largest built-in type, they will automatically * be boxed. This means that even large types will only be the size * of a pointer within the `Variant`, but this also implies some * overhead. `Variant` can accommodate all primitive types and * all user-defined types.)) * * Both `Algebraic` and `Variant` share $(D * VariantN)'s interface. (See their respective documentations below.) * * `VariantN` is a discriminated union type parameterized * with the largest size of the types stored (`maxDataSize`) * and with the list of allowed types (`AllowedTypes`). If * the list is empty, then any type up of size up to $(D * maxDataSize) (rounded up for alignment) can be stored in a * `VariantN` object without being boxed (types larger * than this will be boxed). * */ struct VariantN(size_t maxDataSize, AllowedTypesParam...) { /** The list of allowed types. If empty, any type is allowed. */ alias AllowedTypes = This2Variant!(VariantN, AllowedTypesParam); private: // Compute the largest practical size from maxDataSize struct SizeChecker { int function() fptr; ubyte[maxDataSize] data; } enum size = SizeChecker.sizeof - (int function()).sizeof; /** Tells whether a type `T` is statically _allowed for * storage inside a `VariantN` object by looking * `T` up in `AllowedTypes`. */ public template allowed(T) { enum bool allowed = is(T == VariantN) || //T.sizeof <= size && (AllowedTypes.length == 0 || staticIndexOf!(T, AllowedTypes) >= 0); } // Each internal operation is encoded with an identifier. See // the "handler" function below. enum OpID { getTypeInfo, get, compare, equals, testConversion, toString, index, indexAssign, catAssign, copyOut, length, apply, postblit, destruct } // state ptrdiff_t function(OpID selector, ubyte[size]* store, void* data) fptr = &handler!(void); union { align(maxVariantAlignment!(AllowedTypes)) ubyte[size] store; // conservatively mark the region as pointers static if (size >= (void*).sizeof) void*[size / (void*).sizeof] p; } // internals // Handler for an uninitialized value static ptrdiff_t handler(A : void)(OpID selector, ubyte[size]*, void* parm) { switch (selector) { case OpID.getTypeInfo: *cast(TypeInfo *) parm = typeid(A); break; case OpID.copyOut: auto target = cast(VariantN *) parm; target.fptr = &handler!(A); // no need to copy the data (it's garbage) break; case OpID.compare: case OpID.equals: auto rhs = cast(const VariantN *) parm; return rhs.peek!(A) ? 0 // all uninitialized are equal : ptrdiff_t.min; // uninitialized variant is not comparable otherwise case OpID.toString: string * target = cast(string*) parm; *target = "<Uninitialized VariantN>"; break; case OpID.postblit: case OpID.destruct: break; case OpID.get: case OpID.testConversion: case OpID.index: case OpID.indexAssign: case OpID.catAssign: case OpID.length: throw new VariantException( "Attempt to use an uninitialized VariantN"); default: assert(false, "Invalid OpID"); } return 0; } // Handler for all of a type's operations static ptrdiff_t handler(A)(OpID selector, ubyte[size]* pStore, void* parm) { import std.conv : to; static A* getPtr(void* untyped) { if (untyped) { static if (A.sizeof <= size) return cast(A*) untyped; else return *cast(A**) untyped; } return null; } static ptrdiff_t compare(A* rhsPA, A* zis, OpID selector) { static if (is(typeof(*rhsPA == *zis))) { if (*rhsPA == *zis) { return 0; } static if (is(typeof(*zis < *rhsPA))) { // Many types (such as any using the default Object opCmp) // will throw on an invalid opCmp, so do it only // if the caller requests it. if (selector == OpID.compare) return *zis < *rhsPA ? -1 : 1; else return ptrdiff_t.min; } else { // Not equal, and type does not support ordering // comparisons. return ptrdiff_t.min; } } else { // Type does not support comparisons at all. return ptrdiff_t.min; } } auto zis = getPtr(pStore); // Input: TypeInfo object // Output: target points to a copy of *me, if me was not null // Returns: true iff the A can be converted to the type represented // by the incoming TypeInfo static bool tryPutting(A* src, TypeInfo targetType, void* target) { alias UA = Unqual!A; alias MutaTypes = AliasSeq!(UA, ImplicitConversionTargets!UA); alias ConstTypes = staticMap!(ConstOf, MutaTypes); alias SharedTypes = staticMap!(SharedOf, MutaTypes); alias SharedConstTypes = staticMap!(SharedConstOf, MutaTypes); alias ImmuTypes = staticMap!(ImmutableOf, MutaTypes); static if (is(A == immutable)) alias AllTypes = AliasSeq!(ImmuTypes, ConstTypes, SharedConstTypes); else static if (is(A == shared)) { static if (is(A == const)) alias AllTypes = SharedConstTypes; else alias AllTypes = AliasSeq!(SharedTypes, SharedConstTypes); } else { static if (is(A == const)) alias AllTypes = ConstTypes; else alias AllTypes = AliasSeq!(MutaTypes, ConstTypes); } foreach (T ; AllTypes) { if (targetType != typeid(T)) continue; // SPECIAL NOTE: variant only will ever create a new value with // tryPutting (effectively), and T is ALWAYS the same type of // A, but with different modifiers (and a limited set of // implicit targets). So this checks to see if we can construct // a T from A, knowing that prerequisite. This handles issues // where the type contains some constant data aside from the // modifiers on the type itself. static if (is(typeof(delegate T() {return *src;})) || is(T == const(U), U) || is(T == shared(U), U) || is(T == shared const(U), U) || is(T == immutable(U), U)) { import std.conv : emplaceRef; auto zat = cast(T*) target; if (src) { static if (T.sizeof > 0) assert(target, "target must be non-null"); emplaceRef(*cast(Unqual!T*) zat, *cast(UA*) src); } } else { // type T is not constructible from A if (src) assert(false, A.stringof); } return true; } return false; } switch (selector) { case OpID.getTypeInfo: *cast(TypeInfo *) parm = typeid(A); break; case OpID.copyOut: auto target = cast(VariantN *) parm; assert(target); static if (target.size < A.sizeof) { if (target.type.tsize < A.sizeof) { static if (is(A == U[n], U, size_t n)) { A* p = cast(A*)(new U[n]).ptr; } else { A* p = new A; } *cast(A**)&target.store = p; } } tryPutting(zis, typeid(A), cast(void*) getPtr(&target.store)) || assert(false); target.fptr = &handler!(A); break; case OpID.get: auto t = * cast(Tuple!(TypeInfo, void*)*) parm; return !tryPutting(zis, t[0], t[1]); case OpID.testConversion: return !tryPutting(null, *cast(TypeInfo*) parm, null); case OpID.compare: case OpID.equals: auto rhsP = cast(VariantN *) parm; auto rhsType = rhsP.type; // Are we the same? if (rhsType == typeid(A)) { // cool! Same type! auto rhsPA = getPtr(&rhsP.store); return compare(rhsPA, zis, selector); } else if (rhsType == typeid(void)) { // No support for ordering comparisons with // uninitialized vars return ptrdiff_t.min; } VariantN temp; // Do I convert to rhs? if (tryPutting(zis, rhsType, &temp.store)) { // cool, I do; temp's store contains my data in rhs's type! // also fix up its fptr temp.fptr = rhsP.fptr; // now lhsWithRhsType is a full-blown VariantN of rhs's type if (selector == OpID.compare) return temp.opCmp(*rhsP); else return temp.opEquals(*rhsP) ? 0 : 1; } // Does rhs convert to zis? auto t = tuple(typeid(A), &temp.store); if (rhsP.fptr(OpID.get, &rhsP.store, &t) == 0) { // cool! Now temp has rhs in my type! auto rhsPA = getPtr(&temp.store); return compare(rhsPA, zis, selector); } return ptrdiff_t.min; // dunno case OpID.toString: auto target = cast(string*) parm; static if (is(typeof(to!(string)(*zis)))) { *target = to!(string)(*zis); break; } // TODO: The following test evaluates to true for shared objects. // Use __traits for now until this is sorted out. // else static if (is(typeof((*zis).toString))) else static if (__traits(compiles, {(*zis).toString();})) { *target = (*zis).toString(); break; } else { throw new VariantException(typeid(A), typeid(string)); } case OpID.index: auto result = cast(Variant*) parm; static if (isArray!(A) && !is(Unqual!(typeof(A.init[0])) == void)) { // array type; input and output are the same VariantN size_t index = result.convertsTo!(int) ? result.get!(int) : result.get!(size_t); *result = (*zis)[index]; break; } else static if (isAssociativeArray!(A)) { *result = (*zis)[result.get!(typeof(A.init.keys[0]))]; break; } else { throw new VariantException(typeid(A), result[0].type); } case OpID.indexAssign: // array type; result comes first, index comes second auto args = cast(Variant*) parm; static if (isArray!(A) && is(typeof((*zis)[0] = (*zis)[0]))) { size_t index = args[1].convertsTo!(int) ? args[1].get!(int) : args[1].get!(size_t); (*zis)[index] = args[0].get!(typeof((*zis)[0])); break; } else static if (isAssociativeArray!(A)) { (*zis)[args[1].get!(typeof(A.init.keys[0]))] = args[0].get!(typeof(A.init.values[0])); break; } else { throw new VariantException(typeid(A), args[0].type); } case OpID.catAssign: static if (!is(Unqual!(typeof((*zis)[0])) == void) && is(typeof((*zis)[0])) && is(typeof((*zis) ~= *zis))) { // array type; parm is the element to append auto arg = cast(Variant*) parm; alias E = typeof((*zis)[0]); if (arg[0].convertsTo!(E)) { // append one element to the array (*zis) ~= [ arg[0].get!(E) ]; } else { // append a whole array to the array (*zis) ~= arg[0].get!(A); } break; } else { throw new VariantException(typeid(A), typeid(void[])); } case OpID.length: static if (isArray!(A) || isAssociativeArray!(A)) { return zis.length; } else { throw new VariantException(typeid(A), typeid(void[])); } case OpID.apply: static if (!isFunctionPointer!A && !isDelegate!A) { import std.conv : text; import std.exception : enforce; enforce(0, text("Cannot apply `()' to a value of type `", A.stringof, "'.")); } else { import std.conv : text; import std.exception : enforce; alias ParamTypes = Parameters!A; auto p = cast(Variant*) parm; auto argCount = p.get!size_t; // To assign the tuple we need to use the unqualified version, // otherwise we run into issues such as with const values. // We still get the actual type from the Variant though // to ensure that we retain const correctness. Tuple!(staticMap!(Unqual, ParamTypes)) t; enforce(t.length == argCount, text("Argument count mismatch: ", A.stringof, " expects ", t.length, " argument(s), not ", argCount, ".")); auto variantArgs = p[1 .. argCount + 1]; foreach (i, T; ParamTypes) { t[i] = cast() variantArgs[i].get!T; } auto args = cast(Tuple!(ParamTypes))t; static if (is(ReturnType!A == void)) { (*zis)(args.expand); *p = Variant.init; // void returns uninitialized Variant. } else { *p = (*zis)(args.expand); } } break; case OpID.postblit: static if (hasElaborateCopyConstructor!A) { zis.__xpostblit(); } break; case OpID.destruct: static if (hasElaborateDestructor!A) { zis.__xdtor(); } break; default: assert(false); } return 0; } public: /** Constructs a `VariantN` value given an argument of a * generic type. Statically rejects disallowed types. */ this(T)(T value) { static assert(allowed!(T), "Cannot store a " ~ T.stringof ~ " in a " ~ VariantN.stringof); opAssign(value); } /// Allows assignment from a subset algebraic type this(T : VariantN!(tsize, Types), size_t tsize, Types...)(T value) if (!is(T : VariantN) && Types.length > 0 && allSatisfy!(allowed, Types)) { opAssign(value); } static if (!AllowedTypes.length || anySatisfy!(hasElaborateCopyConstructor, AllowedTypes)) { this(this) { fptr(OpID.postblit, &store, null); } } static if (!AllowedTypes.length || anySatisfy!(hasElaborateDestructor, AllowedTypes)) { ~this() { // Infer the safety of the provided types static if (AllowedTypes.length) { if (0) { AllowedTypes var; } } (() @trusted => fptr(OpID.destruct, &store, null))(); } } /** Assigns a `VariantN` from a generic * argument. Statically rejects disallowed types. */ VariantN opAssign(T)(T rhs) { //writeln(typeid(rhs)); static assert(allowed!(T), "Cannot store a " ~ T.stringof ~ " in a " ~ VariantN.stringof ~ ". Valid types are " ~ AllowedTypes.stringof); static if (is(T : VariantN)) { rhs.fptr(OpID.copyOut, &rhs.store, &this); } else static if (is(T : const(VariantN))) { static assert(false, "Assigning Variant objects from const Variant"~ " objects is currently not supported."); } else { static if (!AllowedTypes.length || anySatisfy!(hasElaborateDestructor, AllowedTypes)) { // Assignment should destruct previous value fptr(OpID.destruct, &store, null); } static if (T.sizeof <= size) { import core.stdc.string : memcpy; // rhs has already been copied onto the stack, so even if T is // shared, it's not really shared. Therefore, we can safely // remove the shared qualifier when copying, as we are only // copying from the unshared stack. // // In addition, the storage location is not accessible outside // the Variant, so even if shared data is stored there, it's // not really shared, as it's copied out as well. memcpy(&store, cast(const(void*)) &rhs, rhs.sizeof); static if (hasElaborateCopyConstructor!T) { // Safer than using typeid's postblit function because it // type-checks the postblit function against the qualifiers // of the type. (cast(T*)&store).__xpostblit(); } } else { import core.stdc.string : memcpy; static if (__traits(compiles, {new T(T.init);})) { auto p = new T(rhs); } else static if (is(T == U[n], U, size_t n)) { auto p = cast(T*)(new U[n]).ptr; *p = rhs; } else { auto p = new T; *p = rhs; } memcpy(&store, &p, p.sizeof); } fptr = &handler!(T); } return this; } // Allow assignment from another variant which is a subset of this one VariantN opAssign(T : VariantN!(tsize, Types), size_t tsize, Types...)(T rhs) if (!is(T : VariantN) && Types.length > 0 && allSatisfy!(allowed, Types)) { // discover which type rhs is actually storing foreach (V; T.AllowedTypes) if (rhs.type == typeid(V)) return this = rhs.get!V; assert(0, T.AllowedTypes.stringof); } Variant opCall(P...)(auto ref P params) { Variant[P.length + 1] pack; pack[0] = P.length; foreach (i, _; params) { pack[i + 1] = params[i]; } fptr(OpID.apply, &store, &pack); return pack[0]; } /** Returns true if and only if the `VariantN` object * holds a valid value (has been initialized with, or assigned * from, a valid value). */ @property bool hasValue() const pure nothrow { // @@@BUG@@@ in compiler, the cast shouldn't be needed return cast(typeof(&handler!(void))) fptr != &handler!(void); } /// version (StdDdoc) @system unittest { Variant a; assert(!a.hasValue); Variant b; a = b; assert(!a.hasValue); // still no value a = 5; assert(a.hasValue); } /** * If the `VariantN` object holds a value of the * $(I exact) type `T`, returns a pointer to that * value. Otherwise, returns `null`. In cases * where `T` is statically disallowed, $(D * peek) will not compile. */ @property inout(T)* peek(T)() inout { static if (!is(T == void)) static assert(allowed!(T), "Cannot store a " ~ T.stringof ~ " in a " ~ VariantN.stringof); if (type != typeid(T)) return null; static if (T.sizeof <= size) return cast(inout T*)&store; else return *cast(inout T**)&store; } /// version (StdDdoc) @system unittest { Variant a = 5; auto b = a.peek!(int); assert(b !is null); *b = 6; assert(a == 6); } /** * Returns the `typeid` of the currently held value. */ @property TypeInfo type() const nothrow @trusted { scope(failure) assert(0); TypeInfo result; fptr(OpID.getTypeInfo, null, &result); return result; } /** * Returns `true` if and only if the `VariantN` * object holds an object implicitly convertible to type `T`. * Implicit convertibility is defined as per * $(REF_ALTTEXT ImplicitConversionTargets, ImplicitConversionTargets, std,traits). */ @property bool convertsTo(T)() const { TypeInfo info = typeid(T); return fptr(OpID.testConversion, null, &info) == 0; } /** Returns the value stored in the `VariantN` object, either by specifying the needed type or the index in the list of allowed types. The latter overload only applies to bounded variants (e.g. $(LREF Algebraic)). Params: T = The requested type. The currently stored value must implicitly convert to the requested type, in fact `DecayStaticToDynamicArray!T`. If an implicit conversion is not possible, throws a `VariantException`. index = The index of the type among `AllowedTypesParam`, zero-based. */ @property inout(T) get(T)() inout { inout(T) result = void; static if (is(T == shared)) alias R = shared Unqual!T; else alias R = Unqual!T; auto buf = tuple(typeid(T), cast(R*)&result); if (fptr(OpID.get, cast(ubyte[size]*) &store, &buf)) { throw new VariantException(type, typeid(T)); } return result; } /// Ditto @property auto get(uint index)() inout if (index < AllowedTypes.length) { foreach (i, T; AllowedTypes) { static if (index == i) return get!T; } assert(0); } /** * Returns the value stored in the `VariantN` object, * explicitly converted (coerced) to the requested type $(D * T). If `T` is a string type, the value is formatted as * a string. If the `VariantN` object is a string, a * parse of the string to type `T` is attempted. If a * conversion is not possible, throws a $(D * VariantException). */ @property T coerce(T)() { import std.conv : to, text; static if (isNumeric!T || isBoolean!T) { if (convertsTo!real) { // maybe optimize this fella; handle ints separately return to!T(get!real); } else if (convertsTo!(const(char)[])) { return to!T(get!(const(char)[])); } // I'm not sure why this doesn't convert to const(char), // but apparently it doesn't (probably a deeper bug). // // Until that is fixed, this quick addition keeps a common // function working. "10".coerce!int ought to work. else if (convertsTo!(immutable(char)[])) { return to!T(get!(immutable(char)[])); } else { import std.exception : enforce; enforce(false, text("Type ", type, " does not convert to ", typeid(T))); assert(0); } } else static if (is(T : Object)) { return to!(T)(get!(Object)); } else static if (isSomeString!(T)) { return to!(T)(toString()); } else { // Fix for bug 1649 static assert(false, "unsupported type for coercion"); } } /** * Formats the stored value as a string. */ string toString() { string result; fptr(OpID.toString, &store, &result) == 0 || assert(false); return result; } /** * Comparison for equality used by the "==" and "!=" operators. */ // returns 1 if the two are equal bool opEquals(T)(auto ref T rhs) const if (allowed!T || is(Unqual!T == VariantN)) { static if (is(Unqual!T == VariantN)) alias temp = rhs; else auto temp = VariantN(rhs); return !fptr(OpID.equals, cast(ubyte[size]*) &store, cast(void*) &temp); } // workaround for bug 10567 fix int opCmp(ref const VariantN rhs) const { return (cast() this).opCmp!(VariantN)(cast() rhs); } /** * Ordering comparison used by the "<", "<=", ">", and ">=" * operators. In case comparison is not sensible between the held * value and `rhs`, an exception is thrown. */ int opCmp(T)(T rhs) if (allowed!T) // includes T == VariantN { static if (is(T == VariantN)) alias temp = rhs; else auto temp = VariantN(rhs); auto result = fptr(OpID.compare, &store, &temp); if (result == ptrdiff_t.min) { throw new VariantException(type, temp.type); } assert(result >= -1 && result <= 1); // Should be true for opCmp. return cast(int) result; } /** * Computes the hash of the held value. */ size_t toHash() const nothrow @safe { return type.getHash(&store); } private VariantN opArithmetic(T, string op)(T other) { static if (isInstanceOf!(.VariantN, T)) { string tryUseType(string tp) { import std.format : format; return q{ static if (allowed!%1$s && T.allowed!%1$s) if (convertsTo!%1$s && other.convertsTo!%1$s) return VariantN(get!%1$s %2$s other.get!%1$s); }.format(tp, op); } mixin(tryUseType("uint")); mixin(tryUseType("int")); mixin(tryUseType("ulong")); mixin(tryUseType("long")); mixin(tryUseType("float")); mixin(tryUseType("double")); mixin(tryUseType("real")); } else { static if (allowed!T) if (auto pv = peek!T) return VariantN(mixin("*pv " ~ op ~ " other")); static if (allowed!uint && is(typeof(T.max) : uint) && isUnsigned!T) if (convertsTo!uint) return VariantN(mixin("get!(uint) " ~ op ~ " other")); static if (allowed!int && is(typeof(T.max) : int) && !isUnsigned!T) if (convertsTo!int) return VariantN(mixin("get!(int) " ~ op ~ " other")); static if (allowed!ulong && is(typeof(T.max) : ulong) && isUnsigned!T) if (convertsTo!ulong) return VariantN(mixin("get!(ulong) " ~ op ~ " other")); static if (allowed!long && is(typeof(T.max) : long) && !isUnsigned!T) if (convertsTo!long) return VariantN(mixin("get!(long) " ~ op ~ " other")); static if (allowed!float && is(T : float)) if (convertsTo!float) return VariantN(mixin("get!(float) " ~ op ~ " other")); static if (allowed!double && is(T : double)) if (convertsTo!double) return VariantN(mixin("get!(double) " ~ op ~ " other")); static if (allowed!real && is (T : real)) if (convertsTo!real) return VariantN(mixin("get!(real) " ~ op ~ " other")); } throw new VariantException("No possible match found for VariantN "~op~" "~T.stringof); } private VariantN opLogic(T, string op)(T other) { VariantN result; static if (is(T == VariantN)) { if (convertsTo!(uint) && other.convertsTo!(uint)) result = mixin("get!(uint) " ~ op ~ " other.get!(uint)"); else if (convertsTo!(int) && other.convertsTo!(int)) result = mixin("get!(int) " ~ op ~ " other.get!(int)"); else if (convertsTo!(ulong) && other.convertsTo!(ulong)) result = mixin("get!(ulong) " ~ op ~ " other.get!(ulong)"); else result = mixin("get!(long) " ~ op ~ " other.get!(long)"); } else { if (is(typeof(T.max) : uint) && T.min == 0 && convertsTo!(uint)) result = mixin("get!(uint) " ~ op ~ " other"); else if (is(typeof(T.max) : int) && T.min < 0 && convertsTo!(int)) result = mixin("get!(int) " ~ op ~ " other"); else if (is(typeof(T.max) : ulong) && T.min == 0 && convertsTo!(ulong)) result = mixin("get!(ulong) " ~ op ~ " other"); else result = mixin("get!(long) " ~ op ~ " other"); } return result; } /** * Arithmetic between `VariantN` objects and numeric * values. All arithmetic operations return a `VariantN` * object typed depending on the types of both values * involved. The conversion rules mimic D's built-in rules for * arithmetic conversions. */ VariantN opBinary(string op, T)(T rhs) if ((op == "+" || op == "-" || op == "*" || op == "/" || op == "^^" || op == "%") && is(typeof(opArithmetic!(T, op)(rhs)))) { return opArithmetic!(T, op)(rhs); } ///ditto VariantN opBinary(string op, T)(T rhs) if ((op == "&" || op == "|" || op == "^" || op == ">>" || op == "<<" || op == ">>>") && is(typeof(opLogic!(T, op)(rhs)))) { return opLogic!(T, op)(rhs); } ///ditto VariantN opBinaryRight(string op, T)(T lhs) if ((op == "+" || op == "*") && is(typeof(opArithmetic!(T, op)(lhs)))) { return opArithmetic!(T, op)(lhs); } ///ditto VariantN opBinaryRight(string op, T)(T lhs) if ((op == "&" || op == "|" || op == "^") && is(typeof(opLogic!(T, op)(lhs)))) { return opLogic!(T, op)(lhs); } ///ditto VariantN opCat(T)(T rhs) { auto temp = this; temp ~= rhs; return temp; } // ///ditto // VariantN opCat_r(T)(T rhs) // { // VariantN temp = rhs; // temp ~= this; // return temp; // } ///ditto VariantN opOpAssign(string op, T)(T rhs) { static if (op != "~") { mixin("return this = this" ~ op ~ "rhs;"); } else { auto toAppend = Variant(rhs); fptr(OpID.catAssign, &store, &toAppend) == 0 || assert(false); return this; } } /** * Array and associative array operations. If a $(D * VariantN) contains an (associative) array, it can be indexed * into. Otherwise, an exception is thrown. */ inout(Variant) opIndex(K)(K i) inout { auto result = Variant(i); fptr(OpID.index, cast(ubyte[size]*) &store, &result) == 0 || assert(false); return result; } /// version (StdDdoc) @system unittest { Variant a = new int[10]; a[5] = 42; assert(a[5] == 42); a[5] += 8; assert(a[5] == 50); int[int] hash = [ 42:24 ]; a = hash; assert(a[42] == 24); a[42] /= 2; assert(a[42] == 12); } /// ditto Variant opIndexAssign(T, N)(T value, N i) { static if (AllowedTypes.length && !isInstanceOf!(.VariantN, T)) { enum canAssign(U) = __traits(compiles, (U u){ u[i] = value; }); static assert(anySatisfy!(canAssign, AllowedTypes), "Cannot assign " ~ T.stringof ~ " to " ~ VariantN.stringof ~ " indexed with " ~ N.stringof); } Variant[2] args = [ Variant(value), Variant(i) ]; fptr(OpID.indexAssign, &store, &args) == 0 || assert(false); return args[0]; } /// ditto Variant opIndexOpAssign(string op, T, N)(T value, N i) { return opIndexAssign(mixin(`opIndex(i)` ~ op ~ `value`), i); } /** If the `VariantN` contains an (associative) array, * returns the _length of that array. Otherwise, throws an * exception. */ @property size_t length() { return cast(size_t) fptr(OpID.length, &store, null); } /** If the `VariantN` contains an array, applies `dg` to each element of the array in turn. Otherwise, throws an exception. */ int opApply(Delegate)(scope Delegate dg) if (is(Delegate == delegate)) { alias A = Parameters!(Delegate)[0]; if (type == typeid(A[])) { auto arr = get!(A[]); foreach (ref e; arr) { if (dg(e)) return 1; } } else static if (is(A == VariantN)) { foreach (i; 0 .. length) { // @@@TODO@@@: find a better way to not confuse // clients who think they change values stored in the // Variant when in fact they are only changing tmp. auto tmp = this[i]; debug scope(exit) assert(tmp == this[i]); if (dg(tmp)) return 1; } } else { import std.conv : text; import std.exception : enforce; enforce(false, text("Variant type ", type, " not iterable with values of type ", A.stringof)); } return 0; } } /// @system unittest { alias Var = VariantN!(maxSize!(int, double, string)); Var a; // Must assign before use, otherwise exception ensues // Initialize with an integer; make the type int Var b = 42; assert(b.type == typeid(int)); // Peek at the value assert(b.peek!(int) !is null && *b.peek!(int) == 42); // Automatically convert per language rules auto x = b.get!(real); // Assign any other type, including other variants a = b; a = 3.14; assert(a.type == typeid(double)); // Implicit conversions work just as with built-in types assert(a < b); // Check for convertibility assert(!a.convertsTo!(int)); // double not convertible to int // Strings and all other arrays are supported a = "now I'm a string"; assert(a == "now I'm a string"); } /// can also assign arrays @system unittest { alias Var = VariantN!(maxSize!(int[])); Var a = new int[42]; assert(a.length == 42); a[5] = 7; assert(a[5] == 7); } /// Can also assign class values @system unittest { alias Var = VariantN!(maxSize!(int*)); // classes are pointers Var a; class Foo {} auto foo = new Foo; a = foo; assert(*a.peek!(Foo) == foo); // and full type information is preserved } @system unittest { import std.conv : to; Variant v; int foo() { return 42; } v = &foo; assert(v() == 42); static int bar(string s) { return to!int(s); } v = &bar; assert(v("43") == 43); } @system unittest { int[int] hash = [ 42:24 ]; Variant v = hash; assert(v[42] == 24); v[42] = 5; assert(v[42] == 5); } // opIndex with static arrays, issue 12771 @system unittest { int[4] elements = [0, 1, 2, 3]; Variant v = elements; assert(v == elements); assert(v[2] == 2); assert(v[3] == 3); v[2] = 6; assert(v[2] == 6); assert(v != elements); } @system unittest { import std.exception : assertThrown; Algebraic!(int[]) v = [2, 2]; assert(v == [2, 2]); v[0] = 1; assert(v[0] == 1); assert(v != [2, 2]); // opIndexAssign from Variant v[1] = v[0]; assert(v[1] == 1); static assert(!__traits(compiles, (v[1] = null))); assertThrown!VariantException(v[1] = Variant(null)); } //Issue# 10879 @system unittest { int[10] arr = [1,2,3,4,5,6,7,8,9,10]; Variant v1 = arr; Variant v2; v2 = arr; assert(v1 == arr); assert(v2 == arr); foreach (i, e; arr) { assert(v1[i] == e); assert(v2[i] == e); } static struct LargeStruct { int[100] data; } LargeStruct ls; ls.data[] = 4; v1 = ls; Variant v3 = ls; assert(v1 == ls); assert(v3 == ls); } //Issue# 8195 @system unittest { struct S { int a; long b; string c; real d = 0.0; bool e; } static assert(S.sizeof >= Variant.sizeof); alias Types = AliasSeq!(string, int, S); alias MyVariant = VariantN!(maxSize!Types, Types); auto v = MyVariant(S.init); assert(v == S.init); } // Issue #10961 @system unittest { // Primarily test that we can assign a void[] to a Variant. void[] elements = cast(void[])[1, 2, 3]; Variant v = elements; void[] returned = v.get!(void[]); assert(returned == elements); } // Issue #13352 @system unittest { alias TP = Algebraic!(long); auto a = TP(1L); auto b = TP(2L); assert(!TP.allowed!ulong); assert(a + b == 3L); assert(a + 2 == 3L); assert(1 + b == 3L); alias TP2 = Algebraic!(long, string); auto c = TP2(3L); assert(a + c == 4L); } // Issue #13354 @system unittest { alias A = Algebraic!(string[]); A a = ["a", "b"]; assert(a[0] == "a"); assert(a[1] == "b"); a[1] = "c"; assert(a[1] == "c"); alias AA = Algebraic!(int[string]); AA aa = ["a": 1, "b": 2]; assert(aa["a"] == 1); assert(aa["b"] == 2); aa["b"] = 3; assert(aa["b"] == 3); } // Issue #14198 @system unittest { Variant a = true; assert(a.type == typeid(bool)); } // Issue #14233 @system unittest { alias Atom = Algebraic!(string, This[]); Atom[] values = []; auto a = Atom(values); } pure nothrow @nogc @system unittest { Algebraic!(int, double) a; a = 100; a = 1.0; } // Issue 14457 @system unittest { alias A = Algebraic!(int, float, double); alias B = Algebraic!(int, float); A a = 1; B b = 6f; a = b; assert(a.type == typeid(float)); assert(a.get!float == 6f); } // Issue 14585 @system unittest { static struct S { int x = 42; ~this() {assert(x == 42);} } Variant(S()).get!S; } // Issue 14586 @system unittest { const Variant v = new immutable Object; v.get!(immutable Object); } @system unittest { static struct S { T opCast(T)() {assert(false);} } Variant v = S(); v.get!S; } // issue 13262 @system unittest { static void fun(T)(Variant v){ T x; v = x; auto r = v.get!(T); } Variant v; fun!(shared(int))(v); fun!(shared(int)[])(v); static struct S1 { int c; string a; } static struct S2 { string a; shared int[] b; } static struct S3 { string a; shared int[] b; int c; } fun!(S1)(v); fun!(shared(S1))(v); fun!(S2)(v); fun!(shared(S2))(v); fun!(S3)(v); fun!(shared(S3))(v); // ensure structs that are shared, but don't have shared postblits // can't be used. static struct S4 { int x; this(this) {x = 0;} } fun!(S4)(v); static assert(!is(typeof(fun!(shared(S4))(v)))); } @safe unittest { Algebraic!(int) x; static struct SafeS { @safe ~this() {} } Algebraic!(SafeS) y; } /** _Algebraic data type restricted to a closed set of possible types. It's an alias for $(LREF VariantN) with an appropriately-constructed maximum size. `Algebraic` is useful when it is desirable to restrict what a discriminated type could hold to the end of defining simpler and more efficient manipulation. */ template Algebraic(T...) { alias Algebraic = VariantN!(maxSize!T, T); } /// @system unittest { auto v = Algebraic!(int, double, string)(5); assert(v.peek!(int)); v = 3.14; assert(v.peek!(double)); // auto x = v.peek!(long); // won't compile, type long not allowed // v = '1'; // won't compile, type char not allowed } /** $(H4 Self-Referential Types) A useful and popular use of algebraic data structures is for defining $(LUCKY self-referential data structures), i.e. structures that embed references to values of their own type within. This is achieved with `Algebraic` by using `This` as a placeholder whenever a reference to the type being defined is needed. The `Algebraic` instantiation will perform $(LINK2 https://en.wikipedia.org/wiki/Name_resolution_(programming_languages)#Alpha_renaming_to_make_name_resolution_trivial, alpha renaming) on its constituent types, replacing `This` with the self-referenced type. The structure of the type involving `This` may be arbitrarily complex. */ @system unittest { import std.typecons : Tuple, tuple; // A tree is either a leaf or a branch of two other trees alias Tree(Leaf) = Algebraic!(Leaf, Tuple!(This*, This*)); Tree!int tree = tuple(new Tree!int(42), new Tree!int(43)); Tree!int* right = tree.get!1[1]; assert(*right == 43); // An object is a double, a string, or a hash of objects alias Obj = Algebraic!(double, string, This[string]); Obj obj = "hello"; assert(obj.get!1 == "hello"); obj = 42.0; assert(obj.get!0 == 42); obj = ["customer": Obj("John"), "paid": Obj(23.95)]; assert(obj.get!2["customer"] == "John"); } private struct FakeComplexReal { real re, im; } /** Alias for $(LREF VariantN) instantiated with the largest size of `creal`, `char[]`, and `void delegate()`. This ensures that `Variant` is large enough to hold all of D's predefined types unboxed, including all numeric types, pointers, delegates, and class references. You may want to use `VariantN` directly with a different maximum size either for storing larger types unboxed, or for saving memory. */ alias Variant = VariantN!(maxSize!(FakeComplexReal, char[], void delegate())); /// @system unittest { Variant a; // Must assign before use, otherwise exception ensues // Initialize with an integer; make the type int Variant b = 42; assert(b.type == typeid(int)); // Peek at the value assert(b.peek!(int) !is null && *b.peek!(int) == 42); // Automatically convert per language rules auto x = b.get!(real); // Assign any other type, including other variants a = b; a = 3.14; assert(a.type == typeid(double)); // Implicit conversions work just as with built-in types assert(a < b); // Check for convertibility assert(!a.convertsTo!(int)); // double not convertible to int // Strings and all other arrays are supported a = "now I'm a string"; assert(a == "now I'm a string"); } /// can also assign arrays @system unittest { Variant a = new int[42]; assert(a.length == 42); a[5] = 7; assert(a[5] == 7); } /// Can also assign class values @system unittest { Variant a; class Foo {} auto foo = new Foo; a = foo; assert(*a.peek!(Foo) == foo); // and full type information is preserved } /** * Returns an array of variants constructed from `args`. * * This is by design. During construction the `Variant` needs * static type information about the type being held, so as to store a * pointer to function for fast retrieval. */ Variant[] variantArray(T...)(T args) { Variant[] result; foreach (arg; args) { result ~= Variant(arg); } return result; } /// @system unittest { auto a = variantArray(1, 3.14, "Hi!"); assert(a[1] == 3.14); auto b = Variant(a); // variant array as variant assert(b[1] == 3.14); } /** * Thrown in three cases: * * $(OL $(LI An uninitialized `Variant` is used in any way except * assignment and `hasValue`;) $(LI A `get` or * `coerce` is attempted with an incompatible target type;) * $(LI A comparison between `Variant` objects of * incompatible types is attempted.)) * */ // @@@ BUG IN COMPILER. THE 'STATIC' BELOW SHOULD NOT COMPILE static class VariantException : Exception { /// The source type in the conversion or comparison TypeInfo source; /// The target type in the conversion or comparison TypeInfo target; this(string s) { super(s); } this(TypeInfo source, TypeInfo target) { super("Variant: attempting to use incompatible types " ~ source.toString() ~ " and " ~ target.toString()); this.source = source; this.target = target; } } /// @system unittest { import std.exception : assertThrown; Variant v; // uninitialized use assertThrown!VariantException(v + 1); assertThrown!VariantException(v.length); // .get with an incompatible target type assertThrown!VariantException(Variant("a").get!int); // comparison between incompatible types assertThrown!VariantException(Variant(3) < Variant("a")); } @system unittest { alias W1 = This2Variant!(char, int, This[int]); alias W2 = AliasSeq!(int, char[int]); static assert(is(W1 == W2)); alias var_t = Algebraic!(void, string); var_t foo = "quux"; } @system unittest { alias A = Algebraic!(real, This[], This[int], This[This]); A v1, v2, v3; v2 = 5.0L; v3 = 42.0L; //v1 = [ v2 ][]; auto v = v1.peek!(A[]); //writeln(v[0]); v1 = [ 9 : v3 ]; //writeln(v1); v1 = [ v3 : v3 ]; //writeln(v1); } @system unittest { import std.conv : ConvException; import std.exception : assertThrown, collectException; // try it with an oddly small size VariantN!(1) test; assert(test.size > 1); // variantArray tests auto heterogeneous = variantArray(1, 4.5, "hi"); assert(heterogeneous.length == 3); auto variantArrayAsVariant = Variant(heterogeneous); assert(variantArrayAsVariant[0] == 1); assert(variantArrayAsVariant.length == 3); // array tests auto arr = Variant([1.2].dup); auto e = arr[0]; assert(e == 1.2); arr[0] = 2.0; assert(arr[0] == 2); arr ~= 4.5; assert(arr[1] == 4.5); // general tests Variant a; auto b = Variant(5); assert(!b.peek!(real) && b.peek!(int)); // assign a = *b.peek!(int); // comparison assert(a == b, a.type.toString() ~ " " ~ b.type.toString()); auto c = Variant("this is a string"); assert(a != c); // comparison via implicit conversions a = 42; b = 42.0; assert(a == b); // try failing conversions bool failed = false; try { auto d = c.get!(int); } catch (Exception e) { //writeln(stderr, e.toString); failed = true; } assert(failed); // :o) // toString tests a = Variant(42); assert(a.toString() == "42"); a = Variant(42.22); assert(a.toString() == "42.22"); // coerce tests a = Variant(42.22); assert(a.coerce!(int) == 42); a = cast(short) 5; assert(a.coerce!(double) == 5); a = Variant("10"); assert(a.coerce!int == 10); a = Variant(1); assert(a.coerce!bool); a = Variant(0); assert(!a.coerce!bool); a = Variant(1.0); assert(a.coerce!bool); a = Variant(0.0); assert(!a.coerce!bool); a = Variant(float.init); assertThrown!ConvException(a.coerce!bool); a = Variant("true"); assert(a.coerce!bool); a = Variant("false"); assert(!a.coerce!bool); a = Variant(""); assertThrown!ConvException(a.coerce!bool); // Object tests class B1 {} class B2 : B1 {} a = new B2; assert(a.coerce!(B1) !is null); a = new B1; assert(collectException(a.coerce!(B2) is null)); a = cast(Object) new B2; // lose static type info; should still work assert(a.coerce!(B2) !is null); // struct Big { int a[45]; } // a = Big.init; // hash assert(a.toHash() != 0); } // tests adapted from // http://www.dsource.org/projects/tango/browser/trunk/tango/core/Variant.d?rev=2601 @system unittest { Variant v; assert(!v.hasValue); v = 42; assert( v.peek!(int) ); assert( v.convertsTo!(long) ); assert( v.get!(int) == 42 ); assert( v.get!(long) == 42L ); assert( v.get!(ulong) == 42uL ); v = "Hello, World!"; assert( v.peek!(string) ); assert( v.get!(string) == "Hello, World!" ); assert(!is(char[] : wchar[])); assert( !v.convertsTo!(wchar[]) ); assert( v.get!(string) == "Hello, World!" ); // Literal arrays are dynamically-typed v = cast(int[4]) [1,2,3,4]; assert( v.peek!(int[4]) ); assert( v.get!(int[4]) == [1,2,3,4] ); { v = [1,2,3,4,5]; assert( v.peek!(int[]) ); assert( v.get!(int[]) == [1,2,3,4,5] ); } v = 3.1413; assert( v.peek!(double) ); assert( v.convertsTo!(real) ); //@@@ BUG IN COMPILER: DOUBLE SHOULD NOT IMPLICITLY CONVERT TO FLOAT assert( !v.convertsTo!(float) ); assert( *v.peek!(double) == 3.1413 ); auto u = Variant(v); assert( u.peek!(double) ); assert( *u.peek!(double) == 3.1413 ); // operators v = 38; assert( v + 4 == 42 ); assert( 4 + v == 42 ); assert( v - 4 == 34 ); assert( Variant(4) - v == -34 ); assert( v * 2 == 76 ); assert( 2 * v == 76 ); assert( v / 2 == 19 ); assert( Variant(2) / v == 0 ); assert( v % 2 == 0 ); assert( Variant(2) % v == 2 ); assert( (v & 6) == 6 ); assert( (6 & v) == 6 ); assert( (v | 9) == 47 ); assert( (9 | v) == 47 ); assert( (v ^ 5) == 35 ); assert( (5 ^ v) == 35 ); assert( v << 1 == 76 ); assert( Variant(1) << Variant(2) == 4 ); assert( v >> 1 == 19 ); assert( Variant(4) >> Variant(2) == 1 ); assert( Variant("abc") ~ "def" == "abcdef" ); assert( Variant("abc") ~ Variant("def") == "abcdef" ); v = 38; v += 4; assert( v == 42 ); v = 38; v -= 4; assert( v == 34 ); v = 38; v *= 2; assert( v == 76 ); v = 38; v /= 2; assert( v == 19 ); v = 38; v %= 2; assert( v == 0 ); v = 38; v &= 6; assert( v == 6 ); v = 38; v |= 9; assert( v == 47 ); v = 38; v ^= 5; assert( v == 35 ); v = 38; v <<= 1; assert( v == 76 ); v = 38; v >>= 1; assert( v == 19 ); v = 38; v += 1; assert( v < 40 ); v = "abc"; v ~= "def"; assert( v == "abcdef", *v.peek!(char[]) ); assert( Variant(0) < Variant(42) ); assert( Variant(42) > Variant(0) ); assert( Variant(42) > Variant(0.1) ); assert( Variant(42.1) > Variant(1) ); assert( Variant(21) == Variant(21) ); assert( Variant(0) != Variant(42) ); assert( Variant("bar") == Variant("bar") ); assert( Variant("foo") != Variant("bar") ); { auto v1 = Variant(42); auto v2 = Variant("foo"); int[Variant] hash; hash[v1] = 0; hash[v2] = 1; assert( hash[v1] == 0 ); assert( hash[v2] == 1 ); } { int[char[]] hash; hash["a"] = 1; hash["b"] = 2; hash["c"] = 3; Variant vhash = hash; assert( vhash.get!(int[char[]])["a"] == 1 ); assert( vhash.get!(int[char[]])["b"] == 2 ); assert( vhash.get!(int[char[]])["c"] == 3 ); } } version (TestComplex) deprecated @system unittest { auto v3 = Variant(1+2.0i); hash[v3] = 2; assert( hash[v3] == 2 ); } @system unittest { // check comparisons incompatible with AllowedTypes Algebraic!int v = 2; assert(v == 2); assert(v < 3); static assert(!__traits(compiles, {v == long.max;})); static assert(!__traits(compiles, {v == null;})); static assert(!__traits(compiles, {v < long.max;})); static assert(!__traits(compiles, {v > null;})); } @system unittest { // bug 1558 Variant va=1; Variant vb=-2; assert((va+vb).get!(int) == -1); assert((va-vb).get!(int) == 3); } @system unittest { Variant a; a=5; Variant b; b=a; Variant[] c; c = variantArray(1, 2, 3.0, "hello", 4); assert(c[3] == "hello"); } @system unittest { Variant v = 5; assert(!__traits(compiles, v.coerce!(bool delegate()))); } @system unittest { struct Huge { real a, b, c, d, e, f, g; } Huge huge; huge.e = 42; Variant v; v = huge; // Compile time error. assert(v.get!(Huge).e == 42); } @system unittest { const x = Variant(42); auto y1 = x.get!(const int); // @@@BUG@@@ //auto y2 = x.get!(immutable int)(); } // test iteration @system unittest { auto v = Variant([ 1, 2, 3, 4 ][]); auto j = 0; foreach (int i; v) { assert(i == ++j); } assert(j == 4); } // test convertibility @system unittest { auto v = Variant("abc".dup); assert(v.convertsTo!(char[])); } // http://d.puremagic.com/issues/show_bug.cgi?id=5424 @system unittest { interface A { void func1(); } static class AC: A { void func1() { } } A a = new AC(); a.func1(); Variant b = Variant(a); } @system unittest { // bug 7070 Variant v; v = null; } // Class and interface opEquals, issue 12157 @system unittest { class Foo { } class DerivedFoo : Foo { } Foo f1 = new Foo(); Foo f2 = new DerivedFoo(); Variant v1 = f1, v2 = f2; assert(v1 == f1); assert(v1 != new Foo()); assert(v1 != f2); assert(v2 != v1); assert(v2 == f2); } // Const parameters with opCall, issue 11361. @system unittest { static string t1(string c) { return c ~ "a"; } static const(char)[] t2(const(char)[] p) { return p ~ "b"; } static char[] t3(int p) { import std.conv : text; return p.text.dup; } Variant v1 = &t1; Variant v2 = &t2; Variant v3 = &t3; assert(v1("abc") == "abca"); assert(v1("abc").type == typeid(string)); assert(v2("abc") == "abcb"); assert(v2(cast(char[])("abc".dup)) == "abcb"); assert(v2("abc").type == typeid(const(char)[])); assert(v3(4) == ['4']); assert(v3(4).type == typeid(char[])); } // issue 12071 @system unittest { static struct Structure { int data; } alias VariantTest = Algebraic!(Structure delegate() pure nothrow @nogc @safe); bool called = false; Structure example() pure nothrow @nogc @safe { called = true; return Structure.init; } auto m = VariantTest(&example); m(); assert(called); } // Ordering comparisons of incompatible types, e.g. issue 7990. @system unittest { import std.exception : assertThrown; assertThrown!VariantException(Variant(3) < "a"); assertThrown!VariantException("a" < Variant(3)); assertThrown!VariantException(Variant(3) < Variant("a")); assertThrown!VariantException(Variant.init < Variant(3)); assertThrown!VariantException(Variant(3) < Variant.init); } // Handling of unordered types, e.g. issue 9043. @system unittest { import std.exception : assertThrown; static struct A { int a; } assert(Variant(A(3)) != A(4)); assertThrown!VariantException(Variant(A(3)) < A(4)); assertThrown!VariantException(A(3) < Variant(A(4))); assertThrown!VariantException(Variant(A(3)) < Variant(A(4))); } // Handling of empty types and arrays, e.g. issue 10958 @system unittest { class EmptyClass { } struct EmptyStruct { } alias EmptyArray = void[0]; alias Alg = Algebraic!(EmptyClass, EmptyStruct, EmptyArray); Variant testEmpty(T)() { T inst; Variant v = inst; assert(v.get!T == inst); assert(v.peek!T !is null); assert(*v.peek!T == inst); Alg alg = inst; assert(alg.get!T == inst); return v; } testEmpty!EmptyClass(); testEmpty!EmptyStruct(); testEmpty!EmptyArray(); // EmptyClass/EmptyStruct sizeof is 1, so we have this to test just size 0. EmptyArray arr = EmptyArray.init; Algebraic!(EmptyArray) a = arr; assert(a.length == 0); assert(a.get!EmptyArray == arr); } // Handling of void function pointers / delegates, e.g. issue 11360 @system unittest { static void t1() { } Variant v = &t1; assert(v() == Variant.init); static int t2() { return 3; } Variant v2 = &t2; assert(v2() == 3); } // Using peek for large structs, issue 8580 @system unittest { struct TestStruct(bool pad) { int val1; static if (pad) ubyte[Variant.size] padding; int val2; } void testPeekWith(T)() { T inst; inst.val1 = 3; inst.val2 = 4; Variant v = inst; T* original = v.peek!T; assert(original.val1 == 3); assert(original.val2 == 4); original.val1 = 6; original.val2 = 8; T modified = v.get!T; assert(modified.val1 == 6); assert(modified.val2 == 8); } testPeekWith!(TestStruct!false)(); testPeekWith!(TestStruct!true)(); } /** * Applies a delegate or function to the given $(LREF Algebraic) depending on the held type, * ensuring that all types are handled by the visiting functions. * * The delegate or function having the currently held value as parameter is called * with `variant`'s current value. Visiting handlers are passed * in the template parameter list. * It is statically ensured that all held types of * `variant` are handled across all handlers. * `visit` allows delegates and static functions to be passed * as parameters. * * If a function with an untyped parameter is specified, this function is called * when the variant contains a type that does not match any other function. * This can be used to apply the same function across multiple possible types. * Exactly one generic function is allowed. * * If a function without parameters is specified, this function is called * when `variant` doesn't hold a value. Exactly one parameter-less function * is allowed. * * Duplicate overloads matching the same type in one of the visitors are disallowed. * * Returns: The return type of visit is deduced from the visiting functions and must be * the same across all overloads. * Throws: $(LREF VariantException) if `variant` doesn't hold a value and no * parameter-less fallback function is specified. */ template visit(Handlers...) if (Handlers.length > 0) { /// auto visit(VariantType)(VariantType variant) if (isAlgebraic!VariantType) { return visitImpl!(true, VariantType, Handlers)(variant); } } /// @system unittest { Algebraic!(int, string) variant; variant = 10; assert(variant.visit!((string s) => cast(int) s.length, (int i) => i)() == 10); variant = "string"; assert(variant.visit!((int i) => i, (string s) => cast(int) s.length)() == 6); // Error function usage Algebraic!(int, string) emptyVar; auto rslt = emptyVar.visit!((string s) => cast(int) s.length, (int i) => i, () => -1)(); assert(rslt == -1); // Generic function usage Algebraic!(int, float, real) number = 2; assert(number.visit!(x => x += 1) == 3); // Generic function for int/float with separate behavior for string Algebraic!(int, float, string) something = 2; assert(something.visit!((string s) => s.length, x => x) == 2); // generic something = "asdf"; assert(something.visit!((string s) => s.length, x => x) == 4); // string // Generic handler and empty handler Algebraic!(int, float, real) empty2; assert(empty2.visit!(x => x + 1, () => -1) == -1); } @system unittest { Algebraic!(size_t, string) variant; // not all handled check static assert(!__traits(compiles, variant.visit!((size_t i){ })() )); variant = cast(size_t) 10; auto which = 0; variant.visit!( (string s) => which = 1, (size_t i) => which = 0 )(); // integer overload was called assert(which == 0); // mustn't compile as generic Variant not supported Variant v; static assert(!__traits(compiles, v.visit!((string s) => which = 1, (size_t i) => which = 0 )() )); static size_t func(string s) { return s.length; } variant = "test"; assert( 4 == variant.visit!(func, (size_t i) => i )()); Algebraic!(int, float, string) variant2 = 5.0f; // Shouldn' t compile as float not handled by visitor. static assert(!__traits(compiles, variant2.visit!( (int _) {}, (string _) {})())); Algebraic!(size_t, string, float) variant3; variant3 = 10.0f; auto floatVisited = false; assert(variant3.visit!( (float f) { floatVisited = true; return cast(size_t) f; }, func, (size_t i) { return i; } )() == 10); assert(floatVisited == true); Algebraic!(float, string) variant4; assert(variant4.visit!(func, (float f) => cast(size_t) f, () => size_t.max)() == size_t.max); // double error func check static assert(!__traits(compiles, visit!(() => size_t.max, func, (float f) => cast(size_t) f, () => size_t.max)(variant4)) ); } // disallow providing multiple generic handlers to visit // disallow a generic handler that does not apply to all types @system unittest { Algebraic!(int, float) number = 2; // ok, x + 1 valid for int and float static assert( __traits(compiles, number.visit!(x => x + 1))); // bad, two generic handlers static assert(!__traits(compiles, number.visit!(x => x + 1, x => x + 2))); // bad, x ~ "a" does not apply to int or float static assert(!__traits(compiles, number.visit!(x => x ~ "a"))); // bad, x ~ "a" does not apply to int or float static assert(!__traits(compiles, number.visit!(x => x + 1, x => x ~ "a"))); Algebraic!(int, string) maybenumber = 2; // ok, x ~ "a" valid for string, x + 1 valid for int, only 1 generic static assert( __traits(compiles, number.visit!((string x) => x ~ "a", x => x + 1))); // bad, x ~ "a" valid for string but not int static assert(!__traits(compiles, number.visit!(x => x ~ "a"))); // bad, two generics, each only applies in one case static assert(!__traits(compiles, number.visit!(x => x + 1, x => x ~ "a"))); } /** * Behaves as $(LREF visit) but doesn't enforce that all types are handled * by the visiting functions. * * If a parameter-less function is specified it is called when * either `variant` doesn't hold a value or holds a type * which isn't handled by the visiting functions. * * Returns: The return type of tryVisit is deduced from the visiting functions and must be * the same across all overloads. * Throws: $(LREF VariantException) if `variant` doesn't hold a value or * `variant` holds a value which isn't handled by the visiting functions, * when no parameter-less fallback function is specified. */ template tryVisit(Handlers...) if (Handlers.length > 0) { /// auto tryVisit(VariantType)(VariantType variant) if (isAlgebraic!VariantType) { return visitImpl!(false, VariantType, Handlers)(variant); } } /// @system unittest { Algebraic!(int, string) variant; variant = 10; auto which = -1; variant.tryVisit!((int i) { which = 0; })(); assert(which == 0); // Error function usage variant = "test"; variant.tryVisit!((int i) { which = 0; }, () { which = -100; })(); assert(which == -100); } @system unittest { import std.exception : assertThrown; Algebraic!(int, string) variant; variant = 10; auto which = -1; variant.tryVisit!((int i){ which = 0; })(); assert(which == 0); variant = "test"; assertThrown!VariantException(variant.tryVisit!((int i) { which = 0; })()); void errorfunc() { which = -1; } variant.tryVisit!((int i) { which = 0; }, errorfunc)(); assert(which == -1); } private template isAlgebraic(Type) { static if (is(Type _ == VariantN!T, T...)) enum isAlgebraic = T.length >= 2; // T[0] == maxDataSize, T[1..$] == AllowedTypesParam else enum isAlgebraic = false; } @system unittest { static assert(!isAlgebraic!(Variant)); static assert( isAlgebraic!(Algebraic!(string))); static assert( isAlgebraic!(Algebraic!(int, int[]))); } private auto visitImpl(bool Strict, VariantType, Handler...)(VariantType variant) if (isAlgebraic!VariantType && Handler.length > 0) { alias AllowedTypes = VariantType.AllowedTypes; /** * Returns: Struct where `indices` is an array which * contains at the n-th position the index in Handler which takes the * n-th type of AllowedTypes. If an Handler doesn't match an * AllowedType, -1 is set. If a function in the delegates doesn't * have parameters, the field `exceptionFuncIdx` is set; * otherwise it's -1. */ auto visitGetOverloadMap() { struct Result { int[AllowedTypes.length] indices; int exceptionFuncIdx = -1; int generalFuncIdx = -1; } Result result; foreach (tidx, T; AllowedTypes) { bool added = false; foreach (dgidx, dg; Handler) { // Handle normal function objects static if (isSomeFunction!dg) { alias Params = Parameters!dg; static if (Params.length == 0) { // Just check exception functions in the first // inner iteration (over delegates) if (tidx > 0) continue; else { if (result.exceptionFuncIdx != -1) assert(false, "duplicate parameter-less (error-)function specified"); result.exceptionFuncIdx = dgidx; } } else static if (is(Params[0] == T) || is(Unqual!(Params[0]) == T)) { if (added) assert(false, "duplicate overload specified for type '" ~ T.stringof ~ "'"); added = true; result.indices[tidx] = dgidx; } } else static if (isSomeFunction!(dg!T)) { assert(result.generalFuncIdx == -1 || result.generalFuncIdx == dgidx, "Only one generic visitor function is allowed"); result.generalFuncIdx = dgidx; } // Handle composite visitors with opCall overloads else { static assert(false, dg.stringof ~ " is not a function or delegate"); } } if (!added) result.indices[tidx] = -1; } return result; } enum HandlerOverloadMap = visitGetOverloadMap(); if (!variant.hasValue) { // Call the exception function. The HandlerOverloadMap // will have its exceptionFuncIdx field set to value != -1 if an // exception function has been specified; otherwise we just through an exception. static if (HandlerOverloadMap.exceptionFuncIdx != -1) return Handler[ HandlerOverloadMap.exceptionFuncIdx ](); else throw new VariantException("variant must hold a value before being visited."); } foreach (idx, T; AllowedTypes) { if (auto ptr = variant.peek!T) { enum dgIdx = HandlerOverloadMap.indices[idx]; static if (dgIdx == -1) { static if (HandlerOverloadMap.generalFuncIdx >= 0) return Handler[HandlerOverloadMap.generalFuncIdx](*ptr); else static if (Strict) static assert(false, "overload for type '" ~ T.stringof ~ "' hasn't been specified"); else static if (HandlerOverloadMap.exceptionFuncIdx != -1) return Handler[HandlerOverloadMap.exceptionFuncIdx](); else throw new VariantException( "variant holds value of type '" ~ T.stringof ~ "' but no visitor has been provided" ); } else { return Handler[ dgIdx ](*ptr); } } } assert(false); } @system unittest { // validate that visit can be called with a const type struct Foo { int depth; } struct Bar { int depth; } alias FooBar = Algebraic!(Foo, Bar); int depth(in FooBar fb) { return fb.visit!((Foo foo) => foo.depth, (Bar bar) => bar.depth); } FooBar fb = Foo(3); assert(depth(fb) == 3); } @system unittest { // https://issues.dlang.org/show_bug.cgi?id=16383 class Foo {this() immutable {}} alias V = Algebraic!(immutable Foo); auto x = V(new immutable Foo).visit!( (immutable(Foo) _) => 3 ); assert(x == 3); } @system unittest { // http://d.puremagic.com/issues/show_bug.cgi?id=5310 const Variant a; assert(a == a); Variant b; assert(a == b); assert(b == a); } @system unittest { const Variant a = [2]; assert(a[0] == 2); } @system unittest { // http://d.puremagic.com/issues/show_bug.cgi?id=10017 static struct S { ubyte[Variant.size + 1] s; } Variant v1, v2; v1 = S(); // the payload is allocated on the heap v2 = v1; // AssertError: target must be non-null assert(v1 == v2); } @system unittest { import std.exception : assertThrown; // http://d.puremagic.com/issues/show_bug.cgi?id=7069 Variant v; int i = 10; v = i; static foreach (qual; AliasSeq!(MutableOf, ConstOf)) { assert(v.get!(qual!int) == 10); assert(v.get!(qual!float) == 10.0f); } static foreach (qual; AliasSeq!(ImmutableOf, SharedOf, SharedConstOf)) { assertThrown!VariantException(v.get!(qual!int)); } const(int) ci = 20; v = ci; static foreach (qual; AliasSeq!(ConstOf)) { assert(v.get!(qual!int) == 20); assert(v.get!(qual!float) == 20.0f); } static foreach (qual; AliasSeq!(MutableOf, ImmutableOf, SharedOf, SharedConstOf)) { assertThrown!VariantException(v.get!(qual!int)); assertThrown!VariantException(v.get!(qual!float)); } immutable(int) ii = ci; v = ii; static foreach (qual; AliasSeq!(ImmutableOf, ConstOf, SharedConstOf)) { assert(v.get!(qual!int) == 20); assert(v.get!(qual!float) == 20.0f); } static foreach (qual; AliasSeq!(MutableOf, SharedOf)) { assertThrown!VariantException(v.get!(qual!int)); assertThrown!VariantException(v.get!(qual!float)); } int[] ai = [1,2,3]; v = ai; static foreach (qual; AliasSeq!(MutableOf, ConstOf)) { assert(v.get!(qual!(int[])) == [1,2,3]); assert(v.get!(qual!(int)[]) == [1,2,3]); } static foreach (qual; AliasSeq!(ImmutableOf, SharedOf, SharedConstOf)) { assertThrown!VariantException(v.get!(qual!(int[]))); assertThrown!VariantException(v.get!(qual!(int)[])); } const(int[]) cai = [4,5,6]; v = cai; static foreach (qual; AliasSeq!(ConstOf)) { assert(v.get!(qual!(int[])) == [4,5,6]); assert(v.get!(qual!(int)[]) == [4,5,6]); } static foreach (qual; AliasSeq!(MutableOf, ImmutableOf, SharedOf, SharedConstOf)) { assertThrown!VariantException(v.get!(qual!(int[]))); assertThrown!VariantException(v.get!(qual!(int)[])); } immutable(int[]) iai = [7,8,9]; v = iai; //assert(v.get!(immutable(int[])) == [7,8,9]); // Bug ??? runtime error assert(v.get!(immutable(int)[]) == [7,8,9]); assert(v.get!(const(int[])) == [7,8,9]); assert(v.get!(const(int)[]) == [7,8,9]); //assert(v.get!(shared(const(int[]))) == cast(shared const)[7,8,9]); // Bug ??? runtime error //assert(v.get!(shared(const(int))[]) == cast(shared const)[7,8,9]); // Bug ??? runtime error static foreach (qual; AliasSeq!(MutableOf)) { assertThrown!VariantException(v.get!(qual!(int[]))); assertThrown!VariantException(v.get!(qual!(int)[])); } class A {} class B : A {} B b = new B(); v = b; static foreach (qual; AliasSeq!(MutableOf, ConstOf)) { assert(v.get!(qual!B) is b); assert(v.get!(qual!A) is b); assert(v.get!(qual!Object) is b); } static foreach (qual; AliasSeq!(ImmutableOf, SharedOf, SharedConstOf)) { assertThrown!VariantException(v.get!(qual!B)); assertThrown!VariantException(v.get!(qual!A)); assertThrown!VariantException(v.get!(qual!Object)); } const(B) cb = new B(); v = cb; static foreach (qual; AliasSeq!(ConstOf)) { assert(v.get!(qual!B) is cb); assert(v.get!(qual!A) is cb); assert(v.get!(qual!Object) is cb); } static foreach (qual; AliasSeq!(MutableOf, ImmutableOf, SharedOf, SharedConstOf)) { assertThrown!VariantException(v.get!(qual!B)); assertThrown!VariantException(v.get!(qual!A)); assertThrown!VariantException(v.get!(qual!Object)); } immutable(B) ib = new immutable(B)(); v = ib; static foreach (qual; AliasSeq!(ImmutableOf, ConstOf, SharedConstOf)) { assert(v.get!(qual!B) is ib); assert(v.get!(qual!A) is ib); assert(v.get!(qual!Object) is ib); } static foreach (qual; AliasSeq!(MutableOf, SharedOf)) { assertThrown!VariantException(v.get!(qual!B)); assertThrown!VariantException(v.get!(qual!A)); assertThrown!VariantException(v.get!(qual!Object)); } shared(B) sb = new shared B(); v = sb; static foreach (qual; AliasSeq!(SharedOf, SharedConstOf)) { assert(v.get!(qual!B) is sb); assert(v.get!(qual!A) is sb); assert(v.get!(qual!Object) is sb); } static foreach (qual; AliasSeq!(MutableOf, ImmutableOf, ConstOf)) { assertThrown!VariantException(v.get!(qual!B)); assertThrown!VariantException(v.get!(qual!A)); assertThrown!VariantException(v.get!(qual!Object)); } shared(const(B)) scb = new shared const B(); v = scb; static foreach (qual; AliasSeq!(SharedConstOf)) { assert(v.get!(qual!B) is scb); assert(v.get!(qual!A) is scb); assert(v.get!(qual!Object) is scb); } static foreach (qual; AliasSeq!(MutableOf, ConstOf, ImmutableOf, SharedOf)) { assertThrown!VariantException(v.get!(qual!B)); assertThrown!VariantException(v.get!(qual!A)); assertThrown!VariantException(v.get!(qual!Object)); } } @system unittest { static struct DummyScope { // https://d.puremagic.com/issues/show_bug.cgi?id=12540 alias Alias12540 = Algebraic!Class12540; static class Class12540 { Alias12540 entity; } } } @system unittest { // https://issues.dlang.org/show_bug.cgi?id=10194 // Also test for elaborate copying static struct S { @disable this(); this(int dummy) { ++cnt; } this(this) { ++cnt; } @disable S opAssign(); ~this() { --cnt; assert(cnt >= 0); } static int cnt = 0; } { Variant v; { v = S(0); assert(S.cnt == 1); } assert(S.cnt == 1); // assigning a new value should destroy the existing one v = 0; assert(S.cnt == 0); // destroying the variant should destroy it's current value v = S(0); assert(S.cnt == 1); } assert(S.cnt == 0); } @system unittest { // Bugzilla 13300 static struct S { this(this) {} ~this() {} } static assert( hasElaborateCopyConstructor!(Variant)); static assert(!hasElaborateCopyConstructor!(Algebraic!bool)); static assert( hasElaborateCopyConstructor!(Algebraic!S)); static assert( hasElaborateCopyConstructor!(Algebraic!(bool, S))); static assert( hasElaborateDestructor!(Variant)); static assert(!hasElaborateDestructor!(Algebraic!bool)); static assert( hasElaborateDestructor!(Algebraic!S)); static assert( hasElaborateDestructor!(Algebraic!(bool, S))); import std.array; alias Value = Algebraic!bool; static struct T { Value value; @disable this(); } auto a = appender!(T[]); } @system unittest { // Bugzilla 13871 alias A = Algebraic!(int, typeof(null)); static struct B { A value; } alias C = std.variant.Algebraic!B; C var; var = C(B()); } @system unittest { import std.exception : assertThrown, assertNotThrown; // Make sure Variant can handle types with opDispatch but no length field. struct SWithNoLength { void opDispatch(string s)() { } } struct SWithLength { @property int opDispatch(string s)() { // Assume that s == "length" return 5; // Any value is OK for test. } } SWithNoLength sWithNoLength; Variant v = sWithNoLength; assertThrown!VariantException(v.length); SWithLength sWithLength; v = sWithLength; assertNotThrown!VariantException(v.get!SWithLength.length); assertThrown!VariantException(v.length); } @system unittest { // Bugzilla 13534 static assert(!__traits(compiles, () @safe { auto foo() @system { return 3; } auto v = Variant(&foo); v(); // foo is called in safe code!? })); } @system unittest { // Bugzilla 15039 import std.typecons; import std.variant; alias IntTypedef = Typedef!int; alias Obj = Algebraic!(int, IntTypedef, This[]); Obj obj = 1; obj.visit!( (int x) {}, (IntTypedef x) {}, (Obj[] x) {}, ); } @system unittest { // Bugzilla 15791 int n = 3; struct NS1 { int foo() { return n + 10; } } struct NS2 { int foo() { return n * 10; } } Variant v; v = NS1(); assert(v.get!NS1.foo() == 13); v = NS2(); assert(v.get!NS2.foo() == 30); } @system unittest { // Bugzilla 15827 static struct Foo15827 { Variant v; this(Foo15827 v) {} } Variant v = Foo15827.init; } @system unittest { // Bugzilla 18934 static struct S { const int x; } auto s = S(42); Variant v = s; auto s2 = v.get!S; assert(s2.x == 42); Variant v2 = v; // support copying from one variant to the other v2 = S(2); v = v2; assert(v.get!S.x == 2); } @system unittest { // Bugzilla 19200 static struct S { static int opBinaryRight(string op : "|", T)(T rhs) { return 3; } } S s; Variant v; auto b = v | s; assert(b == 3); }
D
/* * brush.d * * This module has the structure that is kept with a Brush class for Windows. * * Author: Dave Wilkinson * Originated: July 22th, 2009 * */ module platform.vars.brush; import binding.win32.gdiplusgpstubs; struct BrushPlatformVars { GpBrush* handle; }
D
/Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/JSON.build/Objects-normal/x86_64/JSON+Serialize.o : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Equatable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSONRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/Sequence+Convertible.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Parse.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Serialize.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Bytes.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSONContext.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Fuzzy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /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/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/JSON.build/Objects-normal/x86_64/JSON+Serialize~partial.swiftmodule : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Equatable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSONRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/Sequence+Convertible.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Parse.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Serialize.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Bytes.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSONContext.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Fuzzy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /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/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/JSON.build/Objects-normal/x86_64/JSON+Serialize~partial.swiftdoc : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Equatable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSONRepresentable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/Sequence+Convertible.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Parse.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Serialize.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Bytes.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSONContext.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/json.git-9153249592855998091/Sources/JSON/JSON+Fuzzy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /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
/Users/piaojin/Desktop/PiaojinSwiftServer/.build/debug/PerfectThread.build/ThreadQueue.swift.o : /Users/piaojin/Desktop/PiaojinSwiftServer/.build/checkouts/Perfect-Thread.git-6541237758607105655/Sources/Promise.swift /Users/piaojin/Desktop/PiaojinSwiftServer/.build/checkouts/Perfect-Thread.git-6541237758607105655/Sources/Threading.swift /Users/piaojin/Desktop/PiaojinSwiftServer/.build/checkouts/Perfect-Thread.git-6541237758607105655/Sources/ThreadQueue.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/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/ObjectiveC.apinotesc /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/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/CoreGraphics.apinotesc /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/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.apinotesc /Users/piaojin/Desktop/PiaojinSwiftServer/.build/debug/PerfectThread.build/ThreadQueue~partial.swiftmodule : /Users/piaojin/Desktop/PiaojinSwiftServer/.build/checkouts/Perfect-Thread.git-6541237758607105655/Sources/Promise.swift /Users/piaojin/Desktop/PiaojinSwiftServer/.build/checkouts/Perfect-Thread.git-6541237758607105655/Sources/Threading.swift /Users/piaojin/Desktop/PiaojinSwiftServer/.build/checkouts/Perfect-Thread.git-6541237758607105655/Sources/ThreadQueue.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/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/ObjectiveC.apinotesc /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/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/CoreGraphics.apinotesc /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/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.apinotesc /Users/piaojin/Desktop/PiaojinSwiftServer/.build/debug/PerfectThread.build/ThreadQueue~partial.swiftdoc : /Users/piaojin/Desktop/PiaojinSwiftServer/.build/checkouts/Perfect-Thread.git-6541237758607105655/Sources/Promise.swift /Users/piaojin/Desktop/PiaojinSwiftServer/.build/checkouts/Perfect-Thread.git-6541237758607105655/Sources/Threading.swift /Users/piaojin/Desktop/PiaojinSwiftServer/.build/checkouts/Perfect-Thread.git-6541237758607105655/Sources/ThreadQueue.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/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/ObjectiveC.apinotesc /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/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/CoreGraphics.apinotesc /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/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.apinotesc
D
/*#D*/ // Copyright © 2015, Jakob Bornecrantz. All rights reserved. // See copyright notice in src/volt/license.d (BOOST ver. 1.0). module volt.util.perf; version (Volt) { import core.typeinfo; import core.rt.gc; } import watt.io.std : writefln; import watt.io.streams : OutputFileStream; import mt = watt.io.monotonic; /*! * Very simple perfing code, just gets timing info. * * Yes these times are not super accurate and will drift a lot * over time. So don't be using these for missile guidence. */ struct Perf { int pos; long[] times; Counter counter; Accumulator stack; Accumulator accum; enum Mark { SETUP, PARSING, PHASE1, PHASE2, PHASE3, BACKEND, BITCODE, ASSEMBLE, LINK, EXIT, DONE, NUM_MARKS, // Ensure that this is last. } void perfInit() { auto t = mt.ticks(); times = new long[](cast(size_t)Mark.NUM_MARKS); times[pos++] = t; stack = new Accumulator("other"); stack.then = t; version (none) { new GCAccumulator(); } else { new Accumulator("GC"); } } void close() { assert(stack.below is null); auto t = mt.ticks(); stack.accum += t - stack.then; while (Mark.DONE >= pos) { times[pos++] = t; } } /*! * Place a mark in time, allows to skip phases. */ void mark(Mark mark) { assert(mark > Mark.SETUP); assert(mark < Mark.DONE); auto t = mt.ticks(); while (mark >= pos) { times[pos++] = t; } } void print(string file, string name) { auto f = new OutputFileStream(file); auto total = times[$-1] - times[0]; void doWrite(long t) { t = mt.convClockFreq(t, mt.ticksPerSecond, 1_000_000); f.writef("%s,", t); } // First line, names of marks. f.writef("--- Phases\n"); f.writef("name,"); for (size_t i = 1; i < times.length; i++) { f.writef("%s,", markNames[i-1]); } f.writef("total,\n%s,", name); for (size_t i = 1; i < times.length; i++) { doWrite(times[i] - times[i-1]); } doWrite(total); f.writef("\n\n"); f.writef("--- Accumulators\n"); f.writef("name,"); printAccumName(f, accum); f.writef("\n%s,", name); printAccumValue(f, accum); f.writef("\n\n"); f.writef("--- Counters\n"); f.writef("name,GC-numCollections,GC-numAllocs,GC-numAllocBytes,GC-numArrayAllocs,GC-numArrayBytes,GC-numClassAllocs,GC-numClassBytes,GC-numZeroAllocs,"); for (auto c = counter; c !is null; c = c.next) { f.writef("%s,", c.name); } f.writef("\n%s,", name); version (Volt) { Stats stats; vrt_gc_get_stats(/*#out*/stats); f.writef("%s,%s,%s,%s,%s,%s,%s,%s,", stats.num.collections, stats.num.allocs, stats.num.allocBytes, stats.num.arrayAllocs, stats.num.arrayBytes, stats.num.classAllocs, stats.num.classBytes, stats.num.zeroAllocs); } else { f.writef("0,0,0,0,0,0,0,0,"); } for (auto c = counter; c !is null; c = c.next) { f.writef("%s,", c.count); } f.writef("\n\n"); f.flush(); f.close(); } private: void printAccumName(OutputFileStream f, Accumulator a) { if (a is null) { return; } printAccumName(f, a.next); f.writef("%s,", a.name); } void printAccumValue(OutputFileStream f, Accumulator a) { if (a is null) { return; } printAccumValue(f, a.next); f.writef("%s,", mt.convClockFreq(a.accum, mt.ticksPerSecond, 1_000_000)); } enum string[] markNames = [ "setup", "parsing", "phase1", "phase2", "phase3", "backend", "bitcode-link", "assemble", "native-link", "exit", "done", ]; } class Accumulator { public: long accum; long then; Accumulator below; // Accumulator below this. Accumulator next; string name; public: this(string name) { this.name = name; this.next = perf.accum; perf.accum = this; } void start() { auto now = mt.ticks(); below = perf.stack; perf.stack = this; below.accum += now - below.then; this.then = now; } void stop() { auto now = mt.ticks(); accum += now - this.then; below.then = now; perf.stack = below; below = null; } } class Counter { public: string name; ulong count; Counter next; public: this(string name) { this.name = name; assert(perf.counter is null); this.next = perf.counter; perf.counter = this; } } version (Volt) class GCAccumulator : Accumulator { AllocDg mAllocDg; this() { super("GC"); mAllocDg = allocDg; allocDg = alloc; } void* alloc(TypeInfo ti, size_t c) { start(); auto ret = allocDg(ti, c); stop(); return ret; } } static Perf perf;
D
module std.experimental.allocator.building_blocks.free_list; import std.experimental.allocator.common; import std.typecons : Flag, Yes, No; /** $(WEB en.wikipedia.org/wiki/Free_list, Free list allocator), stackable on top of another allocator. Allocation requests between $(D min) and $(D max) bytes are rounded up to $(D max) and served from a singly-linked list of buffers deallocated in the past. All other allocations are directed to $(D ParentAllocator). Due to the simplicity of free list management, allocations from the free list are fast. One instantiation is of particular interest: $(D FreeList!(0, unbounded)) puts every deallocation in the freelist, and subsequently serves any allocation from the freelist (if not empty). There is no checking of size matching, which would be incorrect for a freestanding allocator but is both correct and fast when an owning allocator on top of the free list allocator (such as $(D Segregator)) is already in charge of handling size checking. The following methods are defined if $(D ParentAllocator) defines them, and forward to it: $(D expand), $(D owns), $(D reallocate). */ struct FreeList(ParentAllocator, size_t minSize, size_t maxSize = minSize, Flag!"adaptive" adaptive = No.adaptive) { import std.conv : text; import std.exception : enforce; import std.traits : hasMember; static assert(minSize != unbounded, "Use minSize = 0 for no low bound."); static assert(maxSize >= (void*).sizeof, "Maximum size must accommodate a pointer."); private enum unchecked = minSize == 0 && maxSize == unbounded; private enum hasTolerance = !unchecked && (minSize != maxSize || maxSize == chooseAtRuntime); static if (minSize == chooseAtRuntime) { /** Returns the smallest allocation size eligible for allocation from the freelist. (If $(D minSize != chooseAtRuntime), this is simply an alias for $(D minSize).) */ @property size_t min() const { assert(_min != chooseAtRuntime); return _min; } /** If $(D FreeList) has been instantiated with $(D minSize == chooseAtRuntime), then the $(D min) property is writable. Setting it must precede any allocation. Params: low = new value for $(D min) Precondition: $(D low <= max), or $(D maxSize == chooseAtRuntime) and $(D max) has not yet been initialized. Also, no allocation has been yet done with this allocator. Postcondition: $(D min == low) */ @property void min(size_t low) { assert(low <= max || max == chooseAtRuntime); minimize; _min = low; } } else { alias min = minSize; } static if (maxSize == chooseAtRuntime) { /** Returns the largest allocation size eligible for allocation from the freelist. (If $(D maxSize != chooseAtRuntime), this is simply an alias for $(D maxSize).) All allocation requests for sizes greater than or equal to $(D min) and less than or equal to $(D max) are rounded to $(D max) and forwarded to the parent allocator. When the block fitting the same constraint gets deallocated, it is put in the freelist with the allocated size assumed to be $(D max). */ @property size_t max() const { return _max; } /** If $(D FreeList) has been instantiated with $(D maxSize == chooseAtRuntime), then the $(D max) property is writable. Setting it must precede any allocation. Params: high = new value for $(D max) Precondition: $(D high >= min), or $(D minSize == chooseAtRuntime) and $(D min) has not yet been initialized. Also $(D high >= (void*).sizeof). Also, no allocation has been yet done with this allocator. Postcondition: $(D max == high) */ @property void max(size_t high) { assert((high >= min || min == chooseAtRuntime) && high >= (void*).sizeof); minimize; _max = high; } /// unittest { FreeList!(Mallocator, chooseAtRuntime, chooseAtRuntime) a; a.min = 64; a.max = 128; assert(a.min == 64); assert(a.max == 128); } } else { alias max = maxSize; } private bool tooSmall(size_t n) const { static if (minSize == 0) return false; else return n < min; } private bool tooLarge(size_t n) const { static if (maxSize == unbounded) return false; else return n > max; } private bool freeListEligible(size_t n) const { static if (unchecked) { return true; } else { static if (minSize == 0) { if (!n) return false; } static if (minSize == maxSize && minSize != chooseAtRuntime) return n == maxSize; else return !tooSmall(n) && !tooLarge(n); } } static if (!unchecked) private void[] blockFor(Node* p) { assert(p); return (cast(void*) p)[0 .. max]; } // statistics { static if (adaptive == Yes.adaptive) { private enum double windowLength = 1000.0; private enum double tooFewMisses = 0.01; private double probMiss = 1.0; // start with a high miss probability private uint accumSamples, accumMisses; void updateStats() { assert(accumSamples >= accumMisses); /* Given that for the past windowLength samples we saw misses with estimated probability probMiss, and assuming the new sample wasMiss or not, what's the new estimated probMiss? */ probMiss = (probMiss * windowLength + accumMisses) / (windowLength + accumSamples); assert(probMiss <= 1.0); accumSamples = 0; accumMisses = 0; // If probability to miss is under x%, yank one off the freelist static if (!unchecked) { if (probMiss < tooFewMisses && _root) { auto b = blockFor(_root); _root = _root.next; parent.deallocate(b); } } } } // } statistics private struct Node { Node* next; } static assert(ParentAllocator.alignment >= Node.alignof); // state { /** The parent allocator. Depending on whether $(D ParentAllocator) holds state or not, this is a member variable or an alias for `ParentAllocator.instance`. */ static if (stateSize!ParentAllocator) ParentAllocator parent; else alias parent = ParentAllocator.instance; private Node* root; static if (minSize == chooseAtRuntime) private size_t _min = chooseAtRuntime; static if (maxSize == chooseAtRuntime) private size_t _max = chooseAtRuntime; // } /** Alignment offered. */ alias alignment = ParentAllocator.alignment; /** If $(D maxSize == unbounded), returns $(D parent.goodAllocSize(bytes)). Otherwise, returns $(D max) for sizes in the interval $(D [min, max]), and $(D parent.goodAllocSize(bytes)) otherwise. Precondition: If set at runtime, $(D min) and/or $(D max) must be initialized appropriately. Postcondition: $(D result >= bytes) */ size_t goodAllocSize(size_t bytes) { assert(minSize != chooseAtRuntime && maxSize != chooseAtRuntime); static if (maxSize != unbounded) { if (freeListEligible(bytes)) { assert(parent.goodAllocSize(max) == max, text("Wrongly configured freelist: maximum should be ", parent.goodAllocSize(max), " instead of ", max)); return max; } } return parent.goodAllocSize(bytes); } private void[] allocateEligible(size_t bytes) { assert(bytes); if (root) { // faster auto result = (cast(ubyte*) root)[0 .. bytes]; root = root.next; return result; } // slower static if (hasTolerance) { immutable toAllocate = max; } else { alias toAllocate = bytes; } assert(toAllocate == max || max == unbounded); auto result = parent.allocate(bytes); static if (hasTolerance) { if (result) result = result.ptr[0 .. bytes]; } static if (adaptive == Yes.adaptive) { ++accumMisses; updateStats; } return result; } /** Allocates memory either off of the free list or from the parent allocator. If $(D n) is within $(D [min, max]) or if the free list is unchecked ($(D minSize == 0 && maxSize == size_t.max)), then the free list is consulted first. If not empty (hit), the block at the front of the free list is removed from the list and returned. Otherwise (miss), a new block of $(D max) bytes is allocated, truncated to $(D n) bytes, and returned. Params: n = number of bytes to allocate Returns: The allocated block, or $(D null). Precondition: If set at runtime, $(D min) and/or $(D max) must be initialized appropriately. Postcondition: $(D result.length == bytes || result is null) */ void[] allocate(size_t n) { static if (adaptive == Yes.adaptive) ++accumSamples; assert(n < size_t.max / 2); // fast path if (freeListEligible(n)) { return allocateEligible(n); } // slower static if (adaptive == Yes.adaptive) { updateStats; } return parent.allocate(n); } // Forwarding methods mixin(forwardToMember("parent", "expand", "owns", "reallocate")); /** If $(D block.length) is within $(D [min, max]) or if the free list is unchecked ($(D minSize == 0 && maxSize == size_t.max)), then inserts the block at the front of the free list. For all others, forwards to $(D parent.deallocate) if $(D Parent.deallocate) is defined. Params: block = Block to deallocate. Precondition: If set at runtime, $(D min) and/or $(D max) must be initialized appropriately. The block must have been allocated with this freelist, and no dynamic changing of $(D min) or $(D max) is allowed to occur between allocation and deallocation. */ bool deallocate(void[] block) { if (freeListEligible(block.length)) { if (min == 0) { // In this case a null pointer might have made it this far. if (block is null) return true; } auto t = root; root = cast(Node*) block.ptr; root.next = t; return true; } static if (hasMember!(ParentAllocator, "deallocate")) return parent.deallocate(block); else return false; } /** Defined only if $(D ParentAllocator) defines $(D deallocateAll). If so, forwards to it and resets the freelist. */ static if (hasMember!(ParentAllocator, "deallocateAll")) bool deallocateAll() { root = null; return parent.deallocateAll(); } /** Nonstandard function that minimizes the memory usage of the freelist by freeing each element in turn. Defined only if $(D ParentAllocator) defines $(D deallocate). */ static if (hasMember!(ParentAllocator, "deallocate") && !unchecked) void minimize() { while (root) { auto nuke = blockFor(root); root = root.next; parent.deallocate(nuke); } } } unittest { import std.experimental.allocator.gc_allocator : GCAllocator; FreeList!(GCAllocator, 0, 8) fl; assert(fl.root is null); auto b1 = fl.allocate(7); //assert(fl._root !is null); fl.allocate(8); assert(fl.root is null); fl.deallocate(b1); assert(fl.root !is null); fl.allocate(8); assert(fl.root is null); } /** Free list built on top of exactly one contiguous block of memory. The block is assumed to have been allocated with $(D ParentAllocator), and is released in $(D ContiguousFreeList)'s destructor (unless $(D ParentAllocator) is $(D NullAllocator)). $(D ContiguousFreeList) has most advantages of $(D FreeList) but fewer disadvantages. It has better cache locality because items are closer to one another. It imposes less fragmentation on its parent allocator. The disadvantages of $(D ContiguousFreeList) over $(D FreeList) are its pay upfront model (as opposed to $(D FreeList)'s pay-as-you-go approach), and a hard limit on the number of nodes in the list. Thus, a large number of long- lived objects may occupy the entire block, making it unavailable for serving allocations from the free list. However, an absolute cap on the free list size may be beneficial. The options $(D minSize == unbounded) and $(D maxSize == unbounded) are not available for $(D ContiguousFreeList). */ struct ContiguousFreeList(ParentAllocator, size_t minSize, size_t maxSize = minSize) { import std.experimental.allocator.building_blocks.null_allocator : NullAllocator; import std.experimental.allocator.building_blocks.stats_collector : StatsCollector, Options; import std.traits : hasMember; alias Impl = FreeList!(NullAllocator, minSize, maxSize); enum unchecked = minSize == 0 && maxSize == unbounded; alias Node = Impl.Node; alias SParent = StatsCollector!(ParentAllocator, Options.bytesUsed); // state { /** The parent allocator. Depending on whether $(D ParentAllocator) holds state or not, this is a member variable or an alias for `ParentAllocator.instance`. */ SParent parent; FreeList!(NullAllocator, minSize, maxSize) fl; void[] support; size_t allocated; // } /// Alignment offered. enum uint alignment = (void*).alignof; private void initialize(void[] buffer, size_t itemSize = fl.max) { assert(itemSize != unbounded && itemSize != chooseAtRuntime); assert(buffer.ptr.alignedAt(alignment)); immutable available = buffer.length / itemSize; if (available == 0) return; support = buffer; fl.root = cast(Node*) buffer.ptr; auto past = cast(Node*) (buffer.ptr + available * itemSize); for (auto n = fl.root; ; ) { auto next = cast(Node*) (cast(ubyte*) n + itemSize); if (next == past) { n.next = null; break; } assert(next < past); assert(n < next); n.next = next; n = next; } } /** Constructors setting up the memory structured as a free list. Params: buffer = Buffer to structure as a free list. If $(D ParentAllocator) is not $(D NullAllocator), the buffer is assumed to be allocated by $(D parent) and will be freed in the destructor. parent = Parent allocator. For construction from stateless allocators, use their `instance` static member. bytes = Bytes (not items) to be allocated for the free list. Memory will be allocated during construction and deallocated in the destructor. max = Maximum size eligible for freelisting. Construction with this parameter is defined only if $(D maxSize == chooseAtRuntime) or $(D maxSize == unbounded). min = Minimum size eligible for freelisting. Construction with this parameter is defined only if $(D minSize == chooseAtRuntime). If this condition is met and no $(D min) parameter is present, $(D min) is initialized with $(D max). */ static if (!stateSize!ParentAllocator) this(void[] buffer) { initialize(buffer); } /// ditto static if (stateSize!ParentAllocator) this(ParentAllocator parent, void[] buffer) { initialize(buffer); this.parent = SParent(parent); } /// ditto static if (!stateSize!ParentAllocator) this(size_t bytes) { initialize(ParentAllocator.instance.allocate(bytes)); } /// ditto static if (stateSize!ParentAllocator) this(ParentAllocator parent, size_t bytes) { initialize(parent.allocate(bytes)); this.parent = SParent(parent); } /// ditto static if (!stateSize!ParentAllocator && (maxSize == chooseAtRuntime || maxSize == unbounded)) this(size_t bytes, size_t max) { static if (maxSize == chooseAtRuntime) fl.max = max; static if (minSize == chooseAtRuntime) fl.min = max; initialize(parent.allocate(bytes), max); } /// ditto static if (stateSize!ParentAllocator && (maxSize == chooseAtRuntime || maxSize == unbounded)) this(ParentAllocator parent, size_t bytes, size_t max) { static if (maxSize == chooseAtRuntime) fl.max = max; static if (minSize == chooseAtRuntime) fl.min = max; initialize(parent.allocate(bytes), max); this.parent = SParent(parent); } /// ditto static if (!stateSize!ParentAllocator && (maxSize == chooseAtRuntime || maxSize == unbounded) && minSize == chooseAtRuntime) this(size_t bytes, size_t min, size_t max) { static if (maxSize == chooseAtRuntime) fl.max = max; fl.min = min; initialize(parent.allocate(bytes), max); static if (stateSize!ParentAllocator) this.parent = SParent(parent); } /// ditto static if (stateSize!ParentAllocator && (maxSize == chooseAtRuntime || maxSize == unbounded) && minSize == chooseAtRuntime) this(ParentAllocator parent, size_t bytes, size_t min, size_t max) { static if (maxSize == chooseAtRuntime) fl.max = max; fl.min = min; initialize(parent.allocate(bytes), max); static if (stateSize!ParentAllocator) this.parent = SParent(parent); } /** If $(D n) is eligible for freelisting, returns $(D max). Otherwise, returns $(D parent.goodAllocSize(n)). Precondition: If set at runtime, $(D min) and/or $(D max) must be initialized appropriately. Postcondition: $(D result >= bytes) */ size_t goodAllocSize(size_t n) { if (fl.freeListEligible(n)) return fl.max; return parent.goodAllocSize(n); } /** Allocate $(D n) bytes of memory. If $(D n) is eligible for freelist and the freelist is not empty, pops the memory off the free list. In all other cases, uses the parent allocator. */ void[] allocate(size_t n) { auto result = fl.allocate(n); if (result) { // Only case we care about: eligible sizes allocated from us ++allocated; return result; } // All others, allocate from parent return parent.allocate(n); } /** Defined if `ParentAllocator` defines it. Checks whether the block belongs to this allocator. */ static if (hasMember!(SParent, "owns") || unchecked) Ternary owns(void[] b) { if (support.ptr <= b.ptr && b.ptr < support.ptr + support.length) return Ternary.yes; static if (unchecked) return Ternary.no; else return parent.owns(b); } /** Deallocates $(D b). If it's of eligible size, it's put on the free list. Otherwise, it's returned to $(D parent). Precondition: $(D b) has been allocated with this allocator, or is $(D null). */ bool deallocate(void[] b) { if (support.ptr <= b.ptr && b.ptr < support.ptr + support.length) { // we own this guy import std.conv : text; assert(fl.freeListEligible(b.length), text(b.length)); assert(allocated); --allocated; // Put manually in the freelist auto t = fl.root; fl.root = cast(Node*) b.ptr; fl.root.next = t; return true; } return parent.deallocate(b); } /** Deallocates everything from the parent. */ static if (hasMember!(ParentAllocator, "deallocateAll") && stateSize!ParentAllocator) bool deallocateAll() { bool result = fl.deallocateAll && parent.deallocateAll; allocated = 0; return result; } /** Returns `Ternary.yes` if no memory is currently allocated with this allocator, `Ternary.no` otherwise. This method never returns `Ternary.unknown`. */ Ternary empty() { return Ternary(allocated == 0 && parent.bytesUsed == 0); } } /// unittest { import std.experimental.allocator.gc_allocator : GCAllocator; import std.experimental.allocator.building_blocks.allocator_list : AllocatorList; alias ScalableFreeList = AllocatorList!((n) => ContiguousFreeList!(GCAllocator, 0, unbounded)(4096) ); } unittest { import std.experimental.allocator.building_blocks.null_allocator : NullAllocator; alias A = ContiguousFreeList!(NullAllocator, 0, 64); auto a = A(new void[1024]); assert(a.empty == Ternary.yes); assert(a.goodAllocSize(15) == 64); assert(a.goodAllocSize(65) == NullAllocator.instance.goodAllocSize(65)); auto b = a.allocate(100); assert(a.empty == Ternary.yes); assert(b.length == 0); a.deallocate(b); b = a.allocate(64); assert(a.empty == Ternary.no); assert(b.length == 64); assert(a.owns(b) == Ternary.yes); assert(a.owns(null) == Ternary.no); a.deallocate(b); } unittest { import std.experimental.allocator.building_blocks.region : Region; import std.experimental.allocator.gc_allocator : GCAllocator; alias A = ContiguousFreeList!(Region!GCAllocator, 0, 64); auto a = A(Region!GCAllocator(1024 * 4), 1024); assert(a.empty == Ternary.yes); assert(a.goodAllocSize(15) == 64); assert(a.goodAllocSize(65) == a.parent.goodAllocSize(65)); auto b = a.allocate(100); assert(a.empty == Ternary.no); assert(a.allocated == 0); assert(b.length == 100); a.deallocate(b); assert(a.empty == Ternary.yes); b = a.allocate(64); assert(a.empty == Ternary.no); assert(b.length == 64); assert(a.owns(b) == Ternary.yes); assert(a.owns(null) == Ternary.no); a.deallocate(b); } unittest { import std.experimental.allocator.gc_allocator : GCAllocator; alias A = ContiguousFreeList!(GCAllocator, 64, 64); auto a = A(1024); const b = a.allocate(100); assert(b.length == 100); } /** FreeList shared across threads. Allocation and deallocation are lock-free. The parameters have the same semantics as for $(D FreeList). $(D expand) is defined to forward to $(ParentAllocator.expand) (it must be also $(D shared)). */ struct SharedFreeList(ParentAllocator, size_t minSize, size_t maxSize = minSize, size_t approxMaxNodes = unbounded) { import std.conv : text; import std.exception : enforce; import std.traits : hasMember; static assert(approxMaxNodes, "approxMaxNodes must not be null."); static assert(minSize != unbounded, "Use minSize = 0 for no low bound."); static assert(maxSize >= (void*).sizeof, "Maximum size must accommodate a pointer."); private import core.atomic; static if (minSize != chooseAtRuntime) { alias min = minSize; } else { private shared size_t _min = chooseAtRuntime; @property size_t min() const shared { assert(_min != chooseAtRuntime); return _min; } @property void min(size_t x) shared { enforce(x <= max); enforce(cas(&_min, chooseAtRuntime, x), "SharedFreeList.min must be initialized exactly once."); } static if (maxSize == chooseAtRuntime) { // Both bounds can be set, provide one function for setting both in // one shot. void setBounds(size_t low, size_t high) shared { enforce(low <= high && high >= (void*).sizeof); enforce(cas(&_min, chooseAtRuntime, low), "SharedFreeList.min must be initialized exactly once."); enforce(cas(&_max, chooseAtRuntime, high), "SharedFreeList.max must be initialized exactly once."); } } } private bool tooSmall(size_t n) const shared { static if (minSize == 0) return false; else static if (minSize == chooseAtRuntime) return n < _min; else return n < minSize; } static if (maxSize != chooseAtRuntime) { alias max = maxSize; } else { private shared size_t _max = chooseAtRuntime; @property size_t max() const shared { return _max; } @property void max(size_t x) shared { enforce(x >= _min && x >= (void*).sizeof); enforce(cas(&_max, chooseAtRuntime, x), "SharedFreeList.max must be initialized exactly once."); } } private bool tooLarge(size_t n) const shared { static if (maxSize == unbounded) return false; else static if (maxSize == chooseAtRuntime) return n > _max; else return n > maxSize; } private bool freeListEligible(size_t n) const shared { static if (minSize == maxSize && minSize != chooseAtRuntime) return n == maxSize; else return !tooSmall(n) && !tooLarge(n); } static if (approxMaxNodes != chooseAtRuntime) { alias approxMaxLength = approxMaxNodes; } else { private shared size_t _approxMaxLength = chooseAtRuntime; @property size_t approxMaxLength() const shared { return _approxMaxLength; } @property void approxMaxLength(size_t x) shared { _approxMaxLength = enforce(x); } } static if (approxMaxNodes != unbounded) { private shared size_t nodes; private void incNodes() shared { atomicOp!("+=")(nodes, 1); } private void decNodes() shared { assert(nodes); atomicOp!("-=")(nodes, 1); } private bool nodesFull() shared { return nodes >= approxMaxLength; } } else { private static void incNodes() { } private static void decNodes() { } private enum bool nodesFull = false; } version (StdDdoc) { /** Properties for getting (and possibly setting) the bounds. Setting bounds is allowed only once , and before any allocation takes place. Otherwise, the primitives have the same semantics as those of $(D FreeList). */ @property size_t min(); /// Ditto @property void min(size_t newMinSize); /// Ditto @property size_t max(); /// Ditto @property void max(size_t newMaxSize); /// Ditto void setBounds(size_t newMin, size_t newMax); /// unittest { SharedFreeList!(Mallocator, chooseAtRuntime, chooseAtRuntime) a; // Set the maxSize first so setting the minSize doesn't throw a.max = 128; a.min = 64; a.setBounds(64, 128); // equivalent assert(a.max == 128); assert(a.min == 64); } /** Properties for getting (and possibly setting) the approximate maximum length of a shared freelist. */ @property size_t approxMaxLength() const shared; /// ditto @property void approxMaxLength(size_t x) shared; /// unittest { SharedFreeList!(Mallocator, 50, 50, chooseAtRuntime) a; // Set the maxSize first so setting the minSize doesn't throw a.approxMaxLength = 128; assert(a.approxMaxLength == 128); a.approxMaxLength = 1024; assert(a.approxMaxLength == 1024); a.approxMaxLength = 1; assert(a.approxMaxLength == 1); } } /** The parent allocator. Depending on whether $(D ParentAllocator) holds state or not, this is a member variable or an alias for `ParentAllocator.instance`. */ static if (stateSize!ParentAllocator) shared ParentAllocator parent; else alias parent = ParentAllocator.instance; mixin(forwardToMember("parent", "expand")); private struct Node { Node* next; } static assert(ParentAllocator.alignment >= Node.alignof); private Node* _root; /// Standard primitives. enum uint alignment = ParentAllocator.alignment; /// Ditto size_t goodAllocSize(size_t bytes) shared { if (freeListEligible(bytes)) return maxSize == unbounded ? bytes : max; return parent.goodAllocSize(bytes); } /// Ditto static if (hasMember!(ParentAllocator, "owns")) Ternary owns(void[] b) shared const { return parent.owns(b); } /// Ditto static if (hasMember!(ParentAllocator, "reallocate")) bool reallocate(void[] b, size_t s) { return parent.reallocate(b, s); } /// Ditto void[] allocate(size_t bytes) shared { assert(bytes < size_t.max / 2); if (!freeListEligible(bytes)) return parent.allocate(bytes); if (maxSize != unbounded) bytes = max; // Pop off the freelist shared Node* oldRoot = void, next = void; do { oldRoot = _root; // atomic load if (!oldRoot) return allocateFresh(bytes); next = oldRoot.next; // atomic load } while (!cas(&_root, oldRoot, next)); // great, snatched the root decNodes(); return (cast(ubyte*) oldRoot)[0 .. bytes]; } private void[] allocateFresh(const size_t bytes) shared { assert(bytes == max || max == unbounded); return parent.allocate(bytes); } /// Ditto bool deallocate(void[] b) shared { if (!nodesFull && freeListEligible(b.length)) { auto newRoot = cast(shared Node*) b.ptr; shared Node* oldRoot; do { oldRoot = _root; newRoot.next = oldRoot; } while (!cas(&_root, oldRoot, newRoot)); incNodes(); return true; } static if (hasMember!(ParentAllocator, "deallocate")) return parent.deallocate(b); else return false; } /// Ditto bool deallocateAll() shared { bool result = false; static if (hasMember!(ParentAllocator, "deallocateAll")) { result = parent.deallocateAll(); } else static if (hasMember!(ParentAllocator, "deallocate")) { result = true; for (auto n = _root; n; n = n.next) { if (!parent.deallocate((cast(ubyte*)n)[0 .. max])) result = false; } } _root = null; return result; } } unittest { import std.algorithm.comparison : equal; import std.concurrency : receiveOnly, send, spawn, thisTid, Tid; import std.range : repeat; import std.experimental.allocator.mallocator : Mallocator; static shared SharedFreeList!(Mallocator, 64, 128, 10) a; assert(a.goodAllocSize(1) == platformAlignment); auto b = a.allocate(100); a.deallocate(b); static void fun(Tid tid, int i) { scope(exit) tid.send(true); auto b = cast(ubyte[]) a.allocate(100); b[] = cast(ubyte) i; assert(b.equal(repeat(cast(ubyte) i, b.length))); a.deallocate(b); } Tid[] tids; foreach (i; 0 .. 20) { tids ~= spawn(&fun, thisTid, i); } foreach (i; 0 .. 20) { assert(receiveOnly!bool); } } unittest { import std.experimental.allocator.mallocator : Mallocator; shared SharedFreeList!(Mallocator, chooseAtRuntime, chooseAtRuntime) a; a.allocate(64); } unittest { import std.experimental.allocator.mallocator : Mallocator; shared SharedFreeList!(Mallocator, chooseAtRuntime, chooseAtRuntime, chooseAtRuntime) a; a.allocate(64); } unittest { import std.experimental.allocator.mallocator : Mallocator; shared SharedFreeList!(Mallocator, 30, 40) a; a.allocate(64); } unittest { import std.experimental.allocator.mallocator : Mallocator; shared SharedFreeList!(Mallocator, 30, 40, chooseAtRuntime) a; a.allocate(64); }
D
/+ This module is part of d2sqlite3. Authors: Nicolas Sicard (biozic) and other contributors at $(LINK https://github.com/biozic/d2sqlite3) Copyright: Copyright 2011-18 Nicolas Sicard. License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0). +/ module d2sqlite3.internal.memory; import std.traits : isFunctionPointer, isDelegate, isCallable; import core.memory : GC; import core.stdc.stdlib : malloc, free; package(d2sqlite3): struct WrappedDelegate(T) { T dlg; string name; } void* delegateWrap(T)(T dlg, string name = null) nothrow if (isFunctionPointer!T || isDelegate!T) { import std.functional : toDelegate; if (dlg is null) return null; alias D = typeof(toDelegate(dlg)); auto d = cast(WrappedDelegate!D*) malloc(WrappedDelegate!D.sizeof); d.dlg = toDelegate(dlg); d.name = name; return cast(void*) d; } WrappedDelegate!T* delegateUnwrap(T)(void* ptr) nothrow if (isCallable!T) { return cast(WrappedDelegate!T*) ptr; } extern(C) void ptrFree(void* ptr) nothrow { free(ptr); } // Anchors and returns a pointer to D memory, so that it will not // be moved or collected. For use with releaseMem. void* anchorMem(void* ptr) { GC.addRoot(ptr); GC.setAttr(ptr, GC.BlkAttr.NO_MOVE); return ptr; } // Passed to sqlite3_xxx_blob64/sqlite3_xxx_text64 to unanchor memory. extern(C) void releaseMem(void* ptr) { GC.setAttr(ptr, GC.BlkAttr.NO_MOVE); GC.removeRoot(ptr); } // Adapted from https://p0nce.github.io/d-idioms/#GC-proof-resource-class void ensureNotInGC(T)(string info = null) nothrow { import core.exception : InvalidMemoryOperationError; try { import core.memory : GC; cast(void) GC.malloc(1); return; } catch(InvalidMemoryOperationError e) { import core.stdc.stdio : fprintf, stderr; import core.stdc.stdlib : exit; fprintf(stderr, "Error: clean-up of %s incorrectly depends on destructors called by the GC.\n", T.stringof.ptr); if (info) fprintf(stderr, "Info: %s\n", info.ptr); assert(false); } }
D
/** MongoCollection class Copyright: © 2012 Sönke Ludwig License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. Authors: Sönke Ludwig */ module vibe.db.mongo.collection; public import vibe.db.mongo.cursor; public import vibe.db.mongo.connection; import vibe.db.mongo.db; import std.algorithm : countUntil; /** Represents a single collection inside a MongoDB. */ struct MongoCollection { private { MongoDB m_db; string m_collection; } this(MongoDB db, string collection_name) { m_db = db; m_collection = collection_name; } /** Performs an update operation on documents matching 'selector', updating them with 'update'. Throws: Exception if a DB communication error occured. See_Also: $(LINK http://www.mongodb.org/display/DOCS/Updating) */ void update(T, U)(T selector, U update, UpdateFlags flags = UpdateFlags.None) { auto conn = m_db.lockConnection(); conn.update(m_collection, flags, serializeToBson(selector), serializeToBson(update)); } /** Inserts new documents into the collection. Throws: Exception if a DB communication error occured. See_Also: $(LINK http://www.mongodb.org/display/DOCS/Inserting) */ void insert(T)(T document_or_documents, InsertFlags flags = InsertFlags.None) { auto conn = m_db.lockConnection(); Bson[] docs; Bson bdocs = serializeToBson(document_or_documents); if( bdocs.type == Bson.Type.Array ) docs = cast(Bson[])bdocs; else docs ~= bdocs; conn.insert(m_collection, flags, docs); } /** Queries the collection for existing documents. Throws: Exception if a DB communication error or a query error occured. See_Also: $(LINK http://www.mongodb.org/display/DOCS/Querying) */ MongoCursor find(T, U = typeof(null))(T query, U returnFieldSelector = null, QueryFlags flags = QueryFlags.None, int num_skip = 0, int num_docs_per_chunk = 0) { auto conn = m_db.lockConnection(); auto reply = conn.query(m_collection, flags, num_skip, num_docs_per_chunk, serializeToBson(query), returnFieldSelector is null ? serializeToBson(returnFieldSelector) : Bson(null)); return MongoCursor(m_db, m_collection, num_docs_per_chunk, reply); } /** Queries the collection for existing documents. Returns: the first match or null Throws: Exception if a DB communication error or a query error occured. See_Also: $(LINK http://www.mongodb.org/display/DOCS/Querying) */ Bson findOne(T, U = typeof(null))(T query, U returnFieldSelector = null, QueryFlags flags = QueryFlags.None) { auto c = find(query, returnFieldSelector, flags, 0, 1); foreach( doc; c ) return doc; return Bson(null); } /** Removes documents from the collection. Throws: Exception if a DB communication error occured. See_Also: $(LINK http://www.mongodb.org/display/DOCS/Removing) */ void remove(T)(T selector, DeleteFlags flags = DeleteFlags.None) { auto conn = m_db.lockConnection(); conn.delete_(m_collection, flags, serializeToBson(selector)); } /** Combines a modify and find operation to a single atomic operation. Throws Exception if a DB communication error occured. See_Also: $(LINK http://www.mongodb.org/display/DOCS/findAndModify+Command) */ Bson findAndModify(T, U, V)(T query, U update, V returnFieldSelector = null) { auto cidx = m_collection.countUntil('.'); string dbstr = m_collection[0 .. cidx]; string collstr = m_collection[cidx+1 .. $]; Bson[string] cmd; cmd["findAndModify"] = Bson(collstr); cmd["query"] = serializeToBson(query); cmd["update"] = serializeToBson(update); if( returnFieldSelector != null ) cmd["fields"] = serializeToBson(returnFieldSelector); return m_db.runCommand(dbstr, cmd); } }
D
/* * This file was automatically generated by sel-utils and * released under the MIT License. * * License: https://github.com/sel-project/sel-utils/blob/master/LICENSE * Repository: https://github.com/sel-project/sel-utils * Generated from https://github.com/sel-project/sel-utils/blob/master/xml/attributes/java340.xml */ module sul.attributes.java340; import std.typecons : Tuple; alias Attribute = Tuple!(string, "name", float, "min", float, "max", float, "def"); public struct Attributes { @disable this(); enum maxHealth = Attribute("generic.maxHealth", 0f, 1024f, 20f); enum absorption = Attribute("generic.absorption", 0f, 4f, 0f); enum movementSpeed = Attribute("generic.movementSpeed", 0f, 24791f, 0.1f); enum knockbackResistance = Attribute("generic.knockbackResistance", 0f, 1f, 0f); enum attackDamage = Attribute("generic.attackDamage", 0f, 2048f, 2f); enum attackSpeed = Attribute("generic.attackSpeed", 0f, 1024f, 4f); }
D
/** * Contains TelegramPassportElementErrorUnspecified */ module tg.passport.types.telegram_passport_element_error_unspecified; import tg.core.type, tg.core.exception; import std.json, tg.type; /** * Represents an issue in an unspecified place. The error is considered resolved when new data is added. */ class TelegramPassportElementErrorUnspecified : TelegramType { /** * Creates new type object */ nothrow pure public this () @safe { _source = ""; _type = ""; _element_hash = ""; _message = ""; } /** Add constructor with data init from response */ mixin(TelegramTypeConstructor); override public void setFromJson (JSONValue data) { if ( "source" !in data ) throw new TelegramException("Could not find reqired entry : source"); _source = data["source"].str(); if ( "type" !in data ) throw new TelegramException("Could not find reqired entry : type"); _type = data["type"].str(); if ( "element_hash" !in data ) throw new TelegramException("Could not find reqired entry : element_hash"); _element_hash = data["element_hash"].str(); if ( "message" !in data ) throw new TelegramException("Could not find reqired entry : message"); _message = data["message"].str(); } override public JSONValue getAsJson () { JSONValue data = parseJSON(""); data["source"] = _source; data["type"] = _type; data["element_hash"] = _element_hash; data["message"] = _message; return data; } /** Error source, must be <em>unspecified</em> */ private string _source; /** * Getter for '_source' * Returns: Current value of '_source' */ @property string source () { return _source; } /** * Setter for '_source' * Params: sourceNew = New value of '_source' * Returns: New value of '_source' */ @property string source ( string sourceNew ) { return _source = sourceNew; } /** Type of element of the user's Telegram Passport which has the issue */ private string _type; /** * Getter for '_type' * Returns: Current value of '_type' */ @property string type () { return _type; } /** * Setter for '_type' * Params: typeNew = New value of '_type' * Returns: New value of '_type' */ @property string type ( string typeNew ) { return _type = typeNew; } /** Base64-encoded element hash */ private string _element_hash; /** * Getter for '_element_hash' * Returns: Current value of '_element_hash' */ @property string elementHash () { return _element_hash; } /** * Setter for '_element_hash' * Params: elementHashNew = New value of '_element_hash' * Returns: New value of '_element_hash' */ @property string elementHash ( string elementHashNew ) { return _element_hash = elementHashNew; } /** Error message */ private string _message; /** * Getter for '_message' * Returns: Current value of '_message' */ @property string message () { return _message; } /** * Setter for '_message' * Params: messageNew = New value of '_message' * Returns: New value of '_message' */ @property string message ( string messageNew ) { return _message = messageNew; } }
D
#!/usr/bin/env dub /+ dub.sdl: name "snippet144" dependency "dwt" path="../../../../../../" libs \ "atk-1.0" \ "cairo" \ "dl" \ "fontconfig" \ "gdk-x11-2.0" \ "gdk_pixbuf-2.0" \ "glib-2.0" \ "gmodule-2.0" \ "gnomeui-2" \ "gnomevfs-2" \ "gobject-2.0" \ "gthread-2.0" \ "gtk-x11-2.0" \ "pango-1.0" \ "pangocairo-1.0" \ "X11" \ "Xcomposite" \ "Xcursor" \ "Xdamage" \ "Xext" \ "Xfixes" \ "Xi" \ "Xinerama" \ "Xrandr" \ "Xrender" \ "Xtst" \ platform="linux" +/ /******************************************************************************* * Copyright (c) 2000, 2004 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 * D Port: * Jesse Phillips <Jesse.K.Phillips+D> gmail.com *******************************************************************************/ module org.eclipse.swt.snippets.Snippet144; /* * Virtual Table example snippet: create a table with 1,000,000 items (lazy) * * For a list of all SWT example snippets see * http://www.eclipse.org/swt/snippets/ * * @since 3.0 */ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.layout.RowData; import java.lang.all; version(Tango){ import tango.io.Stdout; void writeln(in char[] line) { Stdout(line)("\n").flush(); } import tango.time.StopWatch; import tango.util.Convert; } else { import std.stdio; import std.datetime.stopwatch; import std.conv; } const int COUNT = 1000000; void main() { auto display = new Display (); auto shell = new Shell (display); shell.setLayout (new RowLayout (SWT.VERTICAL)); auto table = new Table (shell, SWT.VIRTUAL | SWT.BORDER); table.addListener (SWT.SetData, new class Listener { public void handleEvent (Event event) { auto item = cast(TableItem) event.item; auto index = table.indexOf (item); item.setText ("Item " ~ to!(String)(index)); writeln(item.getText ()); } }); table.setLayoutData (new RowData (200, 200)); auto button = new Button (shell, SWT.PUSH); button.setText ("Add Items"); auto label = new Label(shell, SWT.NONE); button.addListener (SWT.Selection, new class Listener { public void handleEvent (Event event) { StopWatch elapsed; //Tango or Phobos StopWatch elapsed.start(); table.setItemCount (COUNT); version(Tango){ auto t = elapsed.stop() * 1_000; } else { // Phobos elapsed.stop(); auto t = elapsed.peek().total!"msecs"(); } label.setText ("Items: " ~ to!(String)(COUNT) ~ ", Time: " ~ to!(String)(t) ~ " (msec)"); shell.layout (); } }); shell.pack (); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); }
D
instance DIA_Addon_BDT_10031_Wache_EXIT(C_Info) { npc = BDT_10031_Addon_Wache; nr = 999; condition = DIA_Addon_10031_Wache_EXIT_Condition; information = DIA_Addon_10031_Wache_EXIT_Info; permanent = TRUE; description = Dialog_Ende; }; func int DIA_Addon_10031_Wache_EXIT_Condition() { return TRUE; }; func void DIA_Addon_10031_Wache_EXIT_Info() { AI_StopProcessInfos(self); }; instance DIA_Addon_BDT_10031_Wache_Scatty(C_Info) { npc = BDT_10031_Addon_Wache; nr = 2; condition = DIA_Addon_10031_Wache_Scatty_Condition; information = DIA_Addon_10031_Wache_Scatty_Info; permanent = FALSE; important = TRUE; }; func int DIA_Addon_10031_Wache_Scatty_Condition() { return TRUE; }; func void DIA_Addon_10031_Wache_Scatty_Info() { AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Scatty_06_00"); //Эй, хочешь пойти поработать? Тогда не забудь закупиться у Скатти. AI_Output(other,self,"DIA_Addon_BDT_10031_Wache_Scatty_15_01"); //А что мне нужно? AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Scatty_06_02"); //Ну хотя бы кирку. Немного провианта тоже не помешает. AI_StopProcessInfos(self); }; var int Wache_Joker; instance DIA_Addon_BDT_10031_Wache_Hi(C_Info) { npc = BDT_10031_Addon_Wache; nr = 2; condition = DIA_Addon_10031_Wache_Hi_Condition; information = DIA_Addon_10031_Wache_Hi_Info; permanent = TRUE; description = "Все в порядке?"; }; func int DIA_Addon_10031_Wache_Hi_Condition() { return TRUE; }; func void DIA_Addon_10031_Wache_Hi_Info() { AI_Output(other,self,"DIA_Addon_BDT_10031_Wache_Hi_15_00"); //Все в порядке? if((Sklaven_Flucht == TRUE) && (Wache_Joker == FALSE)) { AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Hi_06_01"); //О, приятель. Рабы, видно, очень спешили. AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Hi_06_02"); //Когда они услышали, что они свободны, они побежали, как кролики! Wache_Joker = TRUE; }; AI_Output(self,other,"DIA_Addon_BDT_10031_Wache_Hi_06_03"); //Да. Так что не создавай никому проблем, и все у тебя будет в порядке. };
D
instance GRD_280_GARDIST(NPC_DEFAULT) { name[0] = NAME_GARDIST; npctype = NPCTYPE_GUARD; flags = NPC_FLAG_IMMORTAL; guild = GIL_GRD; level = 20; voice = 6; id = 280; attribute[ATR_STRENGTH] = 70; attribute[ATR_DEXTERITY] = 50; attribute[ATR_MANA_MAX] = 0; attribute[ATR_MANA] = 0; attribute[ATR_HITPOINTS_MAX] = 220; attribute[ATR_HITPOINTS] = 220; Mdl_SetVisual(self,"HUMANS.MDS"); Mdl_ApplyOverlayMds(self,"Humans_Militia.mds"); Mdl_SetVisualBody(self,"hum_body_Naked0",0,1,"Hum_Head_FatBald",19,0,grd_armor_m); b_scale(self); Mdl_SetModelFatness(self,0); fight_tactic = FAI_HUMAN_STRONG; Npc_SetTalentSkill(self,NPC_TALENT_1H,2); Npc_SetTalentSkill(self,NPC_TALENT_2H,1); EquipItem(self,itmw_1h_sword_02); CreateInvItem(self,itfoapple); CreateInvItems(self,itminugget,10); daily_routine = rtn_start_280; }; func void rtn_start_280() { ta_guardwheelopen(6,25,23,10,"OCC_GATE_VWHEEL"); ta_guardwheelopen(23,10,6,25,"OCC_GATE_VWHEEL"); }; func void rtn_fmtaken_280() { ta_guardwheelclosed(6,25,23,10,"OCC_GATE_VWHEEL"); ta_guardwheelclosed(23,10,6,25,"OCC_GATE_VWHEEL"); }; instance GRD_998_GARDIST(NPC_DEFAULT) { name[0] = NAME_GARDIST; npctype = NPCTYPE_GUARD; flags = NPC_FLAG_IMMORTAL; guild = GIL_GRD; level = 20; voice = 6; id = 998; attribute[ATR_STRENGTH] = 70; attribute[ATR_DEXTERITY] = 50; attribute[ATR_MANA_MAX] = 0; attribute[ATR_MANA] = 0; attribute[ATR_HITPOINTS_MAX] = 220; attribute[ATR_HITPOINTS] = 220; Mdl_SetVisual(self,"HUMANS.MDS"); Mdl_ApplyOverlayMds(self,"Humans_Militia.mds"); Mdl_SetVisualBody(self,"hum_body_Naked0",0,1,"Hum_Head_FatBald",54,0,grd_armor_m); b_scale(self); Mdl_SetModelFatness(self,0); fight_tactic = FAI_HUMAN_STRONG; Npc_SetTalentSkill(self,NPC_TALENT_1H,2); Npc_SetTalentSkill(self,NPC_TALENT_2H,1); EquipItem(self,itmw_1h_sword_02); CreateInvItem(self,itfoapple); daily_routine = rtn_start_998; }; func void rtn_start_998() { ta_guardwheelclosed(22,59,19,09,"OCR_ARENA_VWHEEL"); ta_guardwheelopen(19,09,22,59,"OCR_ARENA_VWHEEL"); }; func void rtn_aclosed_998() { ta_guardwheelopen(6,25,23,10,"OCR_ARENA_VWHEEL"); ta_guardwheelopen(23,10,6,25,"OCR_ARENA_VWHEEL"); }; func void rtn_aopen_998() { ta_guardwheelclosed(6,25,23,10,"OCR_ARENA_VWHEEL"); ta_guardwheelclosed(23,10,6,25,"OCR_ARENA_VWHEEL"); }; func void rtn_wait_998() { ta_stay(6,25,23,10,"OCR_ARENA_VWHEEL"); ta_stay(23,10,6,25,"OCR_ARENA_VWHEEL"); };
D
module Renderer.RendElement; import Math; import irenderer; import Renderer.ishader; import platform; //struct SMsurface; //class CRendElement; //struct CMatInfo; //struct PrimitiveGroup; //struct SShader; //struct SShaderTechnique; //struct Plane; ////////////////////////////////////////////////////////////////////// enum EDataType { eDATA_Unknown = 0, eDATA_Dummy, eDATA_Sky, eDATA_Beam, eDATA_Poly, eDATA_Curve, eDATA_MotModel, eDATA_MeshModel, eDATA_PolyBlend, eDATA_AnimPolyBlend, eDATA_ClientPoly, eDATA_ClientPoly2D, eDATA_ParticleSpray, eDATA_TriMesh, eDATA_TriMeshShadow, eDATA_Prefab, eDATA_Flare, eDATA_FlareGeom, eDATA_FlareProp, eDATA_Tree, eDATA_Tree_Leaves, eDATA_Tree_Branches, eDATA_Terrain, eDATA_SkyZone, eDATA_OcLeaf, eDATA_TerrainSector, eDATA_2DQuad, eDATA_FarTreeSprites, // eDATA_TriMeshAdditionalShadow, eDATA_AnimModel, eDATA_MotionBlur, eDATA_ShadowMapGen, eDATA_TerrainDetailTextureLayers, eDATA_TerrainParticles, eDATA_Ocean, eDATA_Glare, eDATA_OcclusionQuery, eDATA_TempMesh, eDATA_ClearStencil, eDATA_FlashBang, // tiago: added eDATA_ScreenProcess, eDATA_HDRProcess, }; import Renderer.ColorDefs; ////////////////////////////////////////////////////////////////////// struct SInpData { Vec3 Org; Vec3 Normal; CFColor Color; int UniqLightStyle; int OrigLightStyle; }; ////////////////////////////////////////////////////////////////////// struct SMRendVert { this (float x, float y, float z) { vert[0] = x; vert[1] = y; vert[2] = z; } Vec3 vert; union { uint m_uiInfo; ubyte[4] m_bInfo; }; }; ////////////////////////////////////////////////////////////////////// struct SMRendTexVert { this (float u, float t) { vert[0] = u; vert[1] = t; } float[2] vert; }; ////////////////////////////////////////////////////////////////////// struct SColorVert { Vec3 vert; float[2] dTC; UCol color; }; ////////////////////////////////////////////////////////////////////// struct SColorVert2D { float[2] vert; float[2] dTC; UCol color; }; ////////////////////////////////////////////////////////////////////// enum FCEF_TRANSFORM = 1; enum FCEF_TRACE = 2; enum FCEF_NODEL = 4; enum FCEF_MODIF_TC = 0x10; enum FCEF_MODIF_VERT = 0x20; enum FCEF_MODIF_COL = 0x40; enum FCEF_MODIF_MASK = 0xf0; enum FCEF_NEEDFILLBUF = 0x100; enum FCEF_ALLOC_CUST_FLOAT_DATA = 0x200; enum FCEF_MERGABLE = 0x400; enum FGP_NOCALC = 1; enum FGP_SRC = 2; enum FGP_REAL = 4; enum FGP_WAIT = 8; enum FGP_STAGE_SHIFT = 0x10; ////////////////////////////////////////////////////////////////////// struct SVertBufComps { bool m_bHasTC; bool m_bHasColors; bool m_bHasSecColors; bool m_bHasNormals; }; enum MAX_CUSTOM_TEX_BINDS_NUM = 8; ////////////////////////////////////////////////////////////////////// class CRendElement { public: EDataType m_Type; uint m_Flags; public: int m_nCountCustomData; void *m_CustomData; float m_fFogScale; int[MAX_CUSTOM_TEX_BINDS_NUM] m_CustomTexBind; CFColor m_Color; int m_SortId; static CRendElement m_RootGlobal; CRendElement *m_NextGlobal; CRendElement *m_PrevGlobal; extern(C) struct CVProgram; CVProgram *m_LastVP; // Last Vertex program which updates Z buffer protected: void UnlinkGlobal() { if (!m_NextGlobal || !m_PrevGlobal) return; m_NextGlobal.m_PrevGlobal = m_PrevGlobal; m_PrevGlobal.m_NextGlobal = m_NextGlobal; m_NextGlobal = m_PrevGlobal = NULL; } void LinkGlobal( CRendElement* Before ) { if (m_NextGlobal || m_PrevGlobal) return; m_NextGlobal = Before.m_NextGlobal; Before.m_NextGlobal.m_PrevGlobal = this; Before.m_NextGlobal = this; m_PrevGlobal = Before; } public: this() { m_Type = eDATA_Unknown; m_NextGlobal = NULL; m_PrevGlobal = NULL; m_Flags = 0; m_CustomData = NULL; for(int i=0; i<MAX_CUSTOM_TEX_BINDS_NUM; i++) m_CustomTexBind[i] = -1; m_fFogScale=0; m_SortId = 0; m_LastVP = NULL; if (!m_RootGlobal.m_NextGlobal) { m_RootGlobal.m_NextGlobal = &m_RootGlobal; m_RootGlobal.m_PrevGlobal = &m_RootGlobal; } if (this != &m_RootGlobal) LinkGlobal(&m_RootGlobal); } ~this() { if ((m_Flags & FCEF_ALLOC_CUST_FLOAT_DATA) && m_CustomData) { delete [] (cast(float*)m_CustomData); m_CustomData=0; } UnlinkGlobal(); } const char *mfTypeString(); EDataType mfGetType() { return m_Type; } void mfSetType(EDataType t) { m_Type = t; } uint mfGetFlags() { return m_Flags; } void mfSetFlags(uint fl) { m_Flags = fl; } void mfUpdateFlags(uint fl) { m_Flags |= fl; } void mfClearFlags(uint fl) { m_Flags &= ~fl; } abstract void mfPrepare(); abstract bool mfCullByClipPlane(CCObject *pObj); abstract CMatInfo *mfGetMatInfo(); abstract list2!CMatInfo *mfGetMatInfoList(); abstract int mfGetMatId(); abstract bool mfCull(CCObject *obj); abstract bool mfCull(CCObject *obj, SShader *ef); abstract void mfReset(); abstract CRendElement *mfCopyConstruct(); abstract void mfCenter(ref Vec3 centr, CCObject*pObj); abstract void mfGetBBox(ref Vec3 vMins, ref Vec3 vMaxs) { vMins.Set(0,0,0); vMaxs.Set(0,0,0); } abstract void mfGetPlane(ref Plane pl); abstract float mfDistanceToCameraSquared(const ref CCObject thisObject); abstract void mfEndFlush(); abstract void Release(); abstract int mfTransform(ref Matrix44 ViewMatr, ref Matrix44 ProjMatr, vec4_t *verts, vec4_t *vertsp, int Num); abstract bool mfIsValidTime(SShader *ef, CCObject *obj, float curtime); abstract void mfBuildGeometry(SShader *ef); abstract bool mfCompile(SShader *ef, char *scr); abstract CRendElement *mfCreateWorldRE(SShader *ef, SInpData *ds); abstract bool mfDraw(SShader *ef, SShaderPass *sfm); abstract void *mfGetPointer(ESrcPointer ePT, int *Stride, int Type, ESrcPointer Dst, int Flags); abstract bool mfPreDraw(SShaderPass *sl) { return true; } abstract float mfMinDistanceToCamera(CCObject *pObj) {return -1;}; abstract bool mfCheckUpdate(int nVertFormat, int Flags) {int i=Flags; return true;} abstract int Size() {return 0;} }; //FIXME: //import Renderer.CREOcLeaf; //import Renderer.CRESky; //import Renderer.CRE2DQuad; //import Renderer.CREDummy; //import Renderer.CRETerrainSector; //import Renderer.CRETriMeshShadow; //import Renderer.CRETriMeshAdditionalShadow; //import Renderer.CREShadowMap; //import Renderer.CREOcclusionQuery; //import Renderer.CREFlashBang; // tiago: added //import Renderer.CREGlare; //import Renderer.CREScreenProcess;
D
// NOTE: the shootout appears to be BSD licensed content. // Including this in the test suite based on that license. /* The Great Computer Language Shootout http://shootout.alioth.debian.org/ Unoptimised reference implementation contributed by Isaac Gouy */ import core.memory; int main(string[] args) { int n = 1000; HealthcareRegion healthcareSystem = HealthcareRegion.Create(); for(int i = 0; i < n; i++) healthcareSystem.TransferPatients(); Totals t = healthcareSystem.AccumulateTotals(); version (VERBOSE) { import core.stdc.stdio; printf("Patients: %lld\n", t.patients); printf("Time: %lld\n", t.hospitalTime); printf("Visits: %lld\n", t.hospitalVisits); } if (n == 1000) { assert(t.patients == 102515); assert(t.hospitalTime == 33730654); assert(t.hospitalVisits == 106371); } return 0; } class HealthcareRegion { public: static HealthcareRegion Create() { return HealthcareRegion.Create(LEVELS, 0, 42); } static HealthcareRegion Create(int level, int seed1, int seed2) { HealthcareRegion r = null; if(level > 0) { r = new HealthcareRegion(level, seed1*seed2); for(ptrdiff_t i = r.districts.length-1; i >= 0; i--) r.districts[i] = Create(level-1, cast(int)((seed1*4)+i+1), seed2); } return r; } this(int level, int s) { districts = new HealthcareRegion[DISTRICTS]; localHospital = new Hospital(level == LEVELS, level, s); } private: enum int LEVELS = 5, DISTRICTS = 4; HealthcareRegion[] districts; Hospital localHospital; package: Patient[] TransferPatients() { for(ptrdiff_t i = districts.length-1; i >= 0; i--) if(districts[i]) foreach(Patient p; districts[i].TransferPatients().dup) localHospital.NewArrival(p); localHospital.TriageExaminationTreatment(); return localHospital.RegionalTransferPatients(); } Totals AccumulateTotals() { Totals t = new Totals(); for(ptrdiff_t i = districts.length-1; i >= 0; i--) if(districts[i]) t += districts[i].AccumulateTotals(); localHospital.AccumulateTotals(t); return t; } } class Hospital { public this(bool hasNoRegionalHospital, int level, int seed) { this.hasNoRegionalHospital = hasNoRegionalHospital; availableStaff = 1 << (level - 1); discharged = new Totals(); this.seed = seed; } package: void TriageExaminationTreatment() { DischargePatients(); TreatOrTransferPatients(); TriagePatients(); if(genRandom(1.0) > 0.7) { Patient p = new Patient(); NewArrival(p); } } Patient[] RegionalTransferPatients() { return transfers; } void AccumulateTotals(Totals t) { foreach(Patient p; triage) t.Plus(p); foreach(Patient p; examination) t.Plus(p); foreach(Patient p; treatment) t.Plus(p); t += discharged; } void NewArrival(Patient p) { p.hospitalVisits++; if(availableStaff > 0) { availableStaff--; examination ~= p; p.remainingTime = 3; p.hospitalTime += 3; } else { triage ~= p; } } private: Patient[] triage, examination, treatment, transfers; Totals discharged; int availableStaff; bool hasNoRegionalHospital; void DischargePatients() { for(ptrdiff_t i = treatment.length-1; i >= 0; i--) { Patient p = treatment[i]; p.remainingTime -= 1; if(!p.remainingTime) { availableStaff++; treatment = treatment[0..i] ~ treatment[i+1..$]; discharged.Plus(p); } } } void TreatOrTransferPatients() { delete transfers; for(ptrdiff_t i = examination.length-1; i >= 0; i--) { Patient p = examination[i]; p.remainingTime -= 1; if(!p.remainingTime) { // no transfer if(genRandom(1.0) > 0.1 || hasNoRegionalHospital) { examination = examination[0..i] ~ examination[i+1..$]; treatment ~= p; p.remainingTime = 10; p.hospitalTime += 10; } else { // transfer availableStaff++; examination = examination[0..i] ~ examination[i+1..$]; transfers ~= p; } } } } void TriagePatients() { for(ptrdiff_t i = triage.length-1; i >= 0; i--) { Patient p = triage[i]; assert(p.hospitalTime != 0x7fff); if(availableStaff > 0) { availableStaff--; p.remainingTime = 3; p.hospitalTime += 3; triage = triage[0..i] ~ triage[i+1..$]; examination ~= p; } else { p.hospitalTime++; } } } int seed = 42; const int IM = 139968; const int IA = 3877; const int IC = 29573; double genRandom(double max) { return(max * (seed = (seed * IA + IC) % IM) / IM); } } class Patient { package int remainingTime, hospitalTime, hospitalVisits; } class Totals { public Totals opOpAssign(string op)(Totals b) if (op == "+") { patients += b.patients; hospitalTime += b.hospitalTime; hospitalVisits += b.hospitalVisits; return this; } package: long patients, hospitalTime, hospitalVisits; void Plus(Patient p) { patients++; hospitalTime += p.hospitalTime; hospitalVisits += p.hospitalVisits; } }
D
/Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/SQLite.build/Query/SQLiteQuery+TableName.swift.o : /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+0.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteData.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Utilities/Deprecated.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteStorage.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+CreateTable.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+DropTable.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+AlterTable.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteDataConvertible.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TableName.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TypeName.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteDataType.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+Compare.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteDatabase.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Update.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Delete.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+With.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+Literal.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Join.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Column.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+IndexedColumn.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteColumn.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteConnection.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Direction.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ColumnDefinition.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ConflictResolution.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+DropTableBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+AlterTableBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+UpdateBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+CreateBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+DeleteBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+SelectBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+InsertBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteDataDecoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteRowDecoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteQueryExpressionEncoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteQueryEncoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuerySerializer.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Utilities/SQLiteError.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+UnaryOperator.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+BinaryOperator.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+SetValues.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Utilities/Exports.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Select.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteStatement.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TableConstraint.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ColumnConstraint.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Insert.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ForeignKey.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TableOrSubquery.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/c_nio_darwin.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/c-atomics.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/c_nio_linux.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /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/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/SQLite.build/SQLiteQuery+TableName~partial.swiftmodule : /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+0.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteData.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Utilities/Deprecated.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteStorage.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+CreateTable.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+DropTable.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+AlterTable.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteDataConvertible.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TableName.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TypeName.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteDataType.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+Compare.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteDatabase.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Update.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Delete.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+With.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+Literal.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Join.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Column.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+IndexedColumn.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteColumn.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteConnection.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Direction.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ColumnDefinition.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ConflictResolution.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+DropTableBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+AlterTableBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+UpdateBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+CreateBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+DeleteBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+SelectBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+InsertBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteDataDecoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteRowDecoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteQueryExpressionEncoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteQueryEncoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuerySerializer.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Utilities/SQLiteError.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+UnaryOperator.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+BinaryOperator.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+SetValues.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Utilities/Exports.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Select.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteStatement.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TableConstraint.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ColumnConstraint.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Insert.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ForeignKey.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TableOrSubquery.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/c_nio_darwin.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/c-atomics.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/c_nio_linux.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /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/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/SQLite.build/SQLiteQuery+TableName~partial.swiftdoc : /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+0.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteData.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Utilities/Deprecated.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteStorage.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+CreateTable.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+DropTable.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+AlterTable.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteDataConvertible.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TableName.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TypeName.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteDataType.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+Compare.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteDatabase.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Update.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Delete.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+With.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+Literal.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Join.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Column.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+IndexedColumn.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Row/SQLiteColumn.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteConnection.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Direction.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ColumnDefinition.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ConflictResolution.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+DropTableBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+AlterTableBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+UpdateBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+CreateBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+DeleteBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+SelectBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+InsertBuilder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteDataDecoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteRowDecoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteQueryExpressionEncoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Codable/SQLiteQueryEncoder.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuerySerializer.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Utilities/SQLiteError.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+UnaryOperator.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Expression+BinaryOperator.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+SetValues.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Utilities/Exports.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Select.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Database/SQLiteStatement.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TableConstraint.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ColumnConstraint.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+Insert.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+ForeignKey.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery.swift /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/sqlite.git--8232814251736334455/Sources/SQLite/Query/SQLiteQuery+TableOrSubquery.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/c_nio_darwin.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/c-atomics.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/c_nio_linux.h /Users/user/Documents/RiseTimeAssets/server/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/user/Documents/RiseTimeAssets/server/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /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
module appstate; import derelict.glfw3 : GLFWwindow; import dlsl.matrix; import erupted; import vdrive; import input; // struct to manage vulkan objects and state struct VDrive_State { // initialize Vulkan vk; alias vk this; VkQueue graphic_queue; uint32_t graphic_queue_family_index; // required for command pool GLFWwindow* window; VkDebugReportCallbackEXT debugReportCallback; // camera transforms and trackball TrackballButton tb; // Trackball manipulator updating View Matrix mat4* wvpm; // World View Projection Matrix mat4 projection; // Projection Matrix float projection_fovy = 60; // Projection Field Of View in Y dimension float projection_near = 0.01; // Projection near plane distance float projection_far = 1000; // Projection far plane distance // surface and swapchain Meta_Surface surface; VkSampleCountFlagBits sample_count = VK_SAMPLE_COUNT_1_BIT; VkFormat depth_image_format = VK_FORMAT_D16_UNORM; // memory Resources Meta_Buffer wvpm_buffer; VkMappedMemoryRange wvpm_flush; Meta_Image depth_image; Meta_Geometry triangle; // command and related VkCommandPool cmd_pool; Array!VkCommandBuffer cmd_buffers; VkPresentInfoKHR present_info; VkSubmitInfo submit_info; // the wait_stage_mask must stay alive, hence its a member VkPipelineStageFlags submit_wait_stage_mask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; // synchronize VkFence[2] submit_fence; VkSemaphore acquired_semaphore; VkSemaphore rendered_semaphore; // render setup Meta_Renderpass render_pass; Meta_Descriptor wvpm_descriptor; Meta_Graphics pipeline; Meta_Framebuffers framebuffers; // dynamic state VkViewport viewport; VkRect2D scissors; // window resize callback result bool window_resized = false; } nothrow: // convenience functions for perspective computations in main auto windowWidth( ref VDrive_State vd ) { return vd.surface.imageExtent.width; } auto windowHeight( ref VDrive_State vd ) { return vd.surface.imageExtent.height; } // this is used in windowResizeCallback // there only a VDrive_State pointer is available and we avoid ugly dereferencing void swapchainExtent( VDrive_State* vd, uint32_t win_w, uint32_t win_h ) { vd.surface.create_info.imageExtent = VkExtent2D( win_w, win_h ); } // update projection matrix from member data _fovy, _near, _far // and the swapchain extent converted to aspect void updateProjection( ref VDrive_State vd ) { import dlsl.projection; vd.projection = vkPerspective( vd.projection_fovy, cast( float )vd.windowWidth / vd.windowHeight, vd.projection_near, vd.projection_far ); } // multiply projection with trackball (view) matrix and upload to uniform buffer void updateWVPM( ref VDrive_State vd ) { *( vd.wvpm ) = vd.projection * vd.tb.matrix; vd.device.vkFlushMappedMemoryRanges( 1, &vd.wvpm_flush ); } void draw( ref VDrive_State vd ) { // this bool and and the surface.create_info.imageExtent // was set in the window resize callback if( vd.window_resized ) { vd.window_resized = false; // swapchain might not have the same extent as the window dimension // the data we use for projection computation is the glfw window extent at this place vd.updateProjection; // compute projection matrix from new window extent vd.updateWVPM; // multiplies projection trackball (view) matrix and uploads to uniform buffer // notify trackball manipulator about height change, this has effect on panning speed vd.tb.windowHeight( vd.windowHeight ); // wait till device is idle vd.device.vkDeviceWaitIdle; try { // destroy old and recreate new window size dependent resources import triangle; vd.resizeResources; } catch( Exception ) {} } uint32_t next_image_index; // acquire next swapchain image vd.device.vkAcquireNextImageKHR( vd.surface.swapchain, uint64_t.max, vd.acquired_semaphore, VK_NULL_HANDLE, &next_image_index ); // wait for finished drawing vd.device.vkWaitForFences( 1, &vd.submit_fence[ next_image_index ], VK_TRUE, uint64_t.max ); vd.device.vkResetFences( 1, &vd.submit_fence[ next_image_index ] ).vkAssert; // submit command buffer to queue vd.submit_info.pCommandBuffers = &vd.cmd_buffers[ next_image_index ]; vd.graphic_queue.vkQueueSubmit( 1, &vd.submit_info, vd.submit_fence[ next_image_index ] ); // or VK_NULL_HANDLE, fence is only requieed if syncing to CPU for e.g. UBO updates per frame // present rendered image vd.present_info.pImageIndices = &next_image_index; vd.surface.present_queue.vkQueuePresentKHR( &vd.present_info ); }
D
something that is a counterfeit a person who makes deceitful pretenses (football) a deceptive move made by a football player make a copy of with the intent to deceive tamper, with the purpose of deception speak insincerely or without regard for facts or truths fraudulent not genuine or real
D
// Written in the D programming language. /** This module contains declaration of Widget class - base class for all widgets. Widgets are styleable. Use styleId property to set style to use from current Theme. When any of styleable attributes is being overriden, widget's own copy of style is being created to hold modified attributes (defaults to parent style). Two phase layout model (like in Android UI) is used - measure() call is followed by layout() is used to measure and layout widget and its children.abstract Method onDraw will be called to draw widget on some surface. Widget.onDraw() draws widget background (if any). Synopsis: ---- import dlangui.widgets.widget; // access attributes as properties auto w = new Widget("id1"); w.backgroundColor = 0xFFFF00; w.layoutWidth = FILL_PARENT; w.layoutHeight = FILL_PARENT; w.padding(Rect(10,10,10,10)); // same, but using chained method call auto w = new Widget("id1").backgroundColor(0xFFFF00).layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT).padding(Rect(10,10,10,10)); ---- Copyright: Vadim Lopatin, 2014 License: Boost License 1.0 Authors: Vadim Lopatin, coolreader.org@gmail.com */ module dlangui.widgets.widget; public { import dlangui.core.types; import dlangui.core.events; import dlangui.core.i18n; import dlangui.core.collections; import dlangui.widgets.styles; import dlangui.graphics.drawbuf; import dlangui.graphics.resources; import dlangui.graphics.fonts; import dlangui.graphics.colors; import dlangui.core.signals; import dlangui.platforms.common.platform; import dlangui.dml.annotations; } import std.algorithm; /// Visibility (see Android View Visibility) enum Visibility : ubyte { /// Visible on screen (default) Visible, /// Not visible, but occupies a space in layout Invisible, /// Completely hidden, as not has been added Gone } enum Orientation : ubyte { Vertical, Horizontal } enum FocusReason : ubyte { TabFocus, Unspecified } /// interface - slot for onClick interface OnClickHandler { bool onClick(Widget source); } /// interface - slot for onCheckChanged interface OnCheckHandler { bool onCheckChanged(Widget source, bool checked); } /// interface - slot for onFocusChanged interface OnFocusHandler { bool onFocusChanged(Widget source, bool focused); } /// interface - slot for onKey interface OnKeyHandler { bool onKey(Widget source, KeyEvent event); } /// interface - slot for keyToAction interface OnKeyActionHandler { Action findKeyAction(Widget source, uint keyCode, uint keyFlags); } /// interface - slot for onAction interface OnActionHandler { bool onAction(Widget source, const Action action); } /// interface - slot for onMouse interface OnMouseHandler { bool onMouse(Widget source, MouseEvent event); } /// focus movement options enum FocusMovement { /// no focus movement None, /// next focusable (Tab) Next, /// previous focusable (Shift+Tab) Previous, /// move to nearest above Up, /// move to nearest below Down, /// move to nearest at left Left, /// move to nearest at right Right, } /// standard mouse cursor types enum CursorType { None, /// use parent's cursor Parent, Arrow, IBeam, Wait, Crosshair, WaitArrow, SizeNWSE, SizeNESW, SizeWE, SizeNS, SizeAll, No, Hand } /** * Base class for all widgets. * */ @dmlwidget class Widget { protected: /// widget id string _id; /// current widget position, set by layout() Rect _pos; /// widget visibility: either Visible, Invisible, Gone Visibility _visibility = Visibility.Visible; // visible by default /// style id to lookup style in theme string _styleId; /// own copy of style - to override some of style properties, null of no properties overriden Style _ownStyle; /// widget state (set of flags from State enum) uint _state; /// width measured by measure() int _measuredWidth; /// height measured by measure() int _measuredHeight; /// true to force layout bool _needLayout = true; /// true to force redraw bool _needDraw = true; /// parent widget Widget _parent; /// window (to be used for top level widgets only!) Window _window; /// does widget need to track mouse Hover bool _trackHover; public: /// mouse movement processing flag (when true, widget will change Hover state while mouse is moving) @property bool trackHover() const { return _trackHover && !TOUCH_MODE; } /// set new trackHover flag value (when true, widget will change Hover state while mouse is moving) @property Widget trackHover(bool v) { _trackHover = v; return this; } /// returns mouse cursor type for widget uint getCursorType(int x, int y) { return CursorType.Arrow; } /// empty parameter list constructor - for usage by factory this() { this(null); } /// create with ID parameter this(string ID) { _id = ID; _state = State.Enabled; _cachedStyle = currentTheme.get(null); debug _instanceCount++; //Log.d("Created widget, count = ", ++_instanceCount); } debug { private static __gshared int _instanceCount = 0; /// for debug purposes - number of created widget objects, not yet destroyed static @property int instanceCount() { return _instanceCount; } } ~this() { debug { //Log.v("destroying widget ", _id, " ", this.classinfo.name); if (appShuttingDown) onResourceDestroyWhileShutdown(_id, this.classinfo.name); _instanceCount--; } if (_ownStyle !is null) destroy(_ownStyle); _ownStyle = null; //Log.d("Destroyed widget, count = ", --_instanceCount); } // Caching a style to decrease a number of currentTheme.get calls. private Style _cachedStyle; /// accessor to style - by lookup in theme by styleId (if style id is not set, theme base style will be used). protected @property const (Style) style() const { if (_ownStyle !is null) return _ownStyle; if(_cachedStyle !is null) return _cachedStyle; return currentTheme.get(_styleId); } /// accessor to style - by lookup in theme by styleId (if style id is not set, theme base style will be used). protected @property const (Style) style(uint stateFlags) const { const (Style) normalStyle = style(); if (stateFlags == State.Normal) // state is normal return normalStyle; const (Style) stateStyle = normalStyle.forState(stateFlags); if (stateStyle !is normalStyle) return stateStyle; // found style for state in current style //// lookup state style in parent (one level max) //const (Style) parentStyle = normalStyle.parentStyle; //if (parentStyle is normalStyle) // return normalStyle; // no parent //const (Style) parentStateStyle = parentStyle.forState(stateFlags); //if (parentStateStyle !is parentStyle) // return parentStateStyle; // found style for state in parent return normalStyle; // fallback to current style } /// returns style for current widget state protected @property const(Style) stateStyle() const { return style(state); } /// enforces widget's own style - allows override some of style properties @property Style ownStyle() { if (_ownStyle is null) _ownStyle = currentTheme.modifyStyle(_styleId); return _ownStyle; } /// handle theme change: e.g. reload some themed resources void onThemeChanged() { // default implementation: call recursive for children for (int i = 0; i < childCount; i++) child(i).onThemeChanged(); if (_ownStyle) { _ownStyle.onThemeChanged(); } if (_cachedStyle) { _cachedStyle = currentTheme.get(_styleId); } } /// returns widget id, null if not set @property string id() const { return _id; } /// set widget id @property Widget id(string id) { _id = id; return this; } /// compare widget id with specified value, returs true if matches bool compareId(string id) const { return (_id !is null) && id.equal(_id); } /// widget state (set of flags from State enum) @property uint state() const { if ((_state & State.Parent) != 0 && _parent !is null) return _parent.state; if (focusGroupFocused) return _state | State.WindowFocused; // TODO: return _state; } /// override to handle focus changes protected void handleFocusChange(bool focused, bool receivedFocusFromKeyboard = false) { invalidate(); focusChange(this, focused); } /// override to handle check changes protected void handleCheckChange(bool checked) { invalidate(); checkChange(this, checked); } /// set new widget state (set of flags from State enum) @property Widget state(uint newState) { if ((_state & State.Parent) != 0 && _parent !is null) return _parent.state(newState); if (newState != _state) { uint oldState = _state; _state = newState; // need to redraw invalidate(); // notify focus changes if ((oldState & State.Focused) && !(newState & State.Focused)) handleFocusChange(false); else if (!(oldState & State.Focused) && (newState & State.Focused)) handleFocusChange(true, cast(bool)(newState & State.KeyboardFocused)); // notify checked changes if ((oldState & State.Checked) && !(newState & State.Checked)) handleCheckChange(false); else if (!(oldState & State.Checked) && (newState & State.Checked)) handleCheckChange(true); } return this; } /// add state flags (set of flags from State enum) @property Widget setState(uint stateFlagsToSet) { return state(state | stateFlagsToSet); } /// remove state flags (set of flags from State enum) @property Widget resetState(uint stateFlagsToUnset) { return state(state & ~stateFlagsToUnset); } //====================================================== // Style related properties /// returns widget style id, null if not set @property string styleId() const { return _styleId; } /// set widget style id @property Widget styleId(string id) { _styleId = id; if (_ownStyle) _ownStyle.parentStyleId = id; _cachedStyle = currentTheme.get(id); return this; } /// get margins (between widget bounds and its background) @property Rect margins() const { return style.margins; } /// set margins for widget - override one from style @property Widget margins(Rect rc) { ownStyle.margins = rc; requestLayout(); return this; } /// set margins for widget with the same value for left, top, right, bottom - override one from style @property Widget margins(int v) { ownStyle.margins = Rect(v, v, v, v); requestLayout(); return this; } static enum FOCUS_RECT_PADDING = 2; /// get padding (between background bounds and content of widget) @property Rect padding() const { // get max padding from style padding and background drawable padding Rect p = style.padding; DrawableRef d = backgroundDrawable; if (!d.isNull) { Rect dp = d.padding; if (p.left < dp.left) p.left = dp.left; if (p.right < dp.right) p.right = dp.right; if (p.top < dp.top) p.top = dp.top; if (p.bottom < dp.bottom) p.bottom = dp.bottom; } if ((focusable || ((state & State.Parent) && parent.focusable)) && focusRectColors) { // add two pixels to padding when focus rect is required - one pixel for focus rect, one for additional space p.offset(FOCUS_RECT_PADDING, FOCUS_RECT_PADDING); } return p; } /// set padding for widget - override one from style @property Widget padding(Rect rc) { ownStyle.padding = rc; requestLayout(); return this; } /// set padding for widget to the same value for left, top, right, bottom - override one from style @property Widget padding(int v) { ownStyle.padding = Rect(v, v, v, v); requestLayout(); return this; } /// returns background color @property uint backgroundColor() const { return stateStyle.backgroundColor; } /// set background color for widget - override one from style @property Widget backgroundColor(uint color) { ownStyle.backgroundColor = color; invalidate(); return this; } /// set background color for widget - from string like "#5599CC" or "white" @property Widget backgroundColor(string colorString) { uint color = decodeHexColor(colorString, COLOR_TRANSPARENT); ownStyle.backgroundColor = color; invalidate(); return this; } /// background image id @property string backgroundImageId() const { return style.backgroundImageId; } /// background image id @property Widget backgroundImageId(string imageId) { ownStyle.backgroundImageId = imageId; return this; } /// returns colors to draw focus rectangle (one for solid, two for vertical gradient) or null if no focus rect should be drawn for style @property const(uint[]) focusRectColors() const { return style.focusRectColors; } DrawableRef _backgroundDrawable; /// background drawable @property DrawableRef backgroundDrawable() const { if (_backgroundDrawable.isNull) return stateStyle.backgroundDrawable; return (cast(Widget)this)._backgroundDrawable; } /// background drawable @property void backgroundDrawable(DrawableRef drawable) { _backgroundDrawable = drawable; } /// widget drawing alpha value (0=opaque .. 255=transparent) @property uint alpha() const { return stateStyle.alpha; } /// set widget drawing alpha value (0=opaque .. 255=transparent) @property Widget alpha(uint value) { ownStyle.alpha = value; invalidate(); return this; } /// get text color (ARGB 32 bit value) @property uint textColor() const { return stateStyle.textColor; } /// set text color (ARGB 32 bit value) @property Widget textColor(uint value) { ownStyle.textColor = value; invalidate(); return this; } /// set text color for widget - from string like "#5599CC" or "white" @property Widget textColor(string colorString) { uint color = decodeHexColor(colorString, 0x000000); ownStyle.textColor = color; invalidate(); return this; } /// get text flags (bit set of TextFlag enum values) @property uint textFlags() { uint res = stateStyle.textFlags; if (res == TEXT_FLAGS_USE_PARENT) { if (parent) res = parent.textFlags; else res = 0; } if (res & TextFlag.UnderlineHotKeysWhenAltPressed) { uint modifiers = 0; if (window !is null) modifiers = window.keyboardModifiers; bool altPressed = (modifiers & (KeyFlag.Alt | KeyFlag.LAlt | KeyFlag.RAlt)) != 0; if (!altPressed) { res = (res & ~(TextFlag.UnderlineHotKeysWhenAltPressed | TextFlag.UnderlineHotKeys)) | TextFlag.HotKeys; } else { res |= TextFlag.UnderlineHotKeys; } } return res; } /// set text flags (bit set of TextFlag enum values) @property Widget textFlags(uint value) { ownStyle.textFlags = value; bool oldHotkeys = (ownStyle.textFlags & (TextFlag.HotKeys | TextFlag.UnderlineHotKeys | TextFlag.UnderlineHotKeysWhenAltPressed)) != 0; bool newHotkeys = (value & (TextFlag.HotKeys | TextFlag.UnderlineHotKeys | TextFlag.UnderlineHotKeysWhenAltPressed)) != 0; handleFontChanged(); if (oldHotkeys != newHotkeys) requestLayout(); else invalidate(); return this; } /// returns font face @property string fontFace() const { return stateStyle.fontFace; } /// set font face for widget - override one from style @property Widget fontFace(string face) { ownStyle.fontFace = face; handleFontChanged(); requestLayout(); return this; } /// returns font style (italic/normal) @property bool fontItalic() const { return stateStyle.fontItalic; } /// set font style (italic/normal) for widget - override one from style @property Widget fontItalic(bool italic) { ownStyle.fontStyle = italic ? FONT_STYLE_ITALIC : FONT_STYLE_NORMAL; handleFontChanged(); requestLayout(); return this; } /// returns font weight @property ushort fontWeight() const { return stateStyle.fontWeight; } /// set font weight for widget - override one from style @property Widget fontWeight(int weight) { if (weight < 100) weight = 100; else if (weight > 900) weight = 900; ownStyle.fontWeight = cast(ushort)weight; handleFontChanged(); requestLayout(); return this; } /// returns font size in pixels @property int fontSize() const { return stateStyle.fontSize; } /// set font size for widget - override one from style @property Widget fontSize(int size) { ownStyle.fontSize = size; handleFontChanged(); requestLayout(); return this; } /// returns font family @property FontFamily fontFamily() const { return stateStyle.fontFamily; } /// set font family for widget - override one from style @property Widget fontFamily(FontFamily family) { ownStyle.fontFamily = family; handleFontChanged(); requestLayout(); return this; } /// returns alignment (combined vertical and horizontal) @property ubyte alignment() const { return style.alignment; } /// sets alignment (combined vertical and horizontal) @property Widget alignment(ubyte value) { ownStyle.alignment = value; requestLayout(); return this; } /// returns horizontal alignment @property Align valign() { return cast(Align)(alignment & Align.VCenter); } /// returns vertical alignment @property Align halign() { return cast(Align)(alignment & Align.HCenter); } /// returns font set for widget using style or set manually @property FontRef font() const { return stateStyle.font; } /// returns widget content text (override to support this) @property dstring text() const { return ""; } /// sets widget content text (override to support this) @property Widget text(dstring s) { return this; } /// sets widget content text (override to support this) @property Widget text(UIString s) { return this; } /// override to handle font changes protected void handleFontChanged() {} //================================================================== // Layout and drawing related methods /// returns true if layout is required for widget and its children @property bool needLayout() { return _needLayout; } /// returns true if redraw is required for widget and its children @property bool needDraw() { return _needDraw; } /// returns true is widget is being animated - need to call animate() and redraw @property bool animating() { return false; } /// animates window; interval is time left from previous draw, in hnsecs (1/10000000 of second) void animate(long interval) { } /// returns measured width (calculated during measure() call) @property measuredWidth() { return _measuredWidth; } /// returns measured height (calculated during measure() call) @property measuredHeight() { return _measuredHeight; } /// returns current width of widget in pixels @property int width() { return _pos.width; } /// returns current height of widget in pixels @property int height() { return _pos.height; } /// returns widget rectangle top position @property int top() { return _pos.top; } /// returns widget rectangle left position @property int left() { return _pos.left; } /// returns widget rectangle @property Rect pos() { return _pos; } /// returns min width constraint @property int minWidth() { return style.minWidth; } /// returns max width constraint (SIZE_UNSPECIFIED if no constraint set) @property int maxWidth() { return style.maxWidth; } /// returns min height constraint @property int minHeight() { return style.minHeight; } /// returns max height constraint (SIZE_UNSPECIFIED if no constraint set) @property int maxHeight() { return style.maxHeight; } /// set max width constraint (SIZE_UNSPECIFIED for no constraint) @property Widget maxWidth(int value) { ownStyle.maxWidth = value; return this; } /// set max width constraint (0 for no constraint) @property Widget minWidth(int value) { ownStyle.minWidth = value; return this; } /// set max height constraint (SIZE_UNSPECIFIED for no constraint) @property Widget maxHeight(int value) { ownStyle.maxHeight = value; return this; } /// set max height constraint (0 for no constraint) @property Widget minHeight(int value) { ownStyle.minHeight = value; return this; } /// returns layout width options (WRAP_CONTENT, FILL_PARENT, some constant value or percent but only for one widget in layout) @property int layoutWidth() { return style.layoutWidth; } /// returns layout height options (WRAP_CONTENT, FILL_PARENT, some constant value or percent but only for one widget in layout) @property int layoutHeight() { return style.layoutHeight; } /// returns layout weight (while resizing to fill parent, widget will be resized proportionally to this value) @property int layoutWeight() { return style.layoutWeight; } /// sets layout width options (WRAP_CONTENT, FILL_PARENT, or some constant value) @property Widget layoutWidth(int value) { ownStyle.layoutWidth = value; return this; } /// sets layout height options (WRAP_CONTENT, FILL_PARENT, or some constant value) @property Widget layoutHeight(int value) { ownStyle.layoutHeight = value; return this; } /// sets layout weight (while resizing to fill parent, widget will be resized proportionally to this value) @property Widget layoutWeight(int value) { ownStyle.layoutWeight = value; return this; } /// sets layoutWidth=FILL_PARENT and layoutHeight=FILL_PARENT Widget fillParent() { return layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT); } /// sets layoutWidth=FILL_PARENT Widget fillHorizontal() { return layoutWidth(FILL_PARENT); } /// sets layoutHeight=FILL_PARENT Widget fillVertical() { return layoutHeight(FILL_PARENT); } /// returns widget visibility (Visible, Invisible, Gone) @property Visibility visibility() { return _visibility; } /// sets widget visibility (Visible, Invisible, Gone) @property Widget visibility(Visibility newVisibility) { if (_visibility != newVisibility) { if ((_visibility == Visibility.Gone) || (newVisibility == Visibility.Gone)) { if (parent) parent.requestLayout(); else requestLayout(); } else invalidate(); _visibility = newVisibility; } return this; } /// returns true if point is inside of this widget bool isPointInside(int x, int y) { return _pos.isPointInside(x, y); } /// return true if state has State.Enabled flag set @property bool enabled() { return (state & State.Enabled) != 0; } /// change enabled state @property Widget enabled(bool flg) { flg ? setState(State.Enabled) : resetState(State.Enabled); return this; } protected bool _clickable; /// when true, user can click this control, and get onClick listeners called @property bool clickable() { return _clickable; } @property Widget clickable(bool flg) { _clickable = flg; return this; } @property bool canClick() { return _clickable && enabled && visible; } protected bool _checkable; /// when true, control supports Checked state @property bool checkable() { return _checkable; } @property Widget checkable(bool flg) { _checkable = flg; return this; } @property bool canCheck() { return _checkable && enabled && visible; } protected bool _checked; /// get checked state @property bool checked() { return (state & State.Checked) != 0; } /// set checked state @property Widget checked(bool flg) { if (flg != checked) { if (flg) setState(State.Checked); else resetState(State.Checked); invalidate(); } return this; } protected bool _focusable; /// whether widget can be focused @property bool focusable() const { return _focusable; } @property Widget focusable(bool flg) { _focusable = flg; return this; } @property bool focused() const { return (window !is null && window.focusedWidget is this && (state & State.Focused)); } /// override and return true to track key events even when not focused @property bool wantsKeyTracking() { return false; } protected Action _action; /// action to emit on click @property const(Action) action() { return _action; } /// action to emit on click @property void action(const Action action) { _action = action.clone; handleActionStateChanged(); } /// action to emit on click @property void action(Action action) { _action = action; handleActionStateChanged(); } /// ask for update state of some action (unles force=true, checks window flag actionsUpdateRequested), returns true if action state is changed bool updateActionState(Action a, bool force = false, bool allowDefault = true) { if (Window w = window) { if (!force && !w.actionsUpdateRequested()) return false; const ActionState oldState = a.state; //import dlangui.widgets.editors; //if (a.id == EditorActions.Undo) { // Log.d("Requesting Undo action. Old state: ", a.state); //} if (w.dispatchActionStateRequest(a, this)) { // state is updated //Log.d("updateActionState ", a.label, " found state: ", a.state.toString); if (allowDefault) return true; // return 'request dispatched' flag instead of 'changed' } else { if (!allowDefault) return false; a.state = a.defaultState; //Log.d("updateActionState ", a.label, " using default state: ", a.state.toString); } if (a.state != oldState) return true; } return false; } /// call to update state for action (if action is assigned for widget) void updateActionState(bool force = false) { if (!_action || !(action.stateUpdateFlag & ActionStateUpdateFlag.inWidget)) return; if (updateActionState(_action, force)) handleActionStateChanged(); } /// called when state of action assigned on widget is changed void handleActionStateChanged() { // override to update enabled state, visibility and checked state // default processing: copy flags to this widget updateStateFromAction(_action); } /// apply enabled, visibile and checked state for this widget from action's state void updateStateFromAction(Action a) { const ActionState s = a.state; if (s.enabled != enabled) { enabled = s.enabled; } if (s.checked != checked) { checked = s.checked; } bool v = _visibility == Visibility.Visible; if (s.visible != v) { visibility = s.visible ? Visibility.Visible : Visibility.Gone; } } /// set action update request flag, will be cleared after redraw void requestActionsUpdate(bool immediateUpdate = false) { if (Window w = window) { w.requestActionsUpdate(immediateUpdate); } } protected UIString _tooltipText; /// tooltip text - when not empty, widget will show tooltips automatically; for advanced tooltips - override hasTooltip and createTooltip @property dstring tooltipText() { return _tooltipText; } /// tooltip text - when not empty, widget will show tooltips automatically; for advanced tooltips - override hasTooltip and createTooltip @property Widget tooltipText(dstring text) { _tooltipText = text; return this; } /// tooltip text - when not empty, widget will show tooltips automatically; for advanced tooltips - override hasTooltip and createTooltip @property Widget tooltipText(UIString text) { _tooltipText = text; return this; } /// returns true if widget has tooltip to show @property bool hasTooltip() { return tooltipText.length > 0; } /// will be called from window once tooltip request timer expired; if null is returned, popup will not be shown; you can change alignment and position of popup here Widget createTooltip(int mouseX, int mouseY, ref uint alignment, ref int x, ref int y) { // default implementation supports tooltips when tooltipText property is set if (!_tooltipText.empty) { import dlangui.widgets.controls; Widget res = new TextWidget("tooltip", _tooltipText.value); res.styleId = STYLE_TOOLTIP; return res; } return null; } /// schedule tooltip void scheduleTooltip(long delay = 300, uint alignment = 2 /*PopupAlign.Below*/, int x = 0, int y = 0) { if (auto w = window) w.scheduleTooltip(this, delay, alignment, x, y); } protected bool _focusGroup; /***************************************** * When focus group is set for some parent widget, focus from one of containing widgets can be moved using keyboard only to one of other widgets containing in it and cannot bypass bounds of focusGroup. * * If focused widget doesn't have any parent with focusGroup == true, focus may be moved to any focusable within window. * */ @property bool focusGroup() { return _focusGroup; } /// set focus group flag for container widget @property Widget focusGroup(bool flg) { _focusGroup = flg; return this; } @property bool focusGroupFocused() const { Widget w = focusGroupWidget(); return (w._state & State.WindowFocused) != 0; } protected bool setWindowFocusedFlag(bool flg) { if (flg) { if ((_state & State.WindowFocused) == 0) { _state |= State.WindowFocused; invalidate(); return true; } } else { if ((_state & State.WindowFocused) != 0) { _state &= ~State.WindowFocused; invalidate(); return true; } } return false; } @property Widget focusGroupFocused(bool flg) { Widget w = focusGroupWidget(); w.setWindowFocusedFlag(flg); while (w.parent) { w = w.parent; if (w.parent is null || w.focusGroup) { w.setWindowFocusedFlag(flg); } } return this; } /// find nearest parent of this widget with focusGroup flag, returns topmost parent if no focusGroup flag set to any of parents. Widget focusGroupWidget() inout { Widget p = cast(Widget)this; while (p) { if (!p.parent || p.focusGroup) break; p = p.parent; } return p; } private static class TabOrderInfo { Widget widget; uint tabOrder; uint childOrder; Rect rect; this(Widget widget, Rect rect) { this.widget = widget; this.tabOrder = widget.thisOrParentTabOrder(); this.rect = widget.pos; } static if (BACKEND_GUI) { static enum NEAR_THRESHOLD = 10; } else { static enum NEAR_THRESHOLD = 1; } bool nearX(TabOrderInfo v) { return v.rect.left >= rect.left - NEAR_THRESHOLD && v.rect.left <= rect.left + NEAR_THRESHOLD; } bool nearY(TabOrderInfo v) { return v.rect.top >= rect.top - NEAR_THRESHOLD && v.rect.top <= rect.top + NEAR_THRESHOLD; } override int opCmp(Object obj) const { TabOrderInfo v = cast(TabOrderInfo)obj; if (tabOrder != 0 && v.tabOrder !=0) { if (tabOrder < v.tabOrder) return -1; if (tabOrder > v.tabOrder) return 1; } // place items with tabOrder 0 after items with tabOrder non-0 if (tabOrder != 0) return -1; if (v.tabOrder != 0) return 1; if (childOrder < v.childOrder) return -1; if (childOrder > v.childOrder) return 1; return 0; } /// less predicat for Left/Right sorting static bool lessHorizontal(TabOrderInfo obj1, TabOrderInfo obj2) { if (obj1.nearY(obj2)) { return obj1.rect.left < obj2.rect.left; } return obj1.rect.top < obj2.rect.top; } /// less predicat for Up/Down sorting static bool lessVertical(TabOrderInfo obj1, TabOrderInfo obj2) { if (obj1.nearX(obj2)) { return obj1.rect.top < obj2.rect.top; } return obj1.rect.left < obj2.rect.left; } override string toString() const { return widget.id; } } private void findFocusableChildren(ref TabOrderInfo[] results, Rect clipRect, Widget currentWidget) { if (visibility != Visibility.Visible) return; Rect rc = _pos; applyMargins(rc); applyPadding(rc); if (!rc.intersects(clipRect)) return; // out of clip rectangle if (canFocus || this is currentWidget) { TabOrderInfo item = new TabOrderInfo(this, rc); results ~= item; return; } rc.intersect(clipRect); for (int i = 0; i < childCount(); i++) { child(i).findFocusableChildren(results, rc, currentWidget); } } /// find all focusables belonging to the same focusGroup as this widget (does not include current widget). /// usually to be called for focused widget to get possible alternatives to navigate to private TabOrderInfo[] findFocusables(Widget currentWidget) { TabOrderInfo[] result; Widget group = focusGroupWidget(); group.findFocusableChildren(result, group.pos, currentWidget); for (ushort i = 0; i < result.length; i++) result[i].childOrder = i + 1; sort(result); return result; } protected ushort _tabOrder; /// tab order - hint for focus movement using Tab/Shift+Tab @property ushort tabOrder() { return _tabOrder; } @property Widget tabOrder(ushort tabOrder) { _tabOrder = tabOrder; return this; } private int thisOrParentTabOrder() { if (_tabOrder) return _tabOrder; if (!parent) return 0; return parent.thisOrParentTabOrder; } /// call on focused widget, to find best private Widget findNextFocusWidget(FocusMovement direction) { if (direction == FocusMovement.None) return this; TabOrderInfo[] focusables = findFocusables(this); if (!focusables.length) return null; int myIndex = -1; for (int i = 0; i < focusables.length; i++) { if (focusables[i].widget is this) { myIndex = i; break; } } debug(DebugFocus) Log.d("findNextFocusWidget myIndex=", myIndex, " of focusables: ", focusables); if (myIndex == -1) return null; // not found myself if (focusables.length == 1) return focusables[0].widget; // single option - use it if (direction == FocusMovement.Next) { // move forward int index = myIndex + 1; if (index >= focusables.length) index = 0; return focusables[index].widget; } else if (direction == FocusMovement.Previous) { // move back int index = myIndex - 1; if (index < 0) index = cast(int)focusables.length - 1; return focusables[index].widget; } else { // Left, Right, Up, Down if (direction == FocusMovement.Left || direction == FocusMovement.Right) { sort!(TabOrderInfo.lessHorizontal)(focusables); } else { sort!(TabOrderInfo.lessVertical)(focusables); } myIndex = 0; for (int i = 0; i < focusables.length; i++) { if (focusables[i].widget is this) { myIndex = i; break; } } int index = myIndex; if (direction == FocusMovement.Left || direction == FocusMovement.Up) { index--; if (index < 0) index = cast(int)focusables.length - 1; } else { index++; if (index >= focusables.length) index = 0; } return focusables[index].widget; } } bool handleMoveFocusUsingKeys(KeyEvent event) { if (!focused || !visible) return false; if (event.action != KeyAction.KeyDown) return false; FocusMovement direction = FocusMovement.None; uint flags = event.flags & (KeyFlag.Shift | KeyFlag.Control | KeyFlag.Alt); switch (event.keyCode) with(KeyCode) { case LEFT: if (flags == 0) direction = FocusMovement.Left; break; case RIGHT: if (flags == 0) direction = FocusMovement.Right; break; case UP: if (flags == 0) direction = FocusMovement.Up; break; case DOWN: if (flags == 0) direction = FocusMovement.Down; break; case TAB: if (flags == 0) direction = FocusMovement.Next; else if (flags == KeyFlag.Shift) direction = FocusMovement.Previous; break; default: break; } if (direction == FocusMovement.None) return false; Widget nextWidget = findNextFocusWidget(direction); if (!nextWidget) return false; nextWidget.setFocus(FocusReason.TabFocus); return true; } /// returns true if this widget and all its parents are visible @property bool visible() { if (visibility != Visibility.Visible) return false; if (parent is null) return true; return parent.visible; } /// returns true if widget is focusable and visible and enabled @property bool canFocus() { return focusable && visible && enabled; } /// sets focus to this widget or suitable focusable child, returns previously focused widget Widget setFocus(FocusReason reason = FocusReason.Unspecified) { if (window is null) return null; if (!visible) return window.focusedWidget; invalidate(); if (!canFocus) { Widget w = findFocusableChild(true); if (!w) w = findFocusableChild(false); if (w) return window.setFocus(w, reason); // try to find focusable child return window.focusedWidget; } return window.setFocus(this, reason); } /// searches children for first focusable item, returns null if not found Widget findFocusableChild(bool defaultOnly) { for(int i = 0; i < childCount; i++) { Widget w = child(i); if (w.canFocus && (!defaultOnly || (w.state & State.Default) != 0)) return w; w = w.findFocusableChild(defaultOnly); if (w !is null) return w; } if (canFocus) return this; return null; } // ======================================================= // Events protected ActionMap _acceleratorMap; @property ref ActionMap acceleratorMap() { return _acceleratorMap; } /// override to handle specific actions bool handleAction(const Action a) { if (onAction.assigned) if (onAction(this, a)) return true; return false; } /// override to handle specific actions state (e.g. change enabled state for supported actions) bool handleActionStateRequest(const Action a) { return false; } /// call to dispatch action bool dispatchAction(const Action a) { if (window) return window.dispatchAction(a, this); else return handleAction(a); } // called to process click and notify listeners protected bool handleClick() { bool res = false; if (click.assigned) res = click(this); else if (_action) { return dispatchAction(_action); } return res; } void cancelLayout() { _needLayout = false; } /// set new timer to call onTimer() after specified interval (for recurred notifications, return true from onTimer) ulong setTimer(long intervalMillis) { if (auto w = window) return w.setTimer(this, intervalMillis); return 0; // no window - no timer } /// cancel timer - pass value returned from setTimer() as timerId parameter void cancelTimer(ulong timerId) { if (auto w = window) w.cancelTimer(timerId); } /// handle timer; return true to repeat timer event after next interval, false cancel timer bool onTimer(ulong id) { // override to do something useful // return true to repeat after the same interval, false to stop timer return false; } /// map key to action Action findKeyAction(uint keyCode, uint flags) { Action action = _acceleratorMap.findByKey(keyCode, flags); if (action) return action; if (keyToAction.assigned) action = keyToAction(this, keyCode, flags); return action; } /// process key event, return true if event is processed. bool onKeyEvent(KeyEvent event) { if (keyEvent.assigned && keyEvent(this, event)) return true; // processed by external handler if (event.action == KeyAction.KeyDown) { //Log.d("Find key action for key = ", event.keyCode, " flags=", event.flags); Action action = findKeyAction(event.keyCode, event.flags); // & (KeyFlag.Shift | KeyFlag.Alt | KeyFlag.Control | KeyFlag.Menu) if (action !is null) { //Log.d("Action found: ", action.id, " ", action.labelValue.id); // update action state if ((action.stateUpdateFlag & ActionStateUpdateFlag.inAccelerator) && updateActionState(action, true) && action is _action) handleActionStateChanged(); //run only enabled actions if (action.state.enabled) return dispatchAction(action); } } // handle focus navigation using keys if (focused && handleMoveFocusUsingKeys(event)) return true; if (canClick) { // support onClick event initiated by Space or Return keys if (event.action == KeyAction.KeyDown) { if (event.keyCode == KeyCode.SPACE || event.keyCode == KeyCode.RETURN) { setState(State.Pressed); return true; } } if (event.action == KeyAction.KeyUp) { if (event.keyCode == KeyCode.SPACE || event.keyCode == KeyCode.RETURN) { resetState(State.Pressed); handleClick(); return true; } } } return false; } /// handle custom event bool onEvent(CustomEvent event) { RunnableEvent runnable = cast(RunnableEvent)event; if (runnable) { // handle runnable runnable.run(); return true; } // override to handle more events return false; } /// execute delegate later in UI thread if this widget will be still available (can be used to modify UI from background thread, or just to postpone execution of action) void executeInUiThread(void delegate() runnable) { if (!window) return; RunnableEvent event = new RunnableEvent(CUSTOM_RUNNABLE, this, runnable); window.postEvent(event); } /// process mouse event; return true if event is processed by widget. bool onMouseEvent(MouseEvent event) { if (mouseEvent.assigned && mouseEvent(this, event)) return true; // processed by external handler //Log.d("onMouseEvent ", id, " ", event.action, " (", event.x, ",", event.y, ")"); // support onClick if (canClick) { if (event.action == MouseAction.ButtonDown && event.button == MouseButton.Left) { setState(State.Pressed); if (canFocus) setFocus(); return true; } if (event.action == MouseAction.ButtonUp && event.button == MouseButton.Left) { resetState(State.Pressed); handleClick(); return true; } if (event.action == MouseAction.FocusOut || event.action == MouseAction.Cancel) { resetState(State.Pressed); resetState(State.Hovered); return true; } if (event.action == MouseAction.FocusIn) { setState(State.Pressed); return true; } } if (event.action == MouseAction.Move && !event.hasModifiers && hasTooltip) { scheduleTooltip(200); } if (event.action == MouseAction.ButtonDown && event.button == MouseButton.Right) { if (canShowPopupMenu(event.x, event.y)) { showPopupMenu(event.x, event.y); return true; } } if (canFocus && event.action == MouseAction.ButtonDown && event.button == MouseButton.Left) { setFocus(); return true; } if (trackHover) { if (event.action == MouseAction.FocusOut || event.action == MouseAction.Cancel) { if ((state & State.Hovered)) { debug(mouse) Log.d("Hover off ", id); resetState(State.Hovered); } return true; } if (event.action == MouseAction.Move) { if (!(state & State.Hovered)) { debug(mouse) Log.d("Hover ", id); if (!TOUCH_MODE) setState(State.Hovered); } return true; } if (event.action == MouseAction.Leave) { debug(mouse) Log.d("Leave ", id); resetState(State.Hovered); return true; } } return false; } // ======================================================= // Signals /// on click event listener (bool delegate(Widget)) Signal!OnClickHandler click; /// checked state change event listener (bool delegate(Widget, bool)) Signal!OnCheckHandler checkChange; /// focus state change event listener (bool delegate(Widget, bool)) Signal!OnFocusHandler focusChange; /// key event listener (bool delegate(Widget, KeyEvent)) - return true if event is processed by handler Signal!OnKeyHandler keyEvent; /// action by key lookup handler Listener!OnKeyActionHandler keyToAction; /// action handlers Signal!OnActionHandler onAction; /// mouse event listener (bool delegate(Widget, MouseEvent)) - return true if event is processed by handler Signal!OnMouseHandler mouseEvent; // Signal utils /// helper function to add onCheckChangeListener in method chain Widget addOnClickListener(bool delegate(Widget) listener) { click.connect(listener); return this; } /// helper function to add onCheckChangeListener in method chain Widget addOnCheckChangeListener(bool delegate(Widget, bool) listener) { checkChange.connect(listener); return this; } /// helper function to add onFocusChangeListener in method chain Widget addOnFocusChangeListener(bool delegate(Widget, bool) listener) { focusChange.connect(listener); return this; } // ======================================================= // Layout and measurement methods /// request relayout of widget and its children void requestLayout() { _needLayout = true; } /// request redraw void invalidate() { _needDraw = true; } /// helper function for implement measure() when widget's content dimensions are known protected void measuredContent(int parentWidth, int parentHeight, int contentWidth, int contentHeight) { if (visibility == Visibility.Gone) { _measuredWidth = _measuredHeight = 0; return; } Rect m = margins; Rect p = padding; // summarize margins, padding, and content size int dx = m.left + m.right + p.left + p.right + contentWidth; int dy = m.top + m.bottom + p.top + p.bottom + contentHeight; // check for fixed size set in layoutWidth, layoutHeight int lh = layoutHeight; int lw = layoutWidth; // constant value support if (!(isPercentSize(lh) || isSpecialSize(lh))) dy = lh.toPixels(); if (!(isPercentSize(lw) || isSpecialSize(lw))) dx = lw.toPixels(); // apply min/max width and height constraints int minw = minWidth; int maxw = maxWidth; int minh = minHeight; int maxh = maxHeight; if (minw != SIZE_UNSPECIFIED && dx < minw) dx = minw; if (minh != SIZE_UNSPECIFIED && dy < minh) dy = minh; if (maxw != SIZE_UNSPECIFIED && dx > maxw) dx = maxw; if (maxh != SIZE_UNSPECIFIED && dy > maxh) dy = maxh; // apply FILL_PARENT //if (parentWidth != SIZE_UNSPECIFIED && layoutWidth == FILL_PARENT) // dx = parentWidth; //if (parentHeight != SIZE_UNSPECIFIED && layoutHeight == FILL_PARENT) // dy = parentHeight; // apply max parent size constraint if (parentWidth != SIZE_UNSPECIFIED && dx > parentWidth) dx = parentWidth; if (parentHeight != SIZE_UNSPECIFIED && dy > parentHeight) dy = parentHeight; _measuredWidth = dx; _measuredHeight = dy; } /** Measure widget according to desired width and height constraints. (Step 1 of two phase layout). */ void measure(int parentWidth, int parentHeight) { measuredContent(parentWidth, parentHeight, 0, 0); } /// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout). void layout(Rect rc) { if (visibility == Visibility.Gone) { return; } _pos = rc; _needLayout = false; } /// draws focus rectangle, if enabled in styles void drawFocusRect(DrawBuf buf, Rect rc) { const uint[] colors = focusRectColors; if (colors) { buf.drawFocusRect(rc, colors); } } /// Draw widget at its position to buffer void onDraw(DrawBuf buf) { if (visibility != Visibility.Visible) return; Rect rc = _pos; applyMargins(rc); auto saver = ClipRectSaver(buf, rc, alpha); DrawableRef bg = backgroundDrawable; if (!bg.isNull) { bg.drawTo(buf, rc, state); } applyPadding(rc); if (state & State.Focused) { rc.expand(FOCUS_RECT_PADDING, FOCUS_RECT_PADDING); drawFocusRect(buf, rc); } _needDraw = false; } /// Helper function: applies margins to rectangle void applyMargins(ref Rect rc) { Rect m = margins; rc.left += m.left; rc.top += m.top; rc.bottom -= m.bottom; rc.right -= m.right; } /// Helper function: applies padding to rectangle void applyPadding(ref Rect rc) { Rect m = padding; rc.left += m.left; rc.top += m.top; rc.bottom -= m.bottom; rc.right -= m.right; } /// Applies alignment for content of size sz - set rectangle rc to aligned value of content inside of initial value of rc. static void applyAlign(ref Rect rc, Point sz, Align ha, Align va) { if (va == Align.Bottom) { rc.top = rc.bottom - sz.y; } else if (va == Align.VCenter) { int dy = (rc.height - sz.y) / 2; rc.top += dy; rc.bottom = rc.top + sz.y; } else { rc.bottom = rc.top + sz.y; } if (ha == Align.Right) { rc.left = rc.right - sz.x; } else if (ha == Align.HCenter) { int dx = (rc.width - sz.x) / 2; rc.left += dx; rc.right = rc.left + sz.x; } else { rc.right = rc.left + sz.x; } } /// Applies alignment for content of size sz - set rectangle rc to aligned value of content inside of initial value of rc. void applyAlign(ref Rect rc, Point sz) { Align va = valign; Align ha = halign; applyAlign(rc, sz, ha, va); } // =========================================================== // popup menu support /// returns true if widget can show popup menu (e.g. by mouse right click at point x,y) bool canShowPopupMenu(int x, int y) { return false; } /// shows popup menu at (x,y) void showPopupMenu(int x, int y) { // override to show popup } /// override to change popup menu items state bool isActionEnabled(const Action action) { return true; } // =========================================================== // Widget hierarhy methods /// returns number of children of this widget @property int childCount() const { return 0; } /// returns child by index inout(Widget) child(int index) inout { return null; } /// adds child, returns added item Widget addChild(Widget item) { assert(false, "addChild: children not suported for this widget type"); } /// adds child, returns added item Widget addChildren(Widget[] items) { foreach(item; items) { addChild(item); } return this; } /// inserts child at given index, returns inserted item Widget insertChild(Widget item, int index) {assert(false, "insertChild: children not suported for this widget type"); } /// removes child, returns removed item Widget removeChild(int index) { assert(false, "removeChild: children not suported for this widget type"); } /// removes child by ID, returns removed item Widget removeChild(string id) { assert(false, "removeChild: children not suported for this widget type"); } /// removes child, returns removed item Widget removeChild(Widget child) { assert(false, "removeChild: children not suported for this widget type"); } /// returns index of widget in child list, -1 if passed widget is not a child of this widget int childIndex(Widget item) { return -1; } /// returns true if item is child of this widget (when deepSearch == true - returns true if item is this widget or one of children inside children tree). bool isChild(Widget item, bool deepSearch = true) { if (deepSearch) { // this widget or some widget inside children tree if (item is this) return true; for (int i = 0; i < childCount; i++) { if (child(i).isChild(item)) return true; } } else { // only one of children for (int i = 0; i < childCount; i++) { if (item is child(i)) return true; } } return false; } /// find child of specified type T by id, returns null if not found or cannot be converted to type T T childById(T = typeof(this))(string id, bool deepSearch = true) { if (deepSearch) { // search everywhere inside child tree if (compareId(id)) { T found = cast(T)this; if (found) return found; } // lookup children for (int i = childCount - 1; i >= 0; i--) { Widget res = child(i).childById(id); if (res !is null) { T found = cast(T)res; if (found) return found; } } } else { // search only across children of this widget for (int i = childCount - 1; i >= 0; i--) { Widget w = child(i); if (id.equal(w.id)) { T found = cast(T)w; if (found) return found; } } } // not found return null; } /// returns parent widget, null for top level widget @property Widget parent() const { return _parent ? cast(Widget)_parent : null; } /// sets parent for widget @property Widget parent(Widget parent) { _parent = parent; return this; } /// returns window (if widget or its parent is attached to window) @property Window window() const { Widget p = cast(Widget)this; while (p !is null) { if (p._window !is null) return cast(Window)p._window; p = p.parent; } return null; } /// sets window (to be used for top level widget from Window implementation). TODO: hide it from API? @property void window(Window window) { _window = window; } void removeAllChildren(bool destroyObj = true) { // override } /// set string property value, for ML loaders bool setStringProperty(string name, string value) { mixin(generatePropertySetters("id", "styleId", "backgroundImageId", "backgroundColor", "textColor", "fontFace")); if (name.equal("text")) { text = UIString.fromId(value); return true; } if (name.equal("tooltipText")) { tooltipText = UIString.fromId(value); return true; } return false; } /// set string property value, for ML loaders bool setDstringProperty(string name, dstring value) { if (name.equal("text")) { text = UIString.fromRaw(value); return true; } if (name.equal("tooltipText")) { tooltipText = UIString.fromRaw(value); return true; } return false; } /// set string property value, for ML loaders bool setUistringProperty(string name, UIString value) { if (name.equal("text")) { text = value; return true; } if (name.equal("tooltipText")) { tooltipText = value; return true; } return false; } /// StringListValue list values bool setStringListValueListProperty(string propName, StringListValue[] values) { return false; } /// UIString list values bool setUIStringListProperty(string propName, UIString[] values) { return false; } /// set string property value, for ML loaders bool setBoolProperty(string name, bool value) { mixin(generatePropertySetters("enabled", "clickable", "checkable", "focusable", "checked", "fontItalic")); return false; } /// set double property value, for ML loaders bool setDoubleProperty(string name, double value) { if (name.equal("alpha")) { int n = cast(int)(value * 255); return setIntProperty(name, n); } return false; } /// set int property value, for ML loaders bool setIntProperty(string name, int value) { if (name.equal("alpha")) { if (value < 0) value = 0; else if (value > 255) value = 255; alpha = cast(ushort)value; return true; } mixin(generatePropertySetters("minWidth", "maxWidth", "minHeight", "maxHeight", "layoutWidth", "layoutHeight", "layoutWeight", "textColor", "backgroundColor", "fontSize", "fontWeight")); if (name.equal("margins")) { // use same value for all sides margins = Rect(value, value, value, value); return true; } if (name.equal("alignment")) { alignment = cast(Align)value; return true; } if (name.equal("padding")) { // use same value for all sides padding = Rect(value, value, value, value); return true; } return false; } /// set Rect property value, for ML loaders bool setRectProperty(string name, Rect value) { mixin(generatePropertySetters("margins", "padding")); return false; } } /** Widget list holder. */ alias WidgetList = ObjectList!Widget; /** Base class for widgets which have children. */ class WidgetGroup : Widget { /// empty parameter list constructor - for usage by factory this() { this(null); } /// create with ID parameter this(string ID) { super(ID); } protected WidgetList _children; /// returns number of children of this widget @property override int childCount() const { return _children.count; } /// returns child by index override inout(Widget) child(int index) inout { return _children.get(index); } /// adds child, returns added item override Widget addChild(Widget item) { return _children.add(item).parent(this); } /// inserts child at given index, returns inserted item override Widget insertChild(Widget item, int index) { return _children.insert(item,index).parent(this); } /// removes child, returns removed item override Widget removeChild(int index) { Widget res = _children.remove(index); if (res !is null) res.parent = null; return res; } /// removes child by ID, returns removed item override Widget removeChild(string ID) { Widget res = null; int index = _children.indexOf(ID); if (index < 0) return null; res = _children.remove(index); if (res !is null) res.parent = null; return res; } /// removes child, returns removed item override Widget removeChild(Widget child) { Widget res = null; int index = _children.indexOf(child); if (index < 0) return null; res = _children.remove(index); if (res !is null) res.parent = null; return res; } /// returns index of widget in child list, -1 if passed widget is not a child of this widget override int childIndex(Widget item) { return _children.indexOf(item); } override void removeAllChildren(bool destroyObj = true) { _children.clear(destroyObj); } /// replace child with other child void replaceChild(Widget newChild, Widget oldChild) { _children.replace(newChild, oldChild); } } /** WidgetGroup with default drawing of children (just draw all children) */ class WidgetGroupDefaultDrawing : WidgetGroup { /// empty parameter list constructor - for usage by factory this() { this(null); } /// create with ID parameter this(string ID) { super(ID); } /// Draw widget at its position to buffer override void onDraw(DrawBuf buf) { if (visibility != Visibility.Visible) return; super.onDraw(buf); Rect rc = _pos; applyMargins(rc); applyPadding(rc); auto saver = ClipRectSaver(buf, rc); for (int i = 0; i < _children.count; i++) { Widget item = _children.get(i); item.onDraw(buf); } } } /// helper for locating items in list, tree, table or other controls by typing their name struct TextTypingShortcutHelper { int timeoutMillis = 800; // expiration time for entered text; after timeout collected text will be cleared private long _lastUpdateTimeStamp; private dchar[] _text; /// cancel text collection (next typed text will be collected from scratch) void cancel() { _text.length = 0; _lastUpdateTimeStamp = 0; } /// returns collected text string - use it for lookup @property dstring text() { return _text.dup; } /// pass key event here; returns true if search text is updated and you can move selection using it bool onKeyEvent(KeyEvent event) { long ts = currentTimeMillis; if (_lastUpdateTimeStamp && ts - _lastUpdateTimeStamp > timeoutMillis) cancel(); if (event.action == KeyAction.Text) { _text ~= event.text; _lastUpdateTimeStamp = ts; return _text.length > 0; } if (event.action == KeyAction.KeyDown || event.action == KeyAction.KeyUp) { switch (event.keyCode) with (KeyCode) { case LEFT: case RIGHT: case UP: case DOWN: case HOME: case END: case TAB: case PAGEUP: case PAGEDOWN: case BACK: cancel(); break; default: break; } } return false; } /// cancel text typing on some mouse events, if necessary void onMouseEvent(MouseEvent event) { if (event.action == MouseAction.ButtonUp || event.action == MouseAction.ButtonDown) cancel(); } } enum ONE_SECOND = 10_000_000L; /// Helper to handle animation progress struct AnimationHelper { private long _timeElapsed; private long _maxInterval; private int _maxProgress; /// start new animation interval void start(long maxInterval, int maxProgress) { _timeElapsed = 0; _maxInterval = maxInterval; _maxProgress = maxProgress; assert(_maxInterval > 0); assert(_maxProgress > 0); } /// Adds elapsed time; returns animation progress in interval 0..maxProgress while timeElapsed is between 0 and maxInterval; when interval exceeded, progress is maxProgress int animate(long time) { _timeElapsed += time; return progress(); } /// restart with same max interval and progress void restart() { if (!_maxInterval) { _maxInterval = ONE_SECOND; } _timeElapsed = 0; } /// returns time elapsed since start @property long elapsed() { return _timeElapsed; } /// get current time interval @property long interval() { return _maxInterval; } /// override current time interval, retaining the same progress % @property void interval(long newInterval) { int p = getProgress(10000); _maxInterval = newInterval; _timeElapsed = p * newInterval / 10000; } /// Returns animation progress in interval 0..maxProgress while timeElapsed is between 0 and maxInterval; when interval exceeded, progress is maxProgress @property int progress() { return getProgress(_maxProgress); } /// Returns animation progress in interval 0..maxProgress while timeElapsed is between 0 and maxInterval; when interval exceeded, progress is maxProgress int getProgress(int maxProgress) { if (finished) return maxProgress; if (_timeElapsed <= 0) return 0; return cast(int)(_timeElapsed * maxProgress / _maxInterval); } /// Returns true if animation is finished @property bool finished() { return _timeElapsed >= _maxInterval; } } /// mixin this to widget class to support tooltips based on widget's action label mixin template ActionTooltipSupport() { /// returns true if widget has tooltip to show override @property bool hasTooltip() { if (!_action || _action.labelValue.empty) return false; return true; } /// will be called from window once tooltip request timer expired; if null is returned, popup will not be shown; you can change alignment and position of popup here override Widget createTooltip(int mouseX, int mouseY, ref uint alignment, ref int x, ref int y) { Widget res = new TextWidget("tooltip", _action.tooltipText); res.styleId = STYLE_TOOLTIP; return res; } } /// use in mixin to set this object property with name propName with value of variable value if variable name matches propName string generatePropertySetter(string propName) { return " if (name.equal(\"" ~ propName ~ "\")) { \n" ~ " " ~ propName ~ " = value;\n" ~ " return true;\n" ~ " }\n"; } /// use in mixin to set this object properties with names from parameter list with value of variable value if variable name matches propName string generatePropertySetters(string[] propNames...) { string res; foreach(propName; propNames) res ~= generatePropertySetter(propName); return res; } /// use in mixin for method override to set this object properties with names from parameter list with value of variable value if variable name matches propName string generatePropertySettersMethodOverride(string methodName, string typeName, string[] propNames...) { string res = " override bool " ~ methodName ~ "(string name, " ~ typeName ~ " value) {\n" ~ " import std.algorithm : equal;\n"; foreach(propName; propNames) res ~= generatePropertySetter(propName); res ~= " return super." ~ methodName ~ "(name, value);\n" ~ " }\n"; return res; } __gshared bool TOUCH_MODE = false;
D
/home/jonas/Ocean-Engine/target/rls/debug/build/memoffset-1a2092ef6a18ea7b/build_script_build-1a2092ef6a18ea7b: /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/memoffset-0.6.4/build.rs /home/jonas/Ocean-Engine/target/rls/debug/build/memoffset-1a2092ef6a18ea7b/build_script_build-1a2092ef6a18ea7b.d: /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/memoffset-0.6.4/build.rs /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/memoffset-0.6.4/build.rs:
D
module dlex; public import dlex.DLex, dlex.Rule;
D
module arc.gfx.batch; import std.algorithm.comparison : min, max; import std.stdio; import std.format; import bindbc.opengl; import arc.gfx.shader_program; import arc.gfx.buffers; import arc.gfx.texture; import arc.gfx.mesh; import arc.color; import arc.core; import arc.math; string vs = " #version 330 in vec4 a_position; in vec4 a_color; in vec2 a_texCoord0; uniform mat4 u_proj; uniform mat4 u_trans; out vec4 v_color; out vec2 v_texCoords; void main() { v_color = a_color; v_color.a = v_color.a * (255.0/254.0); v_texCoords = a_texCoord0; gl_Position = u_proj * u_trans * a_position; } "; string fs = " #version 330 in vec4 v_color; in vec2 v_texCoords; uniform sampler2D u_texture; out vec4 f_color; void main() { f_color = v_color * texture2D(u_texture, v_texCoords); } "; public class SpriteBatch { private Mesh _mesh; private float[] _vertices; private int _idx; private Texture2D _lastTexture; private float _invTexWidth; private float _invTexHeight; private bool _drawing; private Mat4 _transformMatrix = Mat4.identity(); private Mat4 _projectionMatrix = Mat4.identity(); private bool _blendingDisabled; private int _blendSrcFunc = GL_SRC_ALPHA; private int _blendDstFunc = GL_ONE_MINUS_SRC_ALPHA; private int _blendSrcFuncAlpha = GL_SRC_ALPHA; private int _blendDstFuncAlpha = GL_ONE_MINUS_SRC_ALPHA; private ShaderProgram _shader; private ShaderProgram _customShader; private bool _ownsShader; private Color _color = Color.WHITE; public int renderCalls = 0; public int totalRenderCalls = 0; public int maxSpritesInBatch = 0; public this(int size = 1000, ShaderProgram defaultShader = null) { assert(size < 8191, "spritebatch too big"); _mesh = new Mesh(false, size * 4, size * 6, new VertexAttribute(Usage.Position, 2, "a_position"), new VertexAttribute(Usage.ColorPacked, 4, "a_color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoord0")); _projectionMatrix = Mat4.createOrthographicOffCenter(0f, 0f, Core.graphics.getWidth(), Core.graphics.getHeight()); _vertices.length = size * 20; for (int i = 0; i < _vertices.length; i++) _vertices[i] = 0f; int len = size * 6; short[] indices; indices.length = len; short j = 0; for (int i = 0; i < len; i += 6, j += 4) { indices[i] = j; indices[i + 1] = cast(short)(j + 1); indices[i + 2] = cast(short)(j + 2); indices[i + 3] = cast(short)(j + 2); indices[i + 4] = cast(short)(j + 3); indices[i + 5] = cast(short) j; } _mesh.setIndices(indices); if (defaultShader is null) { _shader = new ShaderProgram(vs, fs); assert(_shader.isCompiled(), _shader.getLog()); _ownsShader = true; } else _shader = defaultShader; } public void setProjectionMatrix(Mat4 projection) { assert(!_drawing, "must call end"); _projectionMatrix = projection; } public void begin() { assert(!_drawing, "must call end"); renderCalls = 0; glDepthMask(GL_FALSE); if (_customShader !is null) _customShader.begin(); else _shader.begin(); setupMatrices(); _drawing = true; } public void end() { assert(_drawing, "must call begin"); if (_idx > 0) flush(); _lastTexture = null; _drawing = false; glDepthMask(GL_TRUE); if (isBlendingEnabled()) glDisable(GL_BLEND); if (_customShader !is null) _customShader.end(); else _shader.end(); } public void flush() { if (_idx == 0) return; renderCalls++; totalRenderCalls++; int spritesInBatch = _idx / 20; if (spritesInBatch > maxSpritesInBatch) maxSpritesInBatch = spritesInBatch; int count = spritesInBatch * 6; _lastTexture.bind(); _mesh.setVertices(_vertices, 0, _idx); if (_blendingDisabled) { glDisable(GL_BLEND); } else { glEnable(GL_BLEND); if (_blendSrcFunc != -1) glBlendFuncSeparate(_blendSrcFunc, _blendDstFunc, _blendSrcFuncAlpha, _blendDstFuncAlpha); } _mesh.render(_customShader !is null ? _customShader : _shader, GL_TRIANGLES, 0, count, true); _idx = 0; } private void setupMatrices() { if (_customShader !is null) { _customShader.setUniformMat4("u_proj", _projectionMatrix); _customShader.setUniformMat4("u_trans", _transformMatrix); _customShader.setUniformi("u_texture", 0); } else { _shader.setUniformMat4("u_proj", _projectionMatrix); _shader.setUniformMat4("u_trans", _transformMatrix); _shader.setUniformi("u_texture", 0); } } private void switchTexture(Texture2D texture) { flush(); _lastTexture = texture; _invTexWidth = 1.0f / texture.getWidth(); _invTexHeight = 1.0f / texture.getHeight(); } public void draw(Texture2D texture, float x, float y, float width, float height) { assert(_drawing, "must call begin"); if (texture != _lastTexture) switchTexture(texture); else if (_idx == _vertices.length) // flush(); float fx2 = x + width; float fy2 = y + height; float u = 0; float v = 1; float u2 = 1; float v2 = 0; float color = _color.toFloatBits(); int idx = _idx; _vertices[idx] = x; _vertices[idx + 1] = y; _vertices[idx + 2] = color; _vertices[idx + 3] = u; _vertices[idx + 4] = v; _vertices[idx + 5] = x; _vertices[idx + 6] = fy2; _vertices[idx + 7] = color; _vertices[idx + 8] = u; _vertices[idx + 9] = v2; _vertices[idx + 10] = fx2; _vertices[idx + 11] = fy2; _vertices[idx + 12] = color; _vertices[idx + 13] = u2; _vertices[idx + 14] = v2; _vertices[idx + 15] = fx2; _vertices[idx + 16] = y; _vertices[idx + 17] = color; _vertices[idx + 18] = u2; _vertices[idx + 19] = v; _idx = idx + 20; } public void draw(Texture2D texture, float[] v, int offset, int count) { assert(_drawing, "must call begin"); int verticesLength = cast(int) _vertices.length; int remainingVertices = verticesLength; if (texture != _lastTexture) switchTexture(texture); else { remainingVertices -= _idx; if (remainingVertices == 0) { flush(); remainingVertices = verticesLength; } } int copyCount = min(remainingVertices, count); // arraycopy(Object src, int srcPos, Object dest, int destPos, int length) // arraycopy(v, offset, vertices, idx, copyCount); _vertices[_idx .. copyCount] = v[offset .. copyCount]; _idx += copyCount; count -= copyCount; while (count > 0) { offset += copyCount; flush(); copyCount = min(verticesLength, count); // arraycopy(Object src, int srcPos, Object dest, int destPos, int length) // arraycopy(v, offset, vertices, 0, copyCount); _vertices[0 .. copyCount] = v[offset .. copyCount]; _idx += copyCount; count -= copyCount; } } public bool isBlendingEnabled() { return !_blendingDisabled; } }
D
/home/merzouk/COURS_ESGI/RUST/project/RustProject4IABD/raytracer/app/target/debug/build/rayon-4aa20dcdb5a0ee46/build_script_build-4aa20dcdb5a0ee46: /home/merzouk/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.3.1/build.rs /home/merzouk/COURS_ESGI/RUST/project/RustProject4IABD/raytracer/app/target/debug/build/rayon-4aa20dcdb5a0ee46/build_script_build-4aa20dcdb5a0ee46.d: /home/merzouk/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.3.1/build.rs /home/merzouk/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.3.1/build.rs:
D
/** * Defines the bulk of the classes which represent the AST at the expression level. * * Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions) * * Copyright: Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 http://www.digitalmars.com, Walter Bright) * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/expression.d, _expression.d) * Documentation: https://dlang.org/phobos/dmd_expression.html * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/expression.d */ module dmd.expression; import core.stdc.stdarg; import core.stdc.stdio; import core.stdc.string; import dmd.aggregate; import dmd.aliasthis; import dmd.apply; import dmd.arrayop; import dmd.arraytypes; import dmd.ast_node; import dmd.gluelayer; import dmd.canthrow; import dmd.complex; import dmd.constfold; import dmd.ctfeexpr; import dmd.ctorflow; import dmd.dcast; import dmd.dclass; import dmd.declaration; import dmd.delegatize; import dmd.dimport; import dmd.dinterpret; import dmd.dmodule; import dmd.dscope; import dmd.dstruct; import dmd.dsymbol; import dmd.dsymbolsem; import dmd.dtemplate; import dmd.errors; import dmd.escape; import dmd.expressionsem; import dmd.func; import dmd.globals; import dmd.hdrgen; import dmd.id; import dmd.identifier; import dmd.inline; import dmd.mtype; import dmd.nspace; import dmd.objc; import dmd.opover; import dmd.optimize; import dmd.root.ctfloat; import dmd.root.filename; import dmd.root.outbuffer; import dmd.root.rmem; import dmd.root.rootobject; import dmd.root.string; import dmd.safe; import dmd.sideeffect; import dmd.target; import dmd.tokens; import dmd.typesem; import dmd.utf; import dmd.visitor; enum LOGSEMANTIC = false; void emplaceExp(T : Expression, Args...)(void* p, Args args) { scope tmp = new T(args); memcpy(p, cast(void*)tmp, __traits(classInstanceSize, T)); } void emplaceExp(T : UnionExp)(T* p, Expression e) { memcpy(p, cast(void*)e, e.size); } // Return value for `checkModifiable` enum Modifiable { /// Not modifiable no, /// Modifiable (the type is mutable) yes, /// Modifiable because it is initialization initialization, } /**************************************** * Find the first non-comma expression. * Params: * e = Expressions connected by commas * Returns: * left-most non-comma expression */ inout(Expression) firstComma(inout Expression e) { Expression ex = cast()e; while (ex.op == TOK.comma) ex = (cast(CommaExp)ex).e1; return cast(inout)ex; } /**************************************** * Find the last non-comma expression. * Params: * e = Expressions connected by commas * Returns: * right-most non-comma expression */ inout(Expression) lastComma(inout Expression e) { Expression ex = cast()e; while (ex.op == TOK.comma) ex = (cast(CommaExp)ex).e2; return cast(inout)ex; } /***************************************** * Determine if `this` is available by walking up the enclosing * scopes until a function is found. * * Params: * sc = where to start looking for the enclosing function * Returns: * Found function if it satisfies `isThis()`, otherwise `null` */ FuncDeclaration hasThis(Scope* sc) { //printf("hasThis()\n"); Dsymbol p = sc.parent; while (p && p.isTemplateMixin()) p = p.parent; FuncDeclaration fdthis = p ? p.isFuncDeclaration() : null; //printf("fdthis = %p, '%s'\n", fdthis, fdthis ? fdthis.toChars() : ""); // Go upwards until we find the enclosing member function FuncDeclaration fd = fdthis; while (1) { if (!fd) { return null; } if (!fd.isNested() || fd.isThis() || (fd.isThis2 && fd.isMember2())) break; Dsymbol parent = fd.parent; while (1) { if (!parent) return null; TemplateInstance ti = parent.isTemplateInstance(); if (ti) parent = ti.parent; else break; } fd = parent.isFuncDeclaration(); } if (!fd.isThis() && !(fd.isThis2 && fd.isMember2())) { return null; } assert(fd.vthis); return fd; } /*********************************** * Determine if a `this` is needed to access `d`. * Params: * sc = context * d = declaration to check * Returns: * true means a `this` is needed */ bool isNeedThisScope(Scope* sc, Declaration d) { if (sc.intypeof == 1) return false; AggregateDeclaration ad = d.isThis(); if (!ad) return false; //printf("d = %s, ad = %s\n", d.toChars(), ad.toChars()); for (Dsymbol s = sc.parent; s; s = s.toParentLocal()) { //printf("\ts = %s %s, toParent2() = %p\n", s.kind(), s.toChars(), s.toParent2()); if (AggregateDeclaration ad2 = s.isAggregateDeclaration()) { if (ad2 == ad) return false; else if (ad2.isNested()) continue; else return true; } if (FuncDeclaration f = s.isFuncDeclaration()) { if (f.isMemberLocal()) break; } } return true; } /****************************** * check e is exp.opDispatch!(tiargs) or not * It's used to switch to UFCS the semantic analysis path */ bool isDotOpDispatch(Expression e) { if (auto dtie = e.isDotTemplateInstanceExp()) return dtie.ti.name == Id.opDispatch; return false; } /**************************************** * Expand tuples. * Input: * exps aray of Expressions * Output: * exps rewritten in place */ extern (C++) void expandTuples(Expressions* exps) { //printf("expandTuples()\n"); if (exps is null) return; for (size_t i = 0; i < exps.dim; i++) { Expression arg = (*exps)[i]; if (!arg) continue; // Look for tuple with 0 members if (auto e = arg.isTypeExp()) { if (auto tt = e.type.toBasetype().isTypeTuple()) { if (!tt.arguments || tt.arguments.dim == 0) { exps.remove(i); if (i == exps.dim) return; } else // Expand a TypeTuple { exps.remove(i); auto texps = new Expressions(tt.arguments.length); foreach (j, a; *tt.arguments) (*texps)[j] = new TypeExp(e.loc, a.type); exps.insert(i, texps); } i--; continue; } } // Inline expand all the tuples while (arg.op == TOK.tuple) { TupleExp te = cast(TupleExp)arg; exps.remove(i); // remove arg exps.insert(i, te.exps); // replace with tuple contents if (i == exps.dim) return; // empty tuple, no more arguments (*exps)[i] = Expression.combine(te.e0, (*exps)[i]); arg = (*exps)[i]; } } } /**************************************** * Expand alias this tuples. */ TupleDeclaration isAliasThisTuple(Expression e) { if (!e.type) return null; Type t = e.type.toBasetype(); while (true) { if (Dsymbol s = t.toDsymbol(null)) { if (auto ad = s.isAggregateDeclaration()) { s = ad.aliasthis ? ad.aliasthis.sym : null; if (s && s.isVarDeclaration()) { TupleDeclaration td = s.isVarDeclaration().toAlias().isTupleDeclaration(); if (td && td.isexp) return td; } if (Type att = t.aliasthisOf()) { t = att; continue; } } } return null; } } int expandAliasThisTuples(Expressions* exps, size_t starti = 0) { if (!exps || exps.dim == 0) return -1; for (size_t u = starti; u < exps.dim; u++) { Expression exp = (*exps)[u]; if (TupleDeclaration td = exp.isAliasThisTuple) { exps.remove(u); foreach (i, o; *td.objects) { auto d = o.isExpression().isDsymbolExp().s.isDeclaration(); auto e = new DotVarExp(exp.loc, exp, d); assert(d.type); e.type = d.type; exps.insert(u + i, e); } version (none) { printf("expansion ->\n"); foreach (e; exps) { printf("\texps[%d] e = %s %s\n", i, Token.tochars[e.op], e.toChars()); } } return cast(int)u; } } return -1; } /**************************************** * If `s` is a function template, i.e. the only member of a template * and that member is a function, return that template. * Params: * s = symbol that might be a function template * Returns: * template for that function, otherwise null */ TemplateDeclaration getFuncTemplateDecl(Dsymbol s) { FuncDeclaration f = s.isFuncDeclaration(); if (f && f.parent) { if (auto ti = f.parent.isTemplateInstance()) { if (!ti.isTemplateMixin() && ti.tempdecl) { auto td = ti.tempdecl.isTemplateDeclaration(); if (td.onemember && td.ident == f.ident) { return td; } } } } return null; } /************************************************ * If we want the value of this expression, but do not want to call * the destructor on it. */ Expression valueNoDtor(Expression e) { auto ex = lastComma(e); if (auto ce = ex.isCallExp()) { /* The struct value returned from the function is transferred * so do not call the destructor on it. * Recognize: * ((S _ctmp = S.init), _ctmp).this(...) * and make sure the destructor is not called on _ctmp * BUG: if ex is a CommaExp, we should go down the right side. */ if (auto dve = ce.e1.isDotVarExp()) { if (dve.var.isCtorDeclaration()) { // It's a constructor call if (auto comma = dve.e1.isCommaExp()) { if (auto ve = comma.e2.isVarExp()) { VarDeclaration ctmp = ve.var.isVarDeclaration(); if (ctmp) { ctmp.storage_class |= STC.nodtor; assert(!ce.isLvalue()); } } } } } } else if (auto ve = ex.isVarExp()) { auto vtmp = ve.var.isVarDeclaration(); if (vtmp && (vtmp.storage_class & STC.rvalue)) { vtmp.storage_class |= STC.nodtor; } } return e; } /********************************************* * If e is an instance of a struct, and that struct has a copy constructor, * rewrite e as: * (tmp = e),tmp * Input: * sc = just used to specify the scope of created temporary variable * destinationType = the type of the object on which the copy constructor is called; * may be null if the struct defines a postblit */ private Expression callCpCtor(Scope* sc, Expression e, Type destinationType) { if (auto ts = e.type.baseElemOf().isTypeStruct()) { StructDeclaration sd = ts.sym; if (sd.postblit || sd.hasCopyCtor) { /* Create a variable tmp, and replace the argument e with: * (tmp = e),tmp * and let AssignExp() handle the construction. * This is not the most efficient, ideally tmp would be constructed * directly onto the stack. */ auto tmp = copyToTemp(STC.rvalue, "__copytmp", e); if (sd.hasCopyCtor && destinationType) tmp.type = destinationType; tmp.storage_class |= STC.nodtor; tmp.dsymbolSemantic(sc); Expression de = new DeclarationExp(e.loc, tmp); Expression ve = new VarExp(e.loc, tmp); de.type = Type.tvoid; ve.type = e.type; return Expression.combine(de, ve); } } return e; } /************************************************ * Handle the postblit call on lvalue, or the move of rvalue. * * Params: * sc = the scope where the expression is encountered * e = the expression the needs to be moved or copied (source) * t = if the struct defines a copy constructor, the type of the destination * * Returns: * The expression that copy constructs or moves the value. */ extern (D) Expression doCopyOrMove(Scope *sc, Expression e, Type t = null) { if (auto ce = e.isCondExp()) { ce.e1 = doCopyOrMove(sc, ce.e1); ce.e2 = doCopyOrMove(sc, ce.e2); } else { e = e.isLvalue() ? callCpCtor(sc, e, t) : valueNoDtor(e); } return e; } /****************************************************************/ /* A type meant as a union of all the Expression types, * to serve essentially as a Variant that will sit on the stack * during CTFE to reduce memory consumption. */ extern (C++) struct UnionExp { // yes, default constructor does nothing extern (D) this(Expression e) { memcpy(&this, cast(void*)e, e.size); } /* Extract pointer to Expression */ extern (C++) Expression exp() return { return cast(Expression)&u; } /* Convert to an allocated Expression */ extern (C++) Expression copy() { Expression e = exp(); //if (e.size > sizeof(u)) printf("%s\n", Token::toChars(e.op)); assert(e.size <= u.sizeof); switch (e.op) { case TOK.cantExpression: return CTFEExp.cantexp; case TOK.voidExpression: return CTFEExp.voidexp; case TOK.break_: return CTFEExp.breakexp; case TOK.continue_: return CTFEExp.continueexp; case TOK.goto_: return CTFEExp.gotoexp; default: return e.copy(); } } private: // Ensure that the union is suitably aligned. align(8) union __AnonStruct__u { char[__traits(classInstanceSize, Expression)] exp; char[__traits(classInstanceSize, IntegerExp)] integerexp; char[__traits(classInstanceSize, ErrorExp)] errorexp; char[__traits(classInstanceSize, RealExp)] realexp; char[__traits(classInstanceSize, ComplexExp)] complexexp; char[__traits(classInstanceSize, SymOffExp)] symoffexp; char[__traits(classInstanceSize, StringExp)] stringexp; char[__traits(classInstanceSize, ArrayLiteralExp)] arrayliteralexp; char[__traits(classInstanceSize, AssocArrayLiteralExp)] assocarrayliteralexp; char[__traits(classInstanceSize, StructLiteralExp)] structliteralexp; char[__traits(classInstanceSize, NullExp)] nullexp; char[__traits(classInstanceSize, DotVarExp)] dotvarexp; char[__traits(classInstanceSize, AddrExp)] addrexp; char[__traits(classInstanceSize, IndexExp)] indexexp; char[__traits(classInstanceSize, SliceExp)] sliceexp; char[__traits(classInstanceSize, VectorExp)] vectorexp; } __AnonStruct__u u; } /******************************** * Test to see if two reals are the same. * Regard NaN's as equivalent. * Regard +0 and -0 as different. * Params: * x1 = first operand * x2 = second operand * Returns: * true if x1 is x2 * else false */ bool RealIdentical(real_t x1, real_t x2) { return (CTFloat.isNaN(x1) && CTFloat.isNaN(x2)) || CTFloat.isIdentical(x1, x2); } /************************ TypeDotIdExp ************************************/ /* Things like: * int.size * foo.size * (foo).size * cast(foo).size */ DotIdExp typeDotIdExp(const ref Loc loc, Type type, Identifier ident) { return new DotIdExp(loc, new TypeExp(loc, type), ident); } /*************************************************** * Given an Expression, find the variable it really is. * * For example, `a[index]` is really `a`, and `s.f` is really `s`. * Params: * e = Expression to look at * Returns: * variable if there is one, null if not */ VarDeclaration expToVariable(Expression e) { while (1) { switch (e.op) { case TOK.variable: return (cast(VarExp)e).var.isVarDeclaration(); case TOK.dotVariable: e = (cast(DotVarExp)e).e1; continue; case TOK.index: { IndexExp ei = cast(IndexExp)e; e = ei.e1; Type ti = e.type.toBasetype(); if (ti.ty == Tsarray) continue; return null; } case TOK.slice: { SliceExp ei = cast(SliceExp)e; e = ei.e1; Type ti = e.type.toBasetype(); if (ti.ty == Tsarray) continue; return null; } case TOK.this_: case TOK.super_: return (cast(ThisExp)e).var.isVarDeclaration(); default: return null; } } } enum OwnedBy : ubyte { code, // normal code expression in AST ctfe, // value expression for CTFE cache, // constant value cached for CTFE } enum WANTvalue = 0; // default enum WANTexpand = 1; // expand const/immutable variables if possible /*********************************************************** * http://dlang.org/spec/expression.html#expression */ extern (C++) abstract class Expression : ASTNode { const TOK op; // to minimize use of dynamic_cast ubyte size; // # of bytes in Expression so we can copy() it ubyte parens; // if this is a parenthesized expression Type type; // !=null means that semantic() has been run Loc loc; // file location extern (D) this(const ref Loc loc, TOK op, int size) { //printf("Expression::Expression(op = %d) this = %p\n", op, this); this.loc = loc; this.op = op; this.size = cast(ubyte)size; } static void _init() { CTFEExp.cantexp = new CTFEExp(TOK.cantExpression); CTFEExp.voidexp = new CTFEExp(TOK.voidExpression); CTFEExp.breakexp = new CTFEExp(TOK.break_); CTFEExp.continueexp = new CTFEExp(TOK.continue_); CTFEExp.gotoexp = new CTFEExp(TOK.goto_); CTFEExp.showcontext = new CTFEExp(TOK.showCtfeContext); } /** * 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() { CTFEExp.cantexp = CTFEExp.cantexp.init; CTFEExp.voidexp = CTFEExp.voidexp.init; CTFEExp.breakexp = CTFEExp.breakexp.init; CTFEExp.continueexp = CTFEExp.continueexp.init; CTFEExp.gotoexp = CTFEExp.gotoexp.init; CTFEExp.showcontext = CTFEExp.showcontext.init; } /********************************* * Does *not* do a deep copy. */ final Expression copy() { Expression e; if (!size) { debug { fprintf(stderr, "No expression copy for: %s\n", toChars()); printf("op = %d\n", op); } assert(0); } // memory never freed, so can use the faster bump-pointer-allocation e = cast(Expression)allocmemory(size); //printf("Expression::copy(op = %d) e = %p\n", op, e); return cast(Expression)memcpy(cast(void*)e, cast(void*)this, size); } Expression syntaxCopy() { //printf("Expression::syntaxCopy()\n"); //print(); return copy(); } // kludge for template.isExpression() override final DYNCAST dyncast() const { return DYNCAST.expression; } override const(char)* toChars() const { OutBuffer buf; HdrGenState hgs; toCBuffer(this, &buf, &hgs); return buf.extractChars(); } static if (__VERSION__ < 2092) { final void error(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .verror(loc, format, ap); va_end(ap); } } final void errorSupplemental(const(char)* format, ...) { if (type == Type.terror) return; va_list ap; va_start(ap, format); .verrorSupplemental(loc, format, ap); va_end(ap); } final void warning(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .vwarning(loc, format, ap); va_end(ap); } } final void deprecation(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .vdeprecation(loc, format, ap); va_end(ap); } } } else { pragma(printf) final void error(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .verror(loc, format, ap); va_end(ap); } } pragma(printf) final void errorSupplemental(const(char)* format, ...) { if (type == Type.terror) return; va_list ap; va_start(ap, format); .verrorSupplemental(loc, format, ap); va_end(ap); } pragma(printf) final void warning(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .vwarning(loc, format, ap); va_end(ap); } } pragma(printf) final void deprecation(const(char)* format, ...) const { if (type != Type.terror) { va_list ap; va_start(ap, format); .vdeprecation(loc, format, ap); va_end(ap); } } } /********************************** * Combine e1 and e2 by CommaExp if both are not NULL. */ extern (D) static Expression combine(Expression e1, Expression e2) { if (e1) { if (e2) { e1 = new CommaExp(e1.loc, e1, e2); e1.type = e2.type; } } else e1 = e2; return e1; } extern (D) static Expression combine(Expression e1, Expression e2, Expression e3) { return combine(combine(e1, e2), e3); } extern (D) static Expression combine(Expression e1, Expression e2, Expression e3, Expression e4) { return combine(combine(e1, e2), combine(e3, e4)); } /********************************** * If 'e' is a tree of commas, returns the rightmost expression * by stripping off it from the tree. The remained part of the tree * is returned via e0. * Otherwise 'e' is directly returned and e0 is set to NULL. */ extern (D) static Expression extractLast(Expression e, out Expression e0) { if (e.op != TOK.comma) { return e; } CommaExp ce = cast(CommaExp)e; if (ce.e2.op != TOK.comma) { e0 = ce.e1; return ce.e2; } else { e0 = e; Expression* pce = &ce.e2; while ((cast(CommaExp)(*pce)).e2.op == TOK.comma) { pce = &(cast(CommaExp)(*pce)).e2; } assert((*pce).op == TOK.comma); ce = cast(CommaExp)(*pce); *pce = ce.e1; return ce.e2; } } extern (D) static Expressions* arraySyntaxCopy(Expressions* exps) { Expressions* a = null; if (exps) { a = new Expressions(exps.dim); foreach (i, e; *exps) { (*a)[i] = e ? e.syntaxCopy() : null; } } return a; } dinteger_t toInteger() { //printf("Expression %s\n", Token::toChars(op)); error("integer constant expression expected instead of `%s`", toChars()); return 0; } uinteger_t toUInteger() { //printf("Expression %s\n", Token::toChars(op)); return cast(uinteger_t)toInteger(); } real_t toReal() { error("floating point constant expression expected instead of `%s`", toChars()); return CTFloat.zero; } real_t toImaginary() { error("floating point constant expression expected instead of `%s`", toChars()); return CTFloat.zero; } complex_t toComplex() { error("floating point constant expression expected instead of `%s`", toChars()); return complex_t(CTFloat.zero); } StringExp toStringExp() { return null; } TupleExp toTupleExp() { return null; } /*************************************** * Return !=0 if expression is an lvalue. */ bool isLvalue() { return false; } /******************************* * Give error if we're not an lvalue. * If we can, convert expression to be an lvalue. */ Expression toLvalue(Scope* sc, Expression e) { if (!e) e = this; else if (!loc.isValid()) loc = e.loc; if (e.op == TOK.type) error("`%s` is a `%s` definition and cannot be modified", e.type.toChars(), e.type.kind()); else error("`%s` is not an lvalue and cannot be modified", e.toChars()); return ErrorExp.get(); } Expression modifiableLvalue(Scope* sc, Expression e) { //printf("Expression::modifiableLvalue() %s, type = %s\n", toChars(), type.toChars()); // See if this expression is a modifiable lvalue (i.e. not const) if (checkModifiable(sc) == Modifiable.yes) { assert(type); if (!type.isMutable()) { if (auto dve = this.isDotVarExp()) { if (isNeedThisScope(sc, dve.var)) for (Dsymbol s = sc.func; s; s = s.toParentLocal()) { FuncDeclaration ff = s.isFuncDeclaration(); if (!ff) break; if (!ff.type.isMutable) { error("cannot modify `%s` in `%s` function", toChars(), MODtoChars(type.mod)); return ErrorExp.get(); } } } error("cannot modify `%s` expression `%s`", MODtoChars(type.mod), toChars()); return ErrorExp.get(); } else if (!type.isAssignable()) { error("cannot modify struct instance `%s` of type `%s` because it contains `const` or `immutable` members", toChars(), type.toChars()); return ErrorExp.get(); } } return toLvalue(sc, e); } final Expression implicitCastTo(Scope* sc, Type t) { return .implicitCastTo(this, sc, t); } final MATCH implicitConvTo(Type t) { return .implicitConvTo(this, t); } final Expression castTo(Scope* sc, Type t) { return .castTo(this, sc, t); } /**************************************** * Resolve __FILE__, __LINE__, __MODULE__, __FUNCTION__, __PRETTY_FUNCTION__, __FILE_FULL_PATH__ to loc. */ Expression resolveLoc(const ref Loc loc, Scope* sc) { this.loc = loc; return this; } /**************************************** * Check that the expression has a valid type. * If not, generates an error "... has no type". * Returns: * true if the expression is not valid. * Note: * When this function returns true, `checkValue()` should also return true. */ bool checkType() { return false; } /**************************************** * Check that the expression has a valid value. * If not, generates an error "... has no value". * Returns: * true if the expression is not valid or has void type. */ bool checkValue() { if (type && type.toBasetype().ty == Tvoid) { error("expression `%s` is `void` and has no value", toChars()); //print(); assert(0); if (!global.gag) type = Type.terror; return true; } return false; } extern (D) final bool checkScalar() { if (op == TOK.error) return true; if (type.toBasetype().ty == Terror) return true; if (!type.isscalar()) { error("`%s` is not a scalar, it is a `%s`", toChars(), type.toChars()); return true; } return checkValue(); } extern (D) final bool checkNoBool() { if (op == TOK.error) return true; if (type.toBasetype().ty == Terror) return true; if (type.toBasetype().ty == Tbool) { error("operation not allowed on `bool` `%s`", toChars()); return true; } return false; } extern (D) final bool checkIntegral() { if (op == TOK.error) return true; if (type.toBasetype().ty == Terror) return true; if (!type.isintegral()) { error("`%s` is not of integral type, it is a `%s`", toChars(), type.toChars()); return true; } return checkValue(); } extern (D) final bool checkArithmetic() { if (op == TOK.error) return true; if (type.toBasetype().ty == Terror) return true; if (!type.isintegral() && !type.isfloating()) { error("`%s` is not of arithmetic type, it is a `%s`", toChars(), type.toChars()); return true; } return checkValue(); } final bool checkDeprecated(Scope* sc, Dsymbol s) { return s.checkDeprecated(loc, sc); } extern (D) final bool checkDisabled(Scope* sc, Dsymbol s) { if (auto d = s.isDeclaration()) { return d.checkDisabled(loc, sc); } return false; } /********************************************* * Calling function f. * Check the purity, i.e. if we're in a pure function * we can only call other pure functions. * Returns true if error occurs. */ extern (D) final bool checkPurity(Scope* sc, FuncDeclaration f) { if (!sc.func) return false; if (sc.func == f) return false; if (sc.intypeof == 1) return false; if (sc.flags & (SCOPE.ctfe | SCOPE.debug_)) return false; // If the call has a pure parent, then the called func must be pure. if (!f.isPure() && checkImpure(sc)) { error("`pure` %s `%s` cannot call impure %s `%s`", sc.func.kind(), sc.func.toPrettyChars(), f.kind(), f.toPrettyChars()); checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().purity != PURE.impure, "impure"); return true; } return false; } /** * Checks whether `f` is a generated `DtorDeclaration` that hides a user-defined one * which passes `check` while `f` doesn't (e.g. when the user defined dtor is pure but * the generated dtor is not). * In that case the method will identify and print all members causing the attribute * missmatch. * * Params: * sc = scope * f = potential `DtorDeclaration` * check = current check (e.g. whether it's pure) * checkName = the kind of check (e.g. `"pure"`) */ extern (D) final void checkOverridenDtor(Scope* sc, FuncDeclaration f, scope bool function(DtorDeclaration) check, const string checkName ) { auto dd = f.isDtorDeclaration(); if (!dd || !dd.generated) return; // DtorDeclaration without parents should fail at an earlier stage auto ad = cast(AggregateDeclaration) f.toParent2(); assert(ad); assert(ad.dtors.length); // Search for the user-defined destructor (if any) foreach(dtor; ad.dtors) { if (dtor.generated) continue; if (!check(dtor)) // doesn't match check (e.g. is impure as well) return; // Sanity check assert(!check(cast(DtorDeclaration) ad.fieldDtor)); break; } dd.loc.errorSupplemental("%s`%s.~this` is %.*s because of the following field's destructors:", dd.generated ? "generated " : "".ptr, ad.toChars, cast(int) checkName.length, checkName.ptr); // Search for the offending fields foreach (field; ad.fields) { // Only structs may define automatically called destructors auto ts = field.type.isTypeStruct(); if (!ts) { // But they might be part of a static array auto ta = field.type.isTypeSArray(); if (!ta) continue; ts = ta.baseElemOf().isTypeStruct(); if (!ts) continue; } auto fieldSym = ts.toDsymbol(sc); assert(fieldSym); // Resolving ts must succeed because missing defs. should error before auto fieldSd = fieldSym.isStructDeclaration(); assert(fieldSd); // ts is a TypeStruct, this would imply a malformed ASR if (fieldSd.dtor && !check(fieldSd.dtor)) { field.loc.errorSupplemental(" - %s %s", field.type.toChars(), field.toChars()); if (fieldSd.dtor.generated) checkOverridenDtor(sc, fieldSd.dtor, check, checkName); else fieldSd.dtor.loc.errorSupplemental(" %.*s `%s.~this` is declared here", cast(int) checkName.length, checkName.ptr, fieldSd.toChars()); } } } /******************************************* * Accessing variable v. * Check for purity and safety violations. * Returns true if error occurs. */ extern (D) final bool checkPurity(Scope* sc, VarDeclaration v) { //printf("v = %s %s\n", v.type.toChars(), v.toChars()); /* Look for purity and safety violations when accessing variable v * from current function. */ if (!sc.func) return false; if (sc.intypeof == 1) return false; // allow violations inside typeof(expression) if (sc.flags & (SCOPE.ctfe | SCOPE.debug_)) return false; // allow violations inside compile-time evaluated expressions and debug conditionals if (v.ident == Id.ctfe) return false; // magic variable never violates pure and safe if (v.isImmutable()) return false; // always safe and pure to access immutables... if (v.isConst() && !v.isRef() && (v.isDataseg() || v.isParameter()) && v.type.implicitConvTo(v.type.immutableOf())) return false; // or const global/parameter values which have no mutable indirections if (v.storage_class & STC.manifest) return false; // ...or manifest constants // accessing empty structs is pure if (v.type.ty == Tstruct) { StructDeclaration sd = (cast(TypeStruct)v.type).sym; if (sd.members) // not opaque { sd.determineSize(v.loc); if (sd.hasNoFields) return false; } } bool err = false; if (v.isDataseg()) { // https://issues.dlang.org/show_bug.cgi?id=7533 // Accessing implicit generated __gate is pure. if (v.ident == Id.gate) return false; if (checkImpure(sc)) { error("`pure` %s `%s` cannot access mutable static data `%s`", sc.func.kind(), sc.func.toPrettyChars(), v.toChars()); err = true; } } else { /* Given: * void f() { * int fx; * pure void g() { * int gx; * /+pure+/ void h() { * int hx; * /+pure+/ void i() { } * } * } * } * i() can modify hx and gx but not fx */ Dsymbol vparent = v.toParent2(); for (Dsymbol s = sc.func; !err && s; s = s.toParentP(vparent)) { if (s == vparent) break; if (AggregateDeclaration ad = s.isAggregateDeclaration()) { if (ad.isNested()) continue; break; } FuncDeclaration ff = s.isFuncDeclaration(); if (!ff) break; if (ff.isNested() || ff.isThis()) { if (ff.type.isImmutable() || ff.type.isShared() && !MODimplicitConv(ff.type.mod, v.type.mod)) { OutBuffer ffbuf; OutBuffer vbuf; MODMatchToBuffer(&ffbuf, ff.type.mod, v.type.mod); MODMatchToBuffer(&vbuf, v.type.mod, ff.type.mod); error("%s%s `%s` cannot access %sdata `%s`", ffbuf.peekChars(), ff.kind(), ff.toPrettyChars(), vbuf.peekChars(), v.toChars()); err = true; break; } continue; } break; } } /* Do not allow safe functions to access __gshared data */ if (v.storage_class & STC.gshared) { if (sc.func.setUnsafe()) { error("`@safe` %s `%s` cannot access `__gshared` data `%s`", sc.func.kind(), sc.func.toChars(), v.toChars()); err = true; } } return err; } /* Check if sc.func is impure or can be made impure. Returns true on error, i.e. if sc.func is pure and cannot be made impure. */ private static bool checkImpure(Scope* sc) { return sc.func && (sc.flags & SCOPE.compile ? sc.func.isPureBypassingInference() >= PURE.weak : sc.func.setImpure()); } /********************************************* * Calling function f. * Check the safety, i.e. if we're in a @safe function * we can only call @safe or @trusted functions. * Returns true if error occurs. */ extern (D) final bool checkSafety(Scope* sc, FuncDeclaration f) { if (!sc.func) return false; if (sc.func == f) return false; if (sc.intypeof == 1) return false; if (sc.flags & (SCOPE.ctfe | SCOPE.debug_)) return false; if (!f.isSafe() && !f.isTrusted()) { if (sc.flags & SCOPE.compile ? sc.func.isSafeBypassingInference() : sc.func.setUnsafe()) { if (!loc.isValid()) // e.g. implicitly generated dtor loc = sc.func.loc; const prettyChars = f.toPrettyChars(); error("`@safe` %s `%s` cannot call `@system` %s `%s`", sc.func.kind(), sc.func.toPrettyChars(), f.kind(), prettyChars); .errorSupplemental(f.loc, "`%s` is declared here", prettyChars); checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().trust > TRUST.system, "@system"); return true; } } return false; } /********************************************* * Calling function f. * Check the @nogc-ness, i.e. if we're in a @nogc function * we can only call other @nogc functions. * Returns true if error occurs. */ extern (D) final bool checkNogc(Scope* sc, FuncDeclaration f) { if (!sc.func) return false; if (sc.func == f) return false; if (sc.intypeof == 1) return false; if (sc.flags & (SCOPE.ctfe | SCOPE.debug_)) return false; if (!f.isNogc()) { if (sc.flags & SCOPE.compile ? sc.func.isNogcBypassingInference() : sc.func.setGC()) { if (loc.linnum == 0) // e.g. implicitly generated dtor loc = sc.func.loc; // Lowered non-@nogc'd hooks will print their own error message inside of nogc.d (NOGCVisitor.visit(CallExp e)), // so don't print anything to avoid double error messages. if (!(f.ident == Id._d_HookTraceImpl || f.ident == Id._d_arraysetlengthT)) error("`@nogc` %s `%s` cannot call non-@nogc %s `%s`", sc.func.kind(), sc.func.toPrettyChars(), f.kind(), f.toPrettyChars()); checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().isnogc, "non-@nogc"); return true; } } return false; } /******************************************** * Check that the postblit is callable if t is an array of structs. * Returns true if error happens. */ extern (D) final bool checkPostblit(Scope* sc, Type t) { if (auto ts = t.baseElemOf().isTypeStruct()) { if (global.params.useTypeInfo) { // https://issues.dlang.org/show_bug.cgi?id=11395 // Require TypeInfo generation for array concatenation semanticTypeInfo(sc, t); } StructDeclaration sd = ts.sym; if (sd.postblit) { if (sd.postblit.checkDisabled(loc, sc)) return true; //checkDeprecated(sc, sd.postblit); // necessary? checkPurity(sc, sd.postblit); checkSafety(sc, sd.postblit); checkNogc(sc, sd.postblit); //checkAccess(sd, loc, sc, sd.postblit); // necessary? return false; } } return false; } extern (D) final bool checkRightThis(Scope* sc) { if (op == TOK.error) return true; if (op == TOK.variable && type.ty != Terror) { VarExp ve = cast(VarExp)this; if (isNeedThisScope(sc, ve.var)) { //printf("checkRightThis sc.intypeof = %d, ad = %p, func = %p, fdthis = %p\n", // sc.intypeof, sc.getStructClassScope(), func, fdthis); error("need `this` for `%s` of type `%s`", ve.var.toChars(), ve.var.type.toChars()); return true; } } return false; } /******************************* * Check whether the expression allows RMW operations, error with rmw operator diagnostic if not. * ex is the RHS expression, or NULL if ++/-- is used (for diagnostics) * Returns true if error occurs. */ extern (D) final bool checkReadModifyWrite(TOK rmwOp, Expression ex = null) { //printf("Expression::checkReadModifyWrite() %s %s", toChars(), ex ? ex.toChars() : ""); if (!type || !type.isShared() || type.isTypeStruct() || type.isTypeClass()) return false; // atomicOp uses opAssign (+=/-=) rather than opOp (++/--) for the CT string literal. switch (rmwOp) { case TOK.plusPlus: case TOK.prePlusPlus: rmwOp = TOK.addAssign; break; case TOK.minusMinus: case TOK.preMinusMinus: rmwOp = TOK.minAssign; break; default: break; } error("read-modify-write operations are not allowed for `shared` variables"); errorSupplemental("Use `core.atomic.atomicOp!\"%s\"(%s, %s)` instead", Token.toChars(rmwOp), toChars(), ex ? ex.toChars() : "1"); return true; } /*************************************** * Parameters: * sc: scope * flag: 1: do not issue error message for invalid modification * Returns: * Whether the type is modifiable */ Modifiable checkModifiable(Scope* sc, int flag = 0) { return type ? Modifiable.yes : Modifiable.no; // default modifiable } /***************************** * If expression can be tested for true or false, * returns the modified expression. * Otherwise returns ErrorExp. */ Expression toBoolean(Scope* sc) { // Default is 'yes' - do nothing Expression e = this; Type t = type; Type tb = type.toBasetype(); Type att = null; while (1) { // Structs can be converted to bool using opCast(bool)() if (auto ts = tb.isTypeStruct()) { AggregateDeclaration ad = ts.sym; /* Don't really need to check for opCast first, but by doing so we * get better error messages if it isn't there. */ if (Dsymbol fd = search_function(ad, Id._cast)) { e = new CastExp(loc, e, Type.tbool); e = e.expressionSemantic(sc); return e; } // Forward to aliasthis. if (ad.aliasthis && tb != att) { if (!att && tb.checkAliasThisRec()) att = tb; e = resolveAliasThis(sc, e); t = e.type; tb = e.type.toBasetype(); continue; } } break; } if (!t.isBoolean()) { if (tb != Type.terror) error("expression `%s` of type `%s` does not have a boolean value", toChars(), t.toChars()); return ErrorExp.get(); } return e; } /************************************************ * Destructors are attached to VarDeclarations. * Hence, if expression returns a temp that needs a destructor, * make sure and create a VarDeclaration for that temp. */ Expression addDtorHook(Scope* sc) { return this; } /****************************** * Take address of expression. */ final Expression addressOf() { //printf("Expression::addressOf()\n"); debug { assert(op == TOK.error || isLvalue()); } Expression e = new AddrExp(loc, this, type.pointerTo()); return e; } /****************************** * If this is a reference, dereference it. */ final Expression deref() { //printf("Expression::deref()\n"); // type could be null if forward referencing an 'auto' variable if (type) if (auto tr = type.isTypeReference()) { Expression e = new PtrExp(loc, this, tr.next); return e; } return this; } final Expression optimize(int result, bool keepLvalue = false) { return Expression_optimize(this, result, keepLvalue); } // Entry point for CTFE. // A compile-time result is required. Give an error if not possible final Expression ctfeInterpret() { return .ctfeInterpret(this); } final int isConst() { return .isConst(this); } /******************************** * Does this expression statically evaluate to a boolean 'result' (true or false)? */ bool isBool(bool result) { return false; } bool hasCode() { return true; } final pure inout nothrow @nogc { inout(IntegerExp) isIntegerExp() { return op == TOK.int64 ? cast(typeof(return))this : null; } inout(ErrorExp) isErrorExp() { return op == TOK.error ? cast(typeof(return))this : null; } inout(VoidInitExp) isVoidInitExp() { return op == TOK.void_ ? cast(typeof(return))this : null; } inout(RealExp) isRealExp() { return op == TOK.float64 ? cast(typeof(return))this : null; } inout(ComplexExp) isComplexExp() { return op == TOK.complex80 ? cast(typeof(return))this : null; } inout(IdentifierExp) isIdentifierExp() { return op == TOK.identifier ? cast(typeof(return))this : null; } inout(DollarExp) isDollarExp() { return op == TOK.dollar ? cast(typeof(return))this : null; } inout(DsymbolExp) isDsymbolExp() { return op == TOK.dSymbol ? cast(typeof(return))this : null; } inout(ThisExp) isThisExp() { return op == TOK.this_ ? cast(typeof(return))this : null; } inout(SuperExp) isSuperExp() { return op == TOK.super_ ? cast(typeof(return))this : null; } inout(NullExp) isNullExp() { return op == TOK.null_ ? cast(typeof(return))this : null; } inout(StringExp) isStringExp() { return op == TOK.string_ ? cast(typeof(return))this : null; } inout(TupleExp) isTupleExp() { return op == TOK.tuple ? cast(typeof(return))this : null; } inout(ArrayLiteralExp) isArrayLiteralExp() { return op == TOK.arrayLiteral ? cast(typeof(return))this : null; } inout(AssocArrayLiteralExp) isAssocArrayLiteralExp() { return op == TOK.assocArrayLiteral ? cast(typeof(return))this : null; } inout(StructLiteralExp) isStructLiteralExp() { return op == TOK.structLiteral ? cast(typeof(return))this : null; } inout(TypeExp) isTypeExp() { return op == TOK.type ? cast(typeof(return))this : null; } inout(ScopeExp) isScopeExp() { return op == TOK.scope_ ? cast(typeof(return))this : null; } inout(TemplateExp) isTemplateExp() { return op == TOK.template_ ? cast(typeof(return))this : null; } inout(NewExp) isNewExp() { return op == TOK.new_ ? cast(typeof(return))this : null; } inout(NewAnonClassExp) isNewAnonClassExp() { return op == TOK.newAnonymousClass ? cast(typeof(return))this : null; } inout(SymOffExp) isSymOffExp() { return op == TOK.symbolOffset ? cast(typeof(return))this : null; } inout(VarExp) isVarExp() { return op == TOK.variable ? cast(typeof(return))this : null; } inout(OverExp) isOverExp() { return op == TOK.overloadSet ? cast(typeof(return))this : null; } inout(FuncExp) isFuncExp() { return op == TOK.function_ ? cast(typeof(return))this : null; } inout(DeclarationExp) isDeclarationExp() { return op == TOK.declaration ? cast(typeof(return))this : null; } inout(TypeidExp) isTypeidExp() { return op == TOK.typeid_ ? cast(typeof(return))this : null; } inout(TraitsExp) isTraitsExp() { return op == TOK.traits ? cast(typeof(return))this : null; } inout(HaltExp) isHaltExp() { return op == TOK.halt ? cast(typeof(return))this : null; } inout(IsExp) isExp() { return op == TOK.is_ ? cast(typeof(return))this : null; } inout(MixinExp) isMixinExp() { return op == TOK.mixin_ ? cast(typeof(return))this : null; } inout(ImportExp) isImportExp() { return op == TOK.import_ ? cast(typeof(return))this : null; } inout(AssertExp) isAssertExp() { return op == TOK.assert_ ? cast(typeof(return))this : null; } inout(DotIdExp) isDotIdExp() { return op == TOK.dotIdentifier ? cast(typeof(return))this : null; } inout(DotTemplateExp) isDotTemplateExp() { return op == TOK.dotTemplateDeclaration ? cast(typeof(return))this : null; } inout(DotVarExp) isDotVarExp() { return op == TOK.dotVariable ? cast(typeof(return))this : null; } inout(DotTemplateInstanceExp) isDotTemplateInstanceExp() { return op == TOK.dotTemplateInstance ? cast(typeof(return))this : null; } inout(DelegateExp) isDelegateExp() { return op == TOK.delegate_ ? cast(typeof(return))this : null; } inout(DotTypeExp) isDotTypeExp() { return op == TOK.dotType ? cast(typeof(return))this : null; } inout(CallExp) isCallExp() { return op == TOK.call ? cast(typeof(return))this : null; } inout(AddrExp) isAddrExp() { return op == TOK.address ? cast(typeof(return))this : null; } inout(PtrExp) isPtrExp() { return op == TOK.star ? cast(typeof(return))this : null; } inout(NegExp) isNegExp() { return op == TOK.negate ? cast(typeof(return))this : null; } inout(UAddExp) isUAddExp() { return op == TOK.uadd ? cast(typeof(return))this : null; } inout(ComExp) isComExp() { return op == TOK.tilde ? cast(typeof(return))this : null; } inout(NotExp) isNotExp() { return op == TOK.not ? cast(typeof(return))this : null; } inout(DeleteExp) isDeleteExp() { return op == TOK.delete_ ? cast(typeof(return))this : null; } inout(CastExp) isCastExp() { return op == TOK.cast_ ? cast(typeof(return))this : null; } inout(VectorExp) isVectorExp() { return op == TOK.vector ? cast(typeof(return))this : null; } inout(VectorArrayExp) isVectorArrayExp() { return op == TOK.vectorArray ? cast(typeof(return))this : null; } inout(SliceExp) isSliceExp() { return op == TOK.slice ? cast(typeof(return))this : null; } inout(ArrayLengthExp) isArrayLengthExp() { return op == TOK.arrayLength ? cast(typeof(return))this : null; } inout(ArrayExp) isArrayExp() { return op == TOK.array ? cast(typeof(return))this : null; } inout(DotExp) isDotExp() { return op == TOK.dot ? cast(typeof(return))this : null; } inout(CommaExp) isCommaExp() { return op == TOK.comma ? cast(typeof(return))this : null; } inout(IntervalExp) isIntervalExp() { return op == TOK.interval ? cast(typeof(return))this : null; } inout(DelegatePtrExp) isDelegatePtrExp() { return op == TOK.delegatePointer ? cast(typeof(return))this : null; } inout(DelegateFuncptrExp) isDelegateFuncptrExp() { return op == TOK.delegateFunctionPointer ? cast(typeof(return))this : null; } inout(IndexExp) isIndexExp() { return op == TOK.index ? cast(typeof(return))this : null; } inout(PostExp) isPostExp() { return (op == TOK.plusPlus || op == TOK.minusMinus) ? cast(typeof(return))this : null; } inout(PreExp) isPreExp() { return (op == TOK.prePlusPlus || op == TOK.preMinusMinus) ? cast(typeof(return))this : null; } inout(AssignExp) isAssignExp() { return op == TOK.assign ? cast(typeof(return))this : null; } inout(ConstructExp) isConstructExp() { return op == TOK.construct ? cast(typeof(return))this : null; } inout(BlitExp) isBlitExp() { return op == TOK.blit ? cast(typeof(return))this : null; } inout(AddAssignExp) isAddAssignExp() { return op == TOK.addAssign ? cast(typeof(return))this : null; } inout(MinAssignExp) isMinAssignExp() { return op == TOK.minAssign ? cast(typeof(return))this : null; } inout(MulAssignExp) isMulAssignExp() { return op == TOK.mulAssign ? cast(typeof(return))this : null; } inout(DivAssignExp) isDivAssignExp() { return op == TOK.divAssign ? cast(typeof(return))this : null; } inout(ModAssignExp) isModAssignExp() { return op == TOK.modAssign ? cast(typeof(return))this : null; } inout(AndAssignExp) isAndAssignExp() { return op == TOK.andAssign ? cast(typeof(return))this : null; } inout(OrAssignExp) isOrAssignExp() { return op == TOK.orAssign ? cast(typeof(return))this : null; } inout(XorAssignExp) isXorAssignExp() { return op == TOK.xorAssign ? cast(typeof(return))this : null; } inout(PowAssignExp) isPowAssignExp() { return op == TOK.powAssign ? cast(typeof(return))this : null; } inout(ShlAssignExp) isShlAssignExp() { return op == TOK.leftShiftAssign ? cast(typeof(return))this : null; } inout(ShrAssignExp) isShrAssignExp() { return op == TOK.rightShiftAssign ? cast(typeof(return))this : null; } inout(UshrAssignExp) isUshrAssignExp() { return op == TOK.unsignedRightShiftAssign ? cast(typeof(return))this : null; } inout(CatAssignExp) isCatAssignExp() { return op == TOK.concatenateAssign ? cast(typeof(return))this : null; } inout(CatElemAssignExp) isCatElemAssignExp() { return op == TOK.concatenateElemAssign ? cast(typeof(return))this : null; } inout(CatDcharAssignExp) isCatDcharAssignExp() { return op == TOK.concatenateDcharAssign ? cast(typeof(return))this : null; } inout(AddExp) isAddExp() { return op == TOK.add ? cast(typeof(return))this : null; } inout(MinExp) isMinExp() { return op == TOK.min ? cast(typeof(return))this : null; } inout(CatExp) isCatExp() { return op == TOK.concatenate ? cast(typeof(return))this : null; } inout(MulExp) isMulExp() { return op == TOK.mul ? cast(typeof(return))this : null; } inout(DivExp) isDivExp() { return op == TOK.div ? cast(typeof(return))this : null; } inout(ModExp) isModExp() { return op == TOK.mod ? cast(typeof(return))this : null; } inout(PowExp) isPowExp() { return op == TOK.pow ? cast(typeof(return))this : null; } inout(ShlExp) isShlExp() { return op == TOK.leftShift ? cast(typeof(return))this : null; } inout(ShrExp) isShrExp() { return op == TOK.rightShift ? cast(typeof(return))this : null; } inout(UshrExp) isUshrExp() { return op == TOK.unsignedRightShift ? cast(typeof(return))this : null; } inout(AndExp) isAndExp() { return op == TOK.and ? cast(typeof(return))this : null; } inout(OrExp) isOrExp() { return op == TOK.or ? cast(typeof(return))this : null; } inout(XorExp) isXorExp() { return op == TOK.xor ? cast(typeof(return))this : null; } inout(LogicalExp) isLogicalExp() { return (op == TOK.andAnd || op == TOK.orOr) ? cast(typeof(return))this : null; } //inout(CmpExp) isCmpExp() { return op == TOK. ? cast(typeof(return))this : null; } inout(InExp) isInExp() { return op == TOK.in_ ? cast(typeof(return))this : null; } inout(RemoveExp) isRemoveExp() { return op == TOK.remove ? cast(typeof(return))this : null; } inout(EqualExp) isEqualExp() { return (op == TOK.equal || op == TOK.notEqual) ? cast(typeof(return))this : null; } inout(IdentityExp) isIdentityExp() { return (op == TOK.identity || op == TOK.notIdentity) ? cast(typeof(return))this : null; } inout(CondExp) isCondExp() { return op == TOK.question ? cast(typeof(return))this : null; } inout(DefaultInitExp) isDefaultInitExp() { return isDefaultInitOp(op) ? cast(typeof(return))this: null; } inout(FileInitExp) isFileInitExp() { return (op == TOK.file || op == TOK.fileFullPath) ? cast(typeof(return))this : null; } inout(LineInitExp) isLineInitExp() { return op == TOK.line ? cast(typeof(return))this : null; } inout(ModuleInitExp) isModuleInitExp() { return op == TOK.moduleString ? cast(typeof(return))this : null; } inout(FuncInitExp) isFuncInitExp() { return op == TOK.functionString ? cast(typeof(return))this : null; } inout(PrettyFuncInitExp) isPrettyFuncInitExp() { return op == TOK.prettyFunction ? cast(typeof(return))this : null; } inout(ClassReferenceExp) isClassReferenceExp() { return op == TOK.classReference ? cast(typeof(return))this : null; } inout(ThrownExceptionExp) isThrownExceptionExp() { return op == TOK.thrownException ? cast(typeof(return))this : null; } } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class IntegerExp : Expression { private dinteger_t value; extern (D) this(const ref Loc loc, dinteger_t value, Type type) { super(loc, TOK.int64, __traits(classInstanceSize, IntegerExp)); //printf("IntegerExp(value = %lld, type = '%s')\n", value, type ? type.toChars() : ""); assert(type); if (!type.isscalar()) { //printf("%s, loc = %d\n", toChars(), loc.linnum); if (type.ty != Terror) error("integral constant must be scalar type, not `%s`", type.toChars()); type = Type.terror; } this.type = type; this.value = normalize(type.toBasetype().ty, value); } extern (D) this(dinteger_t value) { super(Loc.initial, TOK.int64, __traits(classInstanceSize, IntegerExp)); this.type = Type.tint32; this.value = cast(d_int32)value; } static IntegerExp create(Loc loc, dinteger_t value, Type type) { return new IntegerExp(loc, value, type); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, Loc loc, dinteger_t value, Type type) { emplaceExp!(IntegerExp)(pue, loc, value, type); } override bool equals(const RootObject o) const { if (this == o) return true; if (auto ne = (cast(Expression)o).isIntegerExp()) { if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && value == ne.value) { return true; } } return false; } override dinteger_t toInteger() { // normalize() is necessary until we fix all the paints of 'type' return value = normalize(type.toBasetype().ty, value); } override real_t toReal() { // normalize() is necessary until we fix all the paints of 'type' const ty = type.toBasetype().ty; const val = normalize(ty, value); value = val; return (ty == Tuns64) ? real_t(cast(d_uns64)val) : real_t(cast(d_int64)val); } override real_t toImaginary() { return CTFloat.zero; } override complex_t toComplex() { return complex_t(toReal()); } override bool isBool(bool result) { bool r = toInteger() != 0; return result ? r : !r; } override Expression toLvalue(Scope* sc, Expression e) { if (!e) e = this; else if (!loc.isValid()) loc = e.loc; e.error("cannot modify constant `%s`", e.toChars()); return ErrorExp.get(); } override void accept(Visitor v) { v.visit(this); } dinteger_t getInteger() { return value; } void setInteger(dinteger_t value) { this.value = normalize(type.toBasetype().ty, value); } extern (D) static dinteger_t normalize(TY ty, dinteger_t value) { /* 'Normalize' the value of the integer to be in range of the type */ dinteger_t result; switch (ty) { case Tbool: result = (value != 0); break; case Tint8: result = cast(d_int8)value; break; case Tchar: case Tuns8: result = cast(d_uns8)value; break; case Tint16: result = cast(d_int16)value; break; case Twchar: case Tuns16: result = cast(d_uns16)value; break; case Tint32: result = cast(d_int32)value; break; case Tdchar: case Tuns32: result = cast(d_uns32)value; break; case Tint64: result = cast(d_int64)value; break; case Tuns64: result = cast(d_uns64)value; break; case Tpointer: if (target.ptrsize == 8) goto case Tuns64; if (target.ptrsize == 4) goto case Tuns32; if (target.ptrsize == 2) goto case Tuns16; assert(0); default: break; } return result; } override IntegerExp syntaxCopy() { return this; } /** * Use this instead of creating new instances for commonly used literals * such as 0 or 1. * * Parameters: * v = The value of the expression * Returns: * A static instance of the expression, typed as `Tint32`. */ static IntegerExp literal(int v)() { __gshared IntegerExp theConstant; if (!theConstant) theConstant = new IntegerExp(v); return theConstant; } /** * Use this instead of creating new instances for commonly used bools. * * Parameters: * b = The value of the expression * Returns: * A static instance of the expression, typed as `Type.tbool`. */ static IntegerExp createBool(bool b) { __gshared IntegerExp trueExp, falseExp; if (!trueExp) { trueExp = new IntegerExp(Loc.initial, 1, Type.tbool); falseExp = new IntegerExp(Loc.initial, 0, Type.tbool); } return b ? trueExp : falseExp; } } /*********************************************************** * Use this expression for error recovery. * It should behave as a 'sink' to prevent further cascaded error messages. */ extern (C++) final class ErrorExp : Expression { private extern (D) this() { super(Loc.initial, TOK.error, __traits(classInstanceSize, ErrorExp)); type = Type.terror; } static ErrorExp get () { if (errorexp is null) errorexp = new ErrorExp(); if (global.errors == 0 && global.gaggedErrors == 0) { /* Unfortunately, errors can still leak out of gagged errors, * and we need to set the error count to prevent bogus code * generation. At least give a message. */ .error(Loc.initial, "unknown, please file report on issues.dlang.org"); } return errorexp; } override Expression toLvalue(Scope* sc, Expression e) { return this; } override void accept(Visitor v) { v.visit(this); } extern (C++) __gshared ErrorExp errorexp; // handy shared value } /*********************************************************** * An uninitialized value, * generated from void initializers. */ extern (C++) final class VoidInitExp : Expression { VarDeclaration var; /// the variable from where the void value came from, null if not known /// Useful for error messages extern (D) this(VarDeclaration var) { super(var.loc, TOK.void_, __traits(classInstanceSize, VoidInitExp)); this.var = var; this.type = var.type; } override const(char)* toChars() const { return "void"; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class RealExp : Expression { real_t value; extern (D) this(const ref Loc loc, real_t value, Type type) { super(loc, TOK.float64, __traits(classInstanceSize, RealExp)); //printf("RealExp::RealExp(%Lg)\n", value); this.value = value; this.type = type; } static RealExp create(Loc loc, real_t value, Type type) { return new RealExp(loc, value, type); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, Loc loc, real_t value, Type type) { emplaceExp!(RealExp)(pue, loc, value, type); } override bool equals(const RootObject o) const { if (this == o) return true; if (auto ne = (cast(Expression)o).isRealExp()) { if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && RealIdentical(value, ne.value)) { return true; } } return false; } override dinteger_t toInteger() { return cast(sinteger_t)toReal(); } override uinteger_t toUInteger() { return cast(uinteger_t)toReal(); } override real_t toReal() { return type.isreal() ? value : CTFloat.zero; } override real_t toImaginary() { return type.isreal() ? CTFloat.zero : value; } override complex_t toComplex() { return complex_t(toReal(), toImaginary()); } override bool isBool(bool result) { return result ? cast(bool)value : !cast(bool)value; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ComplexExp : Expression { complex_t value; extern (D) this(const ref Loc loc, complex_t value, Type type) { super(loc, TOK.complex80, __traits(classInstanceSize, ComplexExp)); this.value = value; this.type = type; //printf("ComplexExp::ComplexExp(%s)\n", toChars()); } static ComplexExp create(Loc loc, complex_t value, Type type) { return new ComplexExp(loc, value, type); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, Loc loc, complex_t value, Type type) { emplaceExp!(ComplexExp)(pue, loc, value, type); } override bool equals(const RootObject o) const { if (this == o) return true; if (auto ne = (cast(Expression)o).isComplexExp()) { if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && RealIdentical(creall(value), creall(ne.value)) && RealIdentical(cimagl(value), cimagl(ne.value))) { return true; } } return false; } override dinteger_t toInteger() { return cast(sinteger_t)toReal(); } override uinteger_t toUInteger() { return cast(uinteger_t)toReal(); } override real_t toReal() { return creall(value); } override real_t toImaginary() { return cimagl(value); } override complex_t toComplex() { return value; } override bool isBool(bool result) { if (result) return cast(bool)value; else return !value; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) class IdentifierExp : Expression { Identifier ident; extern (D) this(const ref Loc loc, Identifier ident) { super(loc, TOK.identifier, __traits(classInstanceSize, IdentifierExp)); this.ident = ident; } static IdentifierExp create(Loc loc, Identifier ident) { return new IdentifierExp(loc, ident); } override final bool isLvalue() { return true; } override final Expression toLvalue(Scope* sc, Expression e) { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DollarExp : IdentifierExp { extern (D) this(const ref Loc loc) { super(loc, Id.dollar); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Won't be generated by parser. */ extern (C++) final class DsymbolExp : Expression { Dsymbol s; bool hasOverloads; extern (D) this(const ref Loc loc, Dsymbol s, bool hasOverloads = true) { super(loc, TOK.dSymbol, __traits(classInstanceSize, DsymbolExp)); this.s = s; this.hasOverloads = hasOverloads; } override bool isLvalue() { return true; } override Expression toLvalue(Scope* sc, Expression e) { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#this */ extern (C++) class ThisExp : Expression { VarDeclaration var; extern (D) this(const ref Loc loc) { super(loc, TOK.this_, __traits(classInstanceSize, ThisExp)); //printf("ThisExp::ThisExp() loc = %d\n", loc.linnum); } this(const ref Loc loc, const TOK tok) { super(loc, tok, __traits(classInstanceSize, ThisExp)); //printf("ThisExp::ThisExp() loc = %d\n", loc.linnum); } override ThisExp syntaxCopy() { auto r = cast(ThisExp) super.syntaxCopy(); // require new semantic (possibly new `var` etc.) r.type = null; r.var = null; return r; } override final bool isBool(bool result) { return result; } override final bool isLvalue() { // Class `this` should be an rvalue; struct `this` should be an lvalue. return type.toBasetype().ty != Tclass; } override final Expression toLvalue(Scope* sc, Expression e) { if (type.toBasetype().ty == Tclass) { // Class `this` is an rvalue; struct `this` is an lvalue. return Expression.toLvalue(sc, e); } return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#super */ extern (C++) final class SuperExp : ThisExp { extern (D) this(const ref Loc loc) { super(loc, TOK.super_); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#null */ extern (C++) final class NullExp : Expression { extern (D) this(const ref Loc loc, Type type = null) { super(loc, TOK.null_, __traits(classInstanceSize, NullExp)); this.type = type; } override bool equals(const RootObject o) const { if (auto e = o.isExpression()) { if (e.op == TOK.null_ && type.equals(e.type)) { return true; } } return false; } override bool isBool(bool result) { return result ? false : true; } override StringExp toStringExp() { if (implicitConvTo(Type.tstring)) { auto se = new StringExp(loc, (cast(char*)mem.xcalloc(1, 1))[0 .. 0]); se.type = Type.tstring; return se; } return null; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#string_literals */ extern (C++) final class StringExp : Expression { private union { char* string; // if sz == 1 wchar* wstring; // if sz == 2 dchar* dstring; // if sz == 4 } // (const if ownedByCtfe == OwnedBy.code) size_t len; // number of code units ubyte sz = 1; // 1: char, 2: wchar, 4: dchar ubyte committed; // !=0 if type is committed enum char NoPostfix = 0; char postfix = NoPostfix; // 'c', 'w', 'd' OwnedBy ownedByCtfe = OwnedBy.code; extern (D) this(const ref Loc loc, const(void)[] string) { super(loc, TOK.string_, __traits(classInstanceSize, StringExp)); this.string = cast(char*)string.ptr; // note that this.string should be const this.len = string.length; this.sz = 1; // work around LDC bug #1286 } extern (D) this(const ref Loc loc, const(void)[] string, size_t len, ubyte sz, char postfix = NoPostfix) { super(loc, TOK.string_, __traits(classInstanceSize, StringExp)); this.string = cast(char*)string.ptr; // note that this.string should be const this.len = len; this.sz = sz; this.postfix = postfix; } static StringExp create(Loc loc, char* s) { return new StringExp(loc, s.toDString()); } static StringExp create(Loc loc, void* string, size_t len) { return new StringExp(loc, string[0 .. len]); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, Loc loc, char* s) { emplaceExp!(StringExp)(pue, loc, s.toDString()); } extern (D) static void emplace(UnionExp* pue, Loc loc, const(void)[] string) { emplaceExp!(StringExp)(pue, loc, string); } extern (D) static void emplace(UnionExp* pue, Loc loc, const(void)[] string, size_t len, ubyte sz, char postfix) { emplaceExp!(StringExp)(pue, loc, string, len, sz, postfix); } override bool equals(const RootObject o) const { //printf("StringExp::equals('%s') %s\n", o.toChars(), toChars()); if (auto e = o.isExpression()) { if (auto se = e.isStringExp()) { return compare(se) == 0; } } return false; } /********************************** * Return the number of code units the string would be if it were re-encoded * as tynto. * Params: * tynto = code unit type of the target encoding * Returns: * number of code units */ size_t numberOfCodeUnits(int tynto = 0) const { int encSize; switch (tynto) { case 0: return len; case Tchar: encSize = 1; break; case Twchar: encSize = 2; break; case Tdchar: encSize = 4; break; default: assert(0); } if (sz == encSize) return len; size_t result = 0; dchar c; switch (sz) { case 1: for (size_t u = 0; u < len;) { if (const s = utf_decodeChar(string[0 .. len], u, c)) { error("%.*s", cast(int)s.length, s.ptr); return 0; } result += utf_codeLength(encSize, c); } break; case 2: for (size_t u = 0; u < len;) { if (const s = utf_decodeWchar(wstring[0 .. len], u, c)) { error("%.*s", cast(int)s.length, s.ptr); return 0; } result += utf_codeLength(encSize, c); } break; case 4: foreach (u; 0 .. len) { result += utf_codeLength(encSize, dstring[u]); } break; default: assert(0); } return result; } /********************************************** * Write the contents of the string to dest. * Use numberOfCodeUnits() to determine size of result. * Params: * dest = destination * tyto = encoding type of the result * zero = add terminating 0 */ void writeTo(void* dest, bool zero, int tyto = 0) const { int encSize; switch (tyto) { case 0: encSize = sz; break; case Tchar: encSize = 1; break; case Twchar: encSize = 2; break; case Tdchar: encSize = 4; break; default: assert(0); } if (sz == encSize) { memcpy(dest, string, len * sz); if (zero) memset(dest + len * sz, 0, sz); } else assert(0); } /********************************************* * Get the code unit at index i * Params: * i = index * Returns: * code unit at index i */ dchar getCodeUnit(size_t i) const pure { assert(i < len); final switch (sz) { case 1: return string[i]; case 2: return wstring[i]; case 4: return dstring[i]; } } /********************************************* * Set the code unit at index i to c * Params: * i = index * c = code unit to set it to */ void setCodeUnit(size_t i, dchar c) { assert(i < len); final switch (sz) { case 1: string[i] = cast(char)c; break; case 2: wstring[i] = cast(wchar)c; break; case 4: dstring[i] = c; break; } } override StringExp toStringExp() { return this; } /**************************************** * Convert string to char[]. */ StringExp toUTF8(Scope* sc) { if (sz != 1) { // Convert to UTF-8 string committed = 0; Expression e = castTo(sc, Type.tchar.arrayOf()); e = e.optimize(WANTvalue); auto se = e.isStringExp(); assert(se.sz == 1); return se; } return this; } /** * Compare two `StringExp` by length, then value * * The comparison is not the usual C-style comparison as seen with * `strcmp` or `memcmp`, but instead first compare based on the length. * This allows both faster lookup and sorting when comparing sparse data. * * This ordering scheme is relied on by the string-switching feature. * Code in Druntime's `core.internal.switch_` relies on this ordering * when doing a binary search among case statements. * * Both `StringExp` should be of the same encoding. * * Params: * se2 = String expression to compare `this` to * * Returns: * `0` when `this` is equal to se2, a value greater than `0` if * `this` should be considered greater than `se2`, * and a value less than `0` if `this` is lesser than `se2`. */ int compare(const StringExp se2) const nothrow pure @nogc { //printf("StringExp::compare()\n"); const len1 = len; const len2 = se2.len; assert(this.sz == se2.sz, "Comparing string expressions of different sizes"); //printf("sz = %d, len1 = %d, len2 = %d\n", sz, (int)len1, (int)len2); if (len1 == len2) { switch (sz) { case 1: return memcmp(string, se2.string, len1); case 2: { wchar* s1 = cast(wchar*)string; wchar* s2 = cast(wchar*)se2.string; foreach (u; 0 .. len) { if (s1[u] != s2[u]) return s1[u] - s2[u]; } } break; case 4: { dchar* s1 = cast(dchar*)string; dchar* s2 = cast(dchar*)se2.string; foreach (u; 0 .. len) { if (s1[u] != s2[u]) return s1[u] - s2[u]; } } break; default: assert(0); } } return cast(int)(len1 - len2); } override bool isBool(bool result) { return result; } override bool isLvalue() { /* string literal is rvalue in default, but * conversion to reference of static array is only allowed. */ return (type && type.toBasetype().ty == Tsarray); } override Expression toLvalue(Scope* sc, Expression e) { //printf("StringExp::toLvalue(%s) type = %s\n", toChars(), type ? type.toChars() : NULL); return (type && type.toBasetype().ty == Tsarray) ? this : Expression.toLvalue(sc, e); } override Expression modifiableLvalue(Scope* sc, Expression e) { error("cannot modify string literal `%s`", toChars()); return ErrorExp.get(); } uint charAt(uinteger_t i) const { uint value; switch (sz) { case 1: value = (cast(char*)string)[cast(size_t)i]; break; case 2: value = (cast(ushort*)string)[cast(size_t)i]; break; case 4: value = (cast(uint*)string)[cast(size_t)i]; break; default: assert(0); } return value; } /******************************** * Convert string contents to a 0 terminated string, * allocated by mem.xmalloc(). */ extern (D) const(char)[] toStringz() const { auto nbytes = len * sz; char* s = cast(char*)mem.xmalloc(nbytes + sz); writeTo(s, true); return s[0 .. nbytes]; } extern (D) const(char)[] peekString() const { assert(sz == 1); return this.string[0 .. len]; } extern (D) const(wchar)[] peekWstring() const { assert(sz == 2); return this.wstring[0 .. len]; } extern (D) const(dchar)[] peekDstring() const { assert(sz == 4); return this.dstring[0 .. len]; } /******************* * Get a slice of the data. */ extern (D) const(ubyte)[] peekData() const { return cast(const(ubyte)[])this.string[0 .. len * sz]; } /******************* * Borrow a slice of the data, so the caller can modify * it in-place (!) */ extern (D) ubyte[] borrowData() { return cast(ubyte[])this.string[0 .. len * sz]; } /*********************** * Set new string data. * `this` becomes the new owner of the data. */ extern (D) void setData(void* s, size_t len, ubyte sz) { this.string = cast(char*)s; this.len = len; this.sz = sz; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class TupleExp : Expression { /* Tuple-field access may need to take out its side effect part. * For example: * foo().tupleof * is rewritten as: * (ref __tup = foo(); tuple(__tup.field0, __tup.field1, ...)) * The declaration of temporary variable __tup will be stored in TupleExp.e0. */ Expression e0; Expressions* exps; extern (D) this(const ref Loc loc, Expression e0, Expressions* exps) { super(loc, TOK.tuple, __traits(classInstanceSize, TupleExp)); //printf("TupleExp(this = %p)\n", this); this.e0 = e0; this.exps = exps; } extern (D) this(const ref Loc loc, Expressions* exps) { super(loc, TOK.tuple, __traits(classInstanceSize, TupleExp)); //printf("TupleExp(this = %p)\n", this); this.exps = exps; } extern (D) this(const ref Loc loc, TupleDeclaration tup) { super(loc, TOK.tuple, __traits(classInstanceSize, TupleExp)); this.exps = new Expressions(); this.exps.reserve(tup.objects.dim); foreach (o; *tup.objects) { if (Dsymbol s = getDsymbol(o)) { /* If tuple element represents a symbol, translate to DsymbolExp * to supply implicit 'this' if needed later. */ Expression e = new DsymbolExp(loc, s); this.exps.push(e); } else if (auto eo = o.isExpression()) { auto e = eo.copy(); e.loc = loc; // https://issues.dlang.org/show_bug.cgi?id=15669 this.exps.push(e); } else if (auto t = o.isType()) { Expression e = new TypeExp(loc, t); this.exps.push(e); } else { error("`%s` is not an expression", o.toChars()); } } } static TupleExp create(Loc loc, Expressions* exps) { return new TupleExp(loc, exps); } override TupleExp toTupleExp() { return this; } override TupleExp syntaxCopy() { return new TupleExp(loc, e0 ? e0.syntaxCopy() : null, arraySyntaxCopy(exps)); } override bool equals(const RootObject o) const { if (this == o) return true; if (auto e = o.isExpression()) if (auto te = e.isTupleExp()) { if (exps.dim != te.exps.dim) return false; if (e0 && !e0.equals(te.e0) || !e0 && te.e0) return false; foreach (i, e1; *exps) { auto e2 = (*te.exps)[i]; if (!e1.equals(e2)) return false; } return true; } return false; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * [ e1, e2, e3, ... ] * * http://dlang.org/spec/expression.html#array_literals */ extern (C++) final class ArrayLiteralExp : Expression { /** If !is null, elements[] can be sparse and basis is used for the * "default" element value. In other words, non-null elements[i] overrides * this 'basis' value. */ Expression basis; Expressions* elements; OwnedBy ownedByCtfe = OwnedBy.code; extern (D) this(const ref Loc loc, Type type, Expressions* elements) { super(loc, TOK.arrayLiteral, __traits(classInstanceSize, ArrayLiteralExp)); this.type = type; this.elements = elements; } extern (D) this(const ref Loc loc, Type type, Expression e) { super(loc, TOK.arrayLiteral, __traits(classInstanceSize, ArrayLiteralExp)); this.type = type; elements = new Expressions(); elements.push(e); } extern (D) this(const ref Loc loc, Type type, Expression basis, Expressions* elements) { super(loc, TOK.arrayLiteral, __traits(classInstanceSize, ArrayLiteralExp)); this.type = type; this.basis = basis; this.elements = elements; } static ArrayLiteralExp create(Loc loc, Expressions* elements) { return new ArrayLiteralExp(loc, null, elements); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, Loc loc, Expressions* elements) { emplaceExp!(ArrayLiteralExp)(pue, loc, null, elements); } override ArrayLiteralExp syntaxCopy() { return new ArrayLiteralExp(loc, null, basis ? basis.syntaxCopy() : null, arraySyntaxCopy(elements)); } override bool equals(const RootObject o) const { if (this == o) return true; auto e = o.isExpression(); if (!e) return false; if (auto ae = e.isArrayLiteralExp()) { if (elements.dim != ae.elements.dim) return false; if (elements.dim == 0 && !type.equals(ae.type)) { return false; } foreach (i, e1; *elements) { auto e2 = (*ae.elements)[i]; auto e1x = e1 ? e1 : basis; auto e2x = e2 ? e2 : ae.basis; if (e1x != e2x && (!e1x || !e2x || !e1x.equals(e2x))) return false; } return true; } return false; } Expression getElement(size_t i) { return this[i]; } Expression opIndex(size_t i) { auto el = (*elements)[i]; return el ? el : basis; } override bool isBool(bool result) { size_t dim = elements ? elements.dim : 0; return result ? (dim != 0) : (dim == 0); } override StringExp toStringExp() { TY telem = type.nextOf().toBasetype().ty; if (telem.isSomeChar || (telem == Tvoid && (!elements || elements.dim == 0))) { ubyte sz = 1; if (telem == Twchar) sz = 2; else if (telem == Tdchar) sz = 4; OutBuffer buf; if (elements) { foreach (i; 0 .. elements.dim) { auto ch = this[i]; if (ch.op != TOK.int64) return null; if (sz == 1) buf.writeByte(cast(uint)ch.toInteger()); else if (sz == 2) buf.writeword(cast(uint)ch.toInteger()); else buf.write4(cast(uint)ch.toInteger()); } } char prefix; if (sz == 1) { prefix = 'c'; buf.writeByte(0); } else if (sz == 2) { prefix = 'w'; buf.writeword(0); } else { prefix = 'd'; buf.write4(0); } const size_t len = buf.length / sz - 1; auto se = new StringExp(loc, buf.extractSlice()[0 .. len * sz], len, sz, prefix); se.sz = sz; se.type = type; return se; } return null; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * [ key0 : value0, key1 : value1, ... ] * * http://dlang.org/spec/expression.html#associative_array_literals */ extern (C++) final class AssocArrayLiteralExp : Expression { Expressions* keys; Expressions* values; OwnedBy ownedByCtfe = OwnedBy.code; extern (D) this(const ref Loc loc, Expressions* keys, Expressions* values) { super(loc, TOK.assocArrayLiteral, __traits(classInstanceSize, AssocArrayLiteralExp)); assert(keys.dim == values.dim); this.keys = keys; this.values = values; } override bool equals(const RootObject o) const { if (this == o) return true; auto e = o.isExpression(); if (!e) return false; if (auto ae = e.isAssocArrayLiteralExp()) { if (keys.dim != ae.keys.dim) return false; size_t count = 0; foreach (i, key; *keys) { foreach (j, akey; *ae.keys) { if (key.equals(akey)) { if (!(*values)[i].equals((*ae.values)[j])) return false; ++count; } } } return count == keys.dim; } return false; } override AssocArrayLiteralExp syntaxCopy() { return new AssocArrayLiteralExp(loc, arraySyntaxCopy(keys), arraySyntaxCopy(values)); } override bool isBool(bool result) { size_t dim = keys.dim; return result ? (dim != 0) : (dim == 0); } override void accept(Visitor v) { v.visit(this); } } enum stageScrub = 0x1; /// scrubReturnValue is running enum stageSearchPointers = 0x2; /// hasNonConstPointers is running enum stageOptimize = 0x4; /// optimize is running enum stageApply = 0x8; /// apply is running enum stageInlineScan = 0x10; /// inlineScan is running enum stageToCBuffer = 0x20; /// toCBuffer is running /*********************************************************** * sd( e1, e2, e3, ... ) */ extern (C++) final class StructLiteralExp : Expression { StructDeclaration sd; /// which aggregate this is for Expressions* elements; /// parallels sd.fields[] with null entries for fields to skip Type stype; /// final type of result (can be different from sd's type) Symbol* sym; /// back end symbol to initialize with literal /** pointer to the origin instance of the expression. * once a new expression is created, origin is set to 'this'. * anytime when an expression copy is created, 'origin' pointer is set to * 'origin' pointer value of the original expression. */ StructLiteralExp origin; /// those fields need to prevent a infinite recursion when one field of struct initialized with 'this' pointer. StructLiteralExp inlinecopy; /** anytime when recursive function is calling, 'stageflags' marks with bit flag of * current stage and unmarks before return from this function. * 'inlinecopy' uses similar 'stageflags' and from multiple evaluation 'doInline' * (with infinite recursion) of this expression. */ int stageflags; bool useStaticInit; /// if this is true, use the StructDeclaration's init symbol bool isOriginal = false; /// used when moving instances to indicate `this is this.origin` OwnedBy ownedByCtfe = OwnedBy.code; extern (D) this(const ref Loc loc, StructDeclaration sd, Expressions* elements, Type stype = null) { super(loc, TOK.structLiteral, __traits(classInstanceSize, StructLiteralExp)); this.sd = sd; if (!elements) elements = new Expressions(); this.elements = elements; this.stype = stype; this.origin = this; //printf("StructLiteralExp::StructLiteralExp(%s)\n", toChars()); } static StructLiteralExp create(Loc loc, StructDeclaration sd, void* elements, Type stype = null) { return new StructLiteralExp(loc, sd, cast(Expressions*)elements, stype); } override bool equals(const RootObject o) const { if (this == o) return true; auto e = o.isExpression(); if (!e) return false; if (auto se = e.isStructLiteralExp()) { if (!type.equals(se.type)) return false; if (elements.dim != se.elements.dim) return false; foreach (i, e1; *elements) { auto e2 = (*se.elements)[i]; if (e1 != e2 && (!e1 || !e2 || !e1.equals(e2))) return false; } return true; } return false; } override StructLiteralExp syntaxCopy() { auto exp = new StructLiteralExp(loc, sd, arraySyntaxCopy(elements), type ? type : stype); exp.origin = this; return exp; } /************************************** * Gets expression at offset of type. * Returns NULL if not found. */ Expression getField(Type type, uint offset) { //printf("StructLiteralExp::getField(this = %s, type = %s, offset = %u)\n", // /*toChars()*/"", type.toChars(), offset); Expression e = null; int i = getFieldIndex(type, offset); if (i != -1) { //printf("\ti = %d\n", i); if (i >= sd.nonHiddenFields()) return null; assert(i < elements.dim); e = (*elements)[i]; if (e) { //printf("e = %s, e.type = %s\n", e.toChars(), e.type.toChars()); /* If type is a static array, and e is an initializer for that array, * then the field initializer should be an array literal of e. */ auto tsa = type.isTypeSArray(); if (tsa && e.type.castMod(0) != type.castMod(0)) { const length = cast(size_t)tsa.dim.toInteger(); auto z = new Expressions(length); foreach (ref q; *z) q = e.copy(); e = new ArrayLiteralExp(loc, type, z); } else { e = e.copy(); e.type = type; } if (useStaticInit && e.type.needsNested()) if (auto se = e.isStructLiteralExp()) { se.useStaticInit = true; } } } return e; } /************************************ * Get index of field. * Returns -1 if not found. */ int getFieldIndex(Type type, uint offset) { /* Find which field offset is by looking at the field offsets */ if (elements.dim) { foreach (i, v; sd.fields) { if (offset == v.offset && type.size() == v.type.size()) { /* context fields might not be filled. */ if (i >= sd.nonHiddenFields()) return cast(int)i; if (auto e = (*elements)[i]) { return cast(int)i; } break; } } } return -1; } override Expression addDtorHook(Scope* sc) { /* If struct requires a destructor, rewrite as: * (S tmp = S()),tmp * so that the destructor can be hung on tmp. */ if (sd.dtor && sc.func) { /* Make an identifier for the temporary of the form: * __sl%s%d, where %s is the struct name */ char[10] buf = void; const prefix = "__sl"; const ident = sd.ident.toString; const fullLen = prefix.length + ident.length; const len = fullLen < buf.length ? fullLen : buf.length; buf[0 .. prefix.length] = prefix; buf[prefix.length .. len] = ident[0 .. len - prefix.length]; auto tmp = copyToTemp(0, buf[0 .. len], this); Expression ae = new DeclarationExp(loc, tmp); Expression e = new CommaExp(loc, ae, new VarExp(loc, tmp)); e = e.expressionSemantic(sc); return e; } return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Mainly just a placeholder */ extern (C++) final class TypeExp : Expression { extern (D) this(const ref Loc loc, Type type) { super(loc, TOK.type, __traits(classInstanceSize, TypeExp)); //printf("TypeExp::TypeExp(%s)\n", type.toChars()); this.type = type; } override TypeExp syntaxCopy() { return new TypeExp(loc, type.syntaxCopy()); } override bool checkType() { error("type `%s` is not an expression", toChars()); return true; } override bool checkValue() { error("type `%s` has no value", toChars()); return true; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Mainly just a placeholder of * Package, Module, Nspace, and TemplateInstance (including TemplateMixin) * * A template instance that requires IFTI: * foo!tiargs(fargs) // foo!tiargs * is left until CallExp::semantic() or resolveProperties() */ extern (C++) final class ScopeExp : Expression { ScopeDsymbol sds; extern (D) this(const ref Loc loc, ScopeDsymbol sds) { super(loc, TOK.scope_, __traits(classInstanceSize, ScopeExp)); //printf("ScopeExp::ScopeExp(sds = '%s')\n", sds.toChars()); //static int count; if (++count == 38) *(char*)0=0; this.sds = sds; assert(!sds.isTemplateDeclaration()); // instead, you should use TemplateExp } override ScopeExp syntaxCopy() { return new ScopeExp(loc, sds.syntaxCopy(null)); } override bool checkType() { if (sds.isPackage()) { error("%s `%s` has no type", sds.kind(), sds.toChars()); return true; } if (auto ti = sds.isTemplateInstance()) { //assert(ti.needsTypeInference(sc)); if (ti.tempdecl && ti.semantictiargsdone && ti.semanticRun == PASS.init) { error("partial %s `%s` has no type", sds.kind(), toChars()); return true; } } return false; } override bool checkValue() { error("%s `%s` has no value", sds.kind(), sds.toChars()); return true; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Mainly just a placeholder */ extern (C++) final class TemplateExp : Expression { TemplateDeclaration td; FuncDeclaration fd; extern (D) this(const ref Loc loc, TemplateDeclaration td, FuncDeclaration fd = null) { super(loc, TOK.template_, __traits(classInstanceSize, TemplateExp)); //printf("TemplateExp(): %s\n", td.toChars()); this.td = td; this.fd = fd; } override bool isLvalue() { return fd !is null; } override Expression toLvalue(Scope* sc, Expression e) { if (!fd) return Expression.toLvalue(sc, e); assert(sc); return symbolToExp(fd, loc, sc, true); } override bool checkType() { error("%s `%s` has no type", td.kind(), toChars()); return true; } override bool checkValue() { error("%s `%s` has no value", td.kind(), toChars()); return true; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * thisexp.new(newargs) newtype(arguments) */ extern (C++) final class NewExp : Expression { Expression thisexp; // if !=null, 'this' for class being allocated Expressions* newargs; // Array of Expression's to call new operator Type newtype; Expressions* arguments; // Array of Expression's Expression argprefix; // expression to be evaluated just before arguments[] CtorDeclaration member; // constructor function NewDeclaration allocator; // allocator function bool onstack; // allocate on stack bool thrownew; // this NewExp is the expression of a ThrowStatement extern (D) this(const ref Loc loc, Expression thisexp, Expressions* newargs, Type newtype, Expressions* arguments) { super(loc, TOK.new_, __traits(classInstanceSize, NewExp)); this.thisexp = thisexp; this.newargs = newargs; this.newtype = newtype; this.arguments = arguments; } static NewExp create(Loc loc, Expression thisexp, Expressions* newargs, Type newtype, Expressions* arguments) { return new NewExp(loc, thisexp, newargs, newtype, arguments); } override NewExp syntaxCopy() { return new NewExp(loc, thisexp ? thisexp.syntaxCopy() : null, arraySyntaxCopy(newargs), newtype.syntaxCopy(), arraySyntaxCopy(arguments)); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * thisexp.new(newargs) class baseclasses { } (arguments) */ extern (C++) final class NewAnonClassExp : Expression { Expression thisexp; // if !=null, 'this' for class being allocated Expressions* newargs; // Array of Expression's to call new operator ClassDeclaration cd; // class being instantiated Expressions* arguments; // Array of Expression's to call class constructor extern (D) this(const ref Loc loc, Expression thisexp, Expressions* newargs, ClassDeclaration cd, Expressions* arguments) { super(loc, TOK.newAnonymousClass, __traits(classInstanceSize, NewAnonClassExp)); this.thisexp = thisexp; this.newargs = newargs; this.cd = cd; this.arguments = arguments; } override NewAnonClassExp syntaxCopy() { return new NewAnonClassExp(loc, thisexp ? thisexp.syntaxCopy() : null, arraySyntaxCopy(newargs), cd.syntaxCopy(null), arraySyntaxCopy(arguments)); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) class SymbolExp : Expression { Declaration var; Dsymbol originalScope; // original scope before inlining bool hasOverloads; extern (D) this(const ref Loc loc, TOK op, int size, Declaration var, bool hasOverloads) { super(loc, op, size); assert(var); this.var = var; this.hasOverloads = hasOverloads; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Offset from symbol */ extern (C++) final class SymOffExp : SymbolExp { dinteger_t offset; extern (D) this(const ref Loc loc, Declaration var, dinteger_t offset, bool hasOverloads = true) { if (auto v = var.isVarDeclaration()) { // FIXME: This error report will never be handled anyone. // It should be done before the SymOffExp construction. if (v.needThis()) .error(loc, "need `this` for address of `%s`", v.toChars()); hasOverloads = false; } super(loc, TOK.symbolOffset, __traits(classInstanceSize, SymOffExp), var, hasOverloads); this.offset = offset; } override bool isBool(bool result) { return result ? true : false; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Variable */ extern (C++) final class VarExp : SymbolExp { bool delegateWasExtracted; extern (D) this(const ref Loc loc, Declaration var, bool hasOverloads = true) { if (var.isVarDeclaration()) hasOverloads = false; super(loc, TOK.variable, __traits(classInstanceSize, VarExp), var, hasOverloads); //printf("VarExp(this = %p, '%s', loc = %s)\n", this, var.toChars(), loc.toChars()); //if (strcmp(var.ident.toChars(), "func") == 0) assert(0); this.type = var.type; } static VarExp create(Loc loc, Declaration var, bool hasOverloads = true) { return new VarExp(loc, var, hasOverloads); } override bool equals(const RootObject o) const { if (this == o) return true; if (auto ne = o.isExpression().isVarExp()) { if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && var == ne.var) { return true; } } return false; } override Modifiable checkModifiable(Scope* sc, int flag) { //printf("VarExp::checkModifiable %s", toChars()); assert(type); return var.checkModify(loc, sc, null, flag); } override bool isLvalue() { if (var.storage_class & (STC.lazy_ | STC.rvalue | STC.manifest)) return false; return true; } override Expression toLvalue(Scope* sc, Expression e) { if (var.storage_class & STC.manifest) { error("manifest constant `%s` cannot be modified", var.toChars()); return ErrorExp.get(); } if (var.storage_class & STC.lazy_ && !delegateWasExtracted) { error("lazy variable `%s` cannot be modified", var.toChars()); return ErrorExp.get(); } if (var.ident == Id.ctfe) { error("cannot modify compiler-generated variable `__ctfe`"); return ErrorExp.get(); } if (var.ident == Id.dollar) // https://issues.dlang.org/show_bug.cgi?id=13574 { error("cannot modify operator `$`"); return ErrorExp.get(); } return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { //printf("VarExp::modifiableLvalue('%s')\n", var.toChars()); if (var.storage_class & STC.manifest) { error("cannot modify manifest constant `%s`", toChars()); return ErrorExp.get(); } // See if this expression is a modifiable lvalue (i.e. not const) return Expression.modifiableLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Overload Set */ extern (C++) final class OverExp : Expression { OverloadSet vars; extern (D) this(const ref Loc loc, OverloadSet s) { super(loc, TOK.overloadSet, __traits(classInstanceSize, OverExp)); //printf("OverExp(this = %p, '%s')\n", this, var.toChars()); vars = s; type = Type.tvoid; } override bool isLvalue() { return true; } override Expression toLvalue(Scope* sc, Expression e) { return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Function/Delegate literal */ extern (C++) final class FuncExp : Expression { FuncLiteralDeclaration fd; TemplateDeclaration td; TOK tok; extern (D) this(const ref Loc loc, Dsymbol s) { super(loc, TOK.function_, __traits(classInstanceSize, FuncExp)); this.td = s.isTemplateDeclaration(); this.fd = s.isFuncLiteralDeclaration(); if (td) { assert(td.literal); assert(td.members && td.members.dim == 1); fd = (*td.members)[0].isFuncLiteralDeclaration(); } tok = fd.tok; // save original kind of function/delegate/(infer) assert(fd.fbody); } override bool equals(const RootObject o) const { if (this == o) return true; auto e = o.isExpression(); if (!e) return false; if (auto fe = e.isFuncExp()) { return fd == fe.fd; } return false; } extern (D) void genIdent(Scope* sc) { if (fd.ident == Id.empty) { const(char)[] s; if (fd.fes) s = "__foreachbody"; else if (fd.tok == TOK.reserved) s = "__lambda"; else if (fd.tok == TOK.delegate_) s = "__dgliteral"; else s = "__funcliteral"; DsymbolTable symtab; if (FuncDeclaration func = sc.parent.isFuncDeclaration()) { if (func.localsymtab is null) { // Inside template constraint, symtab is not set yet. // Initialize it lazily. func.localsymtab = new DsymbolTable(); } symtab = func.localsymtab; } else { ScopeDsymbol sds = sc.parent.isScopeDsymbol(); if (!sds.symtab) { // Inside template constraint, symtab may not be set yet. // Initialize it lazily. assert(sds.isTemplateInstance()); sds.symtab = new DsymbolTable(); } symtab = sds.symtab; } assert(symtab); Identifier id = Identifier.generateId(s, symtab.length() + 1); fd.ident = id; if (td) td.ident = id; symtab.insert(td ? cast(Dsymbol)td : cast(Dsymbol)fd); } } override FuncExp syntaxCopy() { if (td) return new FuncExp(loc, td.syntaxCopy(null)); else if (fd.semanticRun == PASS.init) return new FuncExp(loc, fd.syntaxCopy(null)); else // https://issues.dlang.org/show_bug.cgi?id=13481 // Prevent multiple semantic analysis of lambda body. return new FuncExp(loc, fd); } extern (D) MATCH matchType(Type to, Scope* sc, FuncExp* presult, int flag = 0) { static MATCH cannotInfer(Expression e, Type to, int flag) { if (!flag) e.error("cannot infer parameter types from `%s`", to.toChars()); return MATCH.nomatch; } //printf("FuncExp::matchType('%s'), to=%s\n", type ? type.toChars() : "null", to.toChars()); if (presult) *presult = null; TypeFunction tof = null; if (to.ty == Tdelegate) { if (tok == TOK.function_) { if (!flag) error("cannot match function literal to delegate type `%s`", to.toChars()); return MATCH.nomatch; } tof = cast(TypeFunction)to.nextOf(); } else if (to.ty == Tpointer && (tof = to.nextOf().isTypeFunction()) !is null) { if (tok == TOK.delegate_) { if (!flag) error("cannot match delegate literal to function pointer type `%s`", to.toChars()); return MATCH.nomatch; } } if (td) { if (!tof) { return cannotInfer(this, to, flag); } // Parameter types inference from 'tof' assert(td._scope); TypeFunction tf = fd.type.isTypeFunction(); //printf("\ttof = %s\n", tof.toChars()); //printf("\ttf = %s\n", tf.toChars()); const dim = tf.parameterList.length; if (tof.parameterList.length != dim || tof.parameterList.varargs != tf.parameterList.varargs) return cannotInfer(this, to, flag); auto tiargs = new Objects(); tiargs.reserve(td.parameters.dim); foreach (tp; *td.parameters) { size_t u = 0; foreach (i, p; tf.parameterList) { if (auto ti = p.type.isTypeIdentifier()) if (ti && ti.ident == tp.ident) break; ++u; } assert(u < dim); Parameter pto = tof.parameterList[u]; Type t = pto.type; if (t.ty == Terror) return cannotInfer(this, to, flag); tiargs.push(t); } // Set target of return type inference if (!tf.next && tof.next) fd.treq = to; auto ti = new TemplateInstance(loc, td, tiargs); Expression ex = (new ScopeExp(loc, ti)).expressionSemantic(td._scope); // Reset inference target for the later re-semantic fd.treq = null; if (ex.op == TOK.error) return MATCH.nomatch; if (auto ef = ex.isFuncExp()) return ef.matchType(to, sc, presult, flag); else return cannotInfer(this, to, flag); } if (!tof || !tof.next) return MATCH.nomatch; assert(type && type != Type.tvoid); if (fd.type.ty == Terror) return MATCH.nomatch; auto tfx = fd.type.isTypeFunction(); bool convertMatch = (type.ty != to.ty); if (fd.inferRetType && tfx.next.implicitConvTo(tof.next) == MATCH.convert) { /* If return type is inferred and covariant return, * tweak return statements to required return type. * * interface I {} * class C : Object, I{} * * I delegate() dg = delegate() { return new class C(); } */ convertMatch = true; auto tfy = new TypeFunction(tfx.parameterList, tof.next, tfx.linkage, STC.undefined_); tfy.mod = tfx.mod; tfy.isnothrow = tfx.isnothrow; tfy.isnogc = tfx.isnogc; tfy.purity = tfx.purity; tfy.isproperty = tfx.isproperty; tfy.isref = tfx.isref; tfy.isInOutParam = tfx.isInOutParam; tfy.isInOutQual = tfx.isInOutQual; tfy.deco = tfy.merge().deco; tfx = tfy; } Type tx; if (tok == TOK.delegate_ || tok == TOK.reserved && (type.ty == Tdelegate || type.ty == Tpointer && to.ty == Tdelegate)) { // Allow conversion from implicit function pointer to delegate tx = new TypeDelegate(tfx); tx.deco = tx.merge().deco; } else { assert(tok == TOK.function_ || tok == TOK.reserved && type.ty == Tpointer); tx = tfx.pointerTo(); } //printf("\ttx = %s, to = %s\n", tx.toChars(), to.toChars()); MATCH m = tx.implicitConvTo(to); if (m > MATCH.nomatch) { // MATCH.exact: exact type match // MATCH.constant: covairiant type match (eg. attributes difference) // MATCH.convert: context conversion m = convertMatch ? MATCH.convert : tx.equals(to) ? MATCH.exact : MATCH.constant; if (presult) { (*presult) = cast(FuncExp)copy(); (*presult).type = to; // https://issues.dlang.org/show_bug.cgi?id=12508 // Tweak function body for covariant returns. (*presult).fd.modifyReturns(sc, tof.next); } } else if (!flag) { auto ts = toAutoQualChars(tx, to); error("cannot implicitly convert expression `%s` of type `%s` to `%s`", toChars(), ts[0], ts[1]); } return m; } override const(char)* toChars() const { return fd.toChars(); } override bool checkType() { if (td) { error("template lambda has no type"); return true; } return false; } override bool checkValue() { if (td) { error("template lambda has no value"); return true; } return false; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Declaration of a symbol * * D grammar allows declarations only as statements. However in AST representation * it can be part of any expression. This is used, for example, during internal * syntax re-writes to inject hidden symbols. */ extern (C++) final class DeclarationExp : Expression { Dsymbol declaration; extern (D) this(const ref Loc loc, Dsymbol declaration) { super(loc, TOK.declaration, __traits(classInstanceSize, DeclarationExp)); this.declaration = declaration; } override DeclarationExp syntaxCopy() { return new DeclarationExp(loc, declaration.syntaxCopy(null)); } override bool hasCode() { if (auto vd = declaration.isVarDeclaration()) { return !(vd.storage_class & (STC.manifest | STC.static_)); } return false; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * typeid(int) */ extern (C++) final class TypeidExp : Expression { RootObject obj; extern (D) this(const ref Loc loc, RootObject o) { super(loc, TOK.typeid_, __traits(classInstanceSize, TypeidExp)); this.obj = o; } override TypeidExp syntaxCopy() { return new TypeidExp(loc, objectSyntaxCopy(obj)); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * __traits(identifier, args...) */ extern (C++) final class TraitsExp : Expression { Identifier ident; Objects* args; extern (D) this(const ref Loc loc, Identifier ident, Objects* args) { super(loc, TOK.traits, __traits(classInstanceSize, TraitsExp)); this.ident = ident; this.args = args; } override TraitsExp syntaxCopy() { return new TraitsExp(loc, ident, TemplateInstance.arraySyntaxCopy(args)); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class HaltExp : Expression { extern (D) this(const ref Loc loc) { super(loc, TOK.halt, __traits(classInstanceSize, HaltExp)); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * is(targ id tok tspec) * is(targ id == tok2) */ extern (C++) final class IsExp : Expression { Type targ; Identifier id; // can be null Type tspec; // can be null TemplateParameters* parameters; TOK tok; // ':' or '==' TOK tok2; // 'struct', 'union', etc. extern (D) this(const ref Loc loc, Type targ, Identifier id, TOK tok, Type tspec, TOK tok2, TemplateParameters* parameters) { super(loc, TOK.is_, __traits(classInstanceSize, IsExp)); this.targ = targ; this.id = id; this.tok = tok; this.tspec = tspec; this.tok2 = tok2; this.parameters = parameters; } override IsExp syntaxCopy() { // This section is identical to that in TemplateDeclaration::syntaxCopy() TemplateParameters* p = null; if (parameters) { p = new TemplateParameters(parameters.dim); foreach (i, el; *parameters) (*p)[i] = el.syntaxCopy(); } return new IsExp(loc, targ.syntaxCopy(), id, tok, tspec ? tspec.syntaxCopy() : null, tok2, p); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) abstract class UnaExp : Expression { Expression e1; Type att1; // Save alias this type to detect recursion extern (D) this(const ref Loc loc, TOK op, int size, Expression e1) { super(loc, op, size); this.e1 = e1; } override UnaExp syntaxCopy() { UnaExp e = cast(UnaExp)copy(); e.type = null; e.e1 = e.e1.syntaxCopy(); return e; } /******************************** * The type for a unary expression is incompatible. * Print error message. * Returns: * ErrorExp */ final Expression incompatibleTypes() { if (e1.type.toBasetype() == Type.terror) return e1; if (e1.op == TOK.type) { error("incompatible type for `%s(%s)`: cannot use `%s` with types", Token.toChars(op), e1.toChars(), Token.toChars(op)); } else { error("incompatible type for `%s(%s)`: `%s`", Token.toChars(op), e1.toChars(), e1.type.toChars()); } return ErrorExp.get(); } /********************* * Mark the operand as will never be dereferenced, * which is useful info for @safe checks. * Do before semantic() on operands rewrites them. */ final void setNoderefOperand() { if (auto edi = e1.isDotIdExp()) edi.noderef = true; } override final Expression resolveLoc(const ref Loc loc, Scope* sc) { e1 = e1.resolveLoc(loc, sc); return this; } override void accept(Visitor v) { v.visit(this); } } alias fp_t = UnionExp function(const ref Loc loc, Type, Expression, Expression); alias fp2_t = bool function(const ref Loc loc, TOK, Expression, Expression); /*********************************************************** */ extern (C++) abstract class BinExp : Expression { Expression e1; Expression e2; Type att1; // Save alias this type to detect recursion Type att2; // Save alias this type to detect recursion extern (D) this(const ref Loc loc, TOK op, int size, Expression e1, Expression e2) { super(loc, op, size); this.e1 = e1; this.e2 = e2; } override BinExp syntaxCopy() { BinExp e = cast(BinExp)copy(); e.type = null; e.e1 = e.e1.syntaxCopy(); e.e2 = e.e2.syntaxCopy(); return e; } /******************************** * The types for a binary expression are incompatible. * Print error message. * Returns: * ErrorExp */ final Expression incompatibleTypes() { if (e1.type.toBasetype() == Type.terror) return e1; if (e2.type.toBasetype() == Type.terror) return e2; // CondExp uses 'a ? b : c' but we're comparing 'b : c' TOK thisOp = (op == TOK.question) ? TOK.colon : op; if (e1.op == TOK.type || e2.op == TOK.type) { error("incompatible types for `(%s) %s (%s)`: cannot use `%s` with types", e1.toChars(), Token.toChars(thisOp), e2.toChars(), Token.toChars(op)); } else if (e1.type.equals(e2.type)) { error("incompatible types for `(%s) %s (%s)`: both operands are of type `%s`", e1.toChars(), Token.toChars(thisOp), e2.toChars(), e1.type.toChars()); } else { auto ts = toAutoQualChars(e1.type, e2.type); error("incompatible types for `(%s) %s (%s)`: `%s` and `%s`", e1.toChars(), Token.toChars(thisOp), e2.toChars(), ts[0], ts[1]); } return ErrorExp.get(); } extern (D) final Expression checkOpAssignTypes(Scope* sc) { // At that point t1 and t2 are the merged types. type is the original type of the lhs. Type t1 = e1.type; Type t2 = e2.type; // T opAssign floating yields a floating. Prevent truncating conversions (float to int). // See issue 3841. // Should we also prevent double to float (type.isfloating() && type.size() < t2.size()) ? if (op == TOK.addAssign || op == TOK.minAssign || op == TOK.mulAssign || op == TOK.divAssign || op == TOK.modAssign || op == TOK.powAssign) { if ((type.isintegral() && t2.isfloating())) { warning("`%s %s %s` is performing truncating conversion", type.toChars(), Token.toChars(op), t2.toChars()); } } // generate an error if this is a nonsensical *=,/=, or %=, eg real *= imaginary if (op == TOK.mulAssign || op == TOK.divAssign || op == TOK.modAssign) { // Any multiplication by an imaginary or complex number yields a complex result. // r *= c, i*=c, r*=i, i*=i are all forbidden operations. const(char)* opstr = Token.toChars(op); if (t1.isreal() && t2.iscomplex()) { error("`%s %s %s` is undefined. Did you mean `%s %s %s.re`?", t1.toChars(), opstr, t2.toChars(), t1.toChars(), opstr, t2.toChars()); return ErrorExp.get(); } else if (t1.isimaginary() && t2.iscomplex()) { error("`%s %s %s` is undefined. Did you mean `%s %s %s.im`?", t1.toChars(), opstr, t2.toChars(), t1.toChars(), opstr, t2.toChars()); return ErrorExp.get(); } else if ((t1.isreal() || t1.isimaginary()) && t2.isimaginary()) { error("`%s %s %s` is an undefined operation", t1.toChars(), opstr, t2.toChars()); return ErrorExp.get(); } } // generate an error if this is a nonsensical += or -=, eg real += imaginary if (op == TOK.addAssign || op == TOK.minAssign) { // Addition or subtraction of a real and an imaginary is a complex result. // Thus, r+=i, r+=c, i+=r, i+=c are all forbidden operations. if ((t1.isreal() && (t2.isimaginary() || t2.iscomplex())) || (t1.isimaginary() && (t2.isreal() || t2.iscomplex()))) { error("`%s %s %s` is undefined (result is complex)", t1.toChars(), Token.toChars(op), t2.toChars()); return ErrorExp.get(); } if (type.isreal() || type.isimaginary()) { assert(global.errors || t2.isfloating()); e2 = e2.castTo(sc, t1); } } if (op == TOK.mulAssign) { if (t2.isfloating()) { if (t1.isreal()) { if (t2.isimaginary() || t2.iscomplex()) { e2 = e2.castTo(sc, t1); } } else if (t1.isimaginary()) { if (t2.isimaginary() || t2.iscomplex()) { switch (t1.ty) { case Timaginary32: t2 = Type.tfloat32; break; case Timaginary64: t2 = Type.tfloat64; break; case Timaginary80: t2 = Type.tfloat80; break; default: assert(0); } e2 = e2.castTo(sc, t2); } } } } else if (op == TOK.divAssign) { if (t2.isimaginary()) { if (t1.isreal()) { // x/iv = i(-x/v) // Therefore, the result is 0 e2 = new CommaExp(loc, e2, new RealExp(loc, CTFloat.zero, t1)); e2.type = t1; Expression e = new AssignExp(loc, e1, e2); e.type = t1; return e; } else if (t1.isimaginary()) { Type t3; switch (t1.ty) { case Timaginary32: t3 = Type.tfloat32; break; case Timaginary64: t3 = Type.tfloat64; break; case Timaginary80: t3 = Type.tfloat80; break; default: assert(0); } e2 = e2.castTo(sc, t3); Expression e = new AssignExp(loc, e1, e2); e.type = t1; return e; } } } else if (op == TOK.modAssign) { if (t2.iscomplex()) { error("cannot perform modulo complex arithmetic"); return ErrorExp.get(); } } return this; } extern (D) final bool checkIntegralBin() { bool r1 = e1.checkIntegral(); bool r2 = e2.checkIntegral(); return (r1 || r2); } extern (D) final bool checkArithmeticBin() { bool r1 = e1.checkArithmetic(); bool r2 = e2.checkArithmetic(); return (r1 || r2); } extern (D) final bool checkSharedAccessBin(Scope* sc) { const r1 = e1.checkSharedAccess(sc); const r2 = e2.checkSharedAccess(sc); return (r1 || r2); } /********************* * Mark the operands as will never be dereferenced, * which is useful info for @safe checks. * Do before semantic() on operands rewrites them. */ final void setNoderefOperands() { if (auto edi = e1.isDotIdExp()) edi.noderef = true; if (auto edi = e2.isDotIdExp()) edi.noderef = true; } final Expression reorderSettingAAElem(Scope* sc) { BinExp be = this; auto ie = be.e1.isIndexExp(); if (!ie) return be; if (ie.e1.type.toBasetype().ty != Taarray) return be; /* Fix evaluation order of setting AA element * https://issues.dlang.org/show_bug.cgi?id=3825 * Rewrite: * aa[k1][k2][k3] op= val; * as: * auto ref __aatmp = aa; * auto ref __aakey3 = k1, __aakey2 = k2, __aakey1 = k3; * auto ref __aaval = val; * __aatmp[__aakey3][__aakey2][__aakey1] op= __aaval; // assignment */ Expression e0; while (1) { Expression de; ie.e2 = extractSideEffect(sc, "__aakey", de, ie.e2); e0 = Expression.combine(de, e0); auto ie1 = ie.e1.isIndexExp(); if (!ie1 || ie1.e1.type.toBasetype().ty != Taarray) { break; } ie = ie1; } assert(ie.e1.type.toBasetype().ty == Taarray); Expression de; ie.e1 = extractSideEffect(sc, "__aatmp", de, ie.e1); e0 = Expression.combine(de, e0); be.e2 = extractSideEffect(sc, "__aaval", e0, be.e2, true); //printf("-e0 = %s, be = %s\n", e0.toChars(), be.toChars()); return Expression.combine(e0, be); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) class BinAssignExp : BinExp { extern (D) this(const ref Loc loc, TOK op, int size, Expression e1, Expression e2) { super(loc, op, size, e1, e2); } override final bool isLvalue() { return true; } override final Expression toLvalue(Scope* sc, Expression ex) { // Lvalue-ness will be handled in glue layer. return this; } override final Expression modifiableLvalue(Scope* sc, Expression e) { // should check e1.checkModifiable() ? return toLvalue(sc, this); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/expression.html#mixin_expressions */ extern (C++) final class MixinExp : Expression { Expressions* exps; extern (D) this(const ref Loc loc, Expressions* exps) { super(loc, TOK.mixin_, __traits(classInstanceSize, MixinExp)); this.exps = exps; } override MixinExp syntaxCopy() { return new MixinExp(loc, arraySyntaxCopy(exps)); } override bool equals(const RootObject o) const { if (this == o) return true; auto e = o.isExpression(); if (!e) return false; if (auto ce = e.isMixinExp()) { if (exps.dim != ce.exps.dim) return false; foreach (i, e1; *exps) { auto e2 = (*ce.exps)[i]; if (e1 != e2 && (!e1 || !e2 || !e1.equals(e2))) return false; } return true; } return false; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ImportExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, TOK.import_, __traits(classInstanceSize, ImportExp), e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * https://dlang.org/spec/expression.html#assert_expressions */ extern (C++) final class AssertExp : UnaExp { Expression msg; extern (D) this(const ref Loc loc, Expression e, Expression msg = null) { super(loc, TOK.assert_, __traits(classInstanceSize, AssertExp), e); this.msg = msg; } override AssertExp syntaxCopy() { return new AssertExp(loc, e1.syntaxCopy(), msg ? msg.syntaxCopy() : null); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DotIdExp : UnaExp { Identifier ident; bool noderef; // true if the result of the expression will never be dereferenced bool wantsym; // do not replace Symbol with its initializer during semantic() extern (D) this(const ref Loc loc, Expression e, Identifier ident) { super(loc, TOK.dotIdentifier, __traits(classInstanceSize, DotIdExp), e); this.ident = ident; } static DotIdExp create(Loc loc, Expression e, Identifier ident) { return new DotIdExp(loc, e, ident); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Mainly just a placeholder */ extern (C++) final class DotTemplateExp : UnaExp { TemplateDeclaration td; extern (D) this(const ref Loc loc, Expression e, TemplateDeclaration td) { super(loc, TOK.dotTemplateDeclaration, __traits(classInstanceSize, DotTemplateExp), e); this.td = td; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DotVarExp : UnaExp { Declaration var; bool hasOverloads; extern (D) this(const ref Loc loc, Expression e, Declaration var, bool hasOverloads = true) { if (var.isVarDeclaration()) hasOverloads = false; super(loc, TOK.dotVariable, __traits(classInstanceSize, DotVarExp), e); //printf("DotVarExp()\n"); this.var = var; this.hasOverloads = hasOverloads; } override Modifiable checkModifiable(Scope* sc, int flag) { //printf("DotVarExp::checkModifiable %s %s\n", toChars(), type.toChars()); if (checkUnsafeAccess(sc, this, false, !flag)) return Modifiable.initialization; if (e1.op == TOK.this_) return var.checkModify(loc, sc, e1, flag); /* https://issues.dlang.org/show_bug.cgi?id=12764 * If inside a constructor and an expression of type `this.field.var` * is encountered, where `field` is a struct declaration with * default construction disabled, we must make sure that * assigning to `var` does not imply that `field` was initialized */ if (sc.func && sc.func.isCtorDeclaration()) { // if inside a constructor scope and e1 of this DotVarExp // is a DotVarExp, then check if e1.e1 is a `this` identifier if (auto dve = e1.isDotVarExp()) { if (dve.e1.op == TOK.this_) { scope v = dve.var.isVarDeclaration(); /* if v is a struct member field with no initializer, no default construction * and v wasn't intialized before */ if (v && v.isField() && !v._init && !v.ctorinit) { if (auto ts = v.type.isTypeStruct()) { if (ts.sym.noDefaultCtor) { /* checkModify will consider that this is an initialization * of v while it is actually an assignment of a field of v */ scope modifyLevel = v.checkModify(loc, sc, dve.e1, flag); // reflect that assigning a field of v is not initialization of v v.ctorinit = false; if (modifyLevel == Modifiable.initialization) return Modifiable.yes; return modifyLevel; } } } } } } //printf("\te1 = %s\n", e1.toChars()); return e1.checkModifiable(sc, flag); } override bool isLvalue() { if (e1.op != TOK.structLiteral) return true; auto vd = var.isVarDeclaration(); return !(vd && vd.isField()); } override Expression toLvalue(Scope* sc, Expression e) { //printf("DotVarExp::toLvalue(%s)\n", toChars()); if (!isLvalue()) return Expression.toLvalue(sc, e); if (e1.op == TOK.this_ && sc.ctorflow.fieldinit.length && !(sc.ctorflow.callSuper & CSX.any_ctor)) { if (VarDeclaration vd = var.isVarDeclaration()) { auto ad = vd.isMember2(); if (ad && ad.fields.dim == sc.ctorflow.fieldinit.length) { foreach (i, f; ad.fields) { if (f == vd) { if (!(sc.ctorflow.fieldinit[i].csx & CSX.this_ctor)) { /* If the address of vd is taken, assume it is thereby initialized * https://issues.dlang.org/show_bug.cgi?id=15869 */ modifyFieldVar(loc, sc, vd, e1); } break; } } } } } return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { version (none) { printf("DotVarExp::modifiableLvalue(%s)\n", toChars()); printf("e1.type = %s\n", e1.type.toChars()); printf("var.type = %s\n", var.type.toChars()); } return Expression.modifiableLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * foo.bar!(args) */ extern (C++) final class DotTemplateInstanceExp : UnaExp { TemplateInstance ti; extern (D) this(const ref Loc loc, Expression e, Identifier name, Objects* tiargs) { super(loc, TOK.dotTemplateInstance, __traits(classInstanceSize, DotTemplateInstanceExp), e); //printf("DotTemplateInstanceExp()\n"); this.ti = new TemplateInstance(loc, name, tiargs); } extern (D) this(const ref Loc loc, Expression e, TemplateInstance ti) { super(loc, TOK.dotTemplateInstance, __traits(classInstanceSize, DotTemplateInstanceExp), e); this.ti = ti; } override DotTemplateInstanceExp syntaxCopy() { return new DotTemplateInstanceExp(loc, e1.syntaxCopy(), ti.name, TemplateInstance.arraySyntaxCopy(ti.tiargs)); } bool findTempDecl(Scope* sc) { static if (LOGSEMANTIC) { printf("DotTemplateInstanceExp::findTempDecl('%s')\n", toChars()); } if (ti.tempdecl) return true; Expression e = new DotIdExp(loc, e1, ti.name); e = e.expressionSemantic(sc); if (e.op == TOK.dot) e = (cast(DotExp)e).e2; Dsymbol s = null; switch (e.op) { case TOK.overloadSet: s = (cast(OverExp)e).vars; break; case TOK.dotTemplateDeclaration: s = (cast(DotTemplateExp)e).td; break; case TOK.scope_: s = (cast(ScopeExp)e).sds; break; case TOK.dotVariable: s = (cast(DotVarExp)e).var; break; case TOK.variable: s = (cast(VarExp)e).var; break; default: return false; } return ti.updateTempDecl(sc, s); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DelegateExp : UnaExp { FuncDeclaration func; bool hasOverloads; VarDeclaration vthis2; // container for multi-context extern (D) this(const ref Loc loc, Expression e, FuncDeclaration f, bool hasOverloads = true, VarDeclaration vthis2 = null) { super(loc, TOK.delegate_, __traits(classInstanceSize, DelegateExp), e); this.func = f; this.hasOverloads = hasOverloads; this.vthis2 = vthis2; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DotTypeExp : UnaExp { Dsymbol sym; // symbol that represents a type extern (D) this(const ref Loc loc, Expression e, Dsymbol s) { super(loc, TOK.dotType, __traits(classInstanceSize, DotTypeExp), e); this.sym = s; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class CallExp : UnaExp { Expressions* arguments; // function arguments FuncDeclaration f; // symbol to call bool directcall; // true if a virtual call is devirtualized bool inDebugStatement; /// true if this was in a debug statement VarDeclaration vthis2; // container for multi-context extern (D) this(const ref Loc loc, Expression e, Expressions* exps) { super(loc, TOK.call, __traits(classInstanceSize, CallExp), e); this.arguments = exps; } extern (D) this(const ref Loc loc, Expression e) { super(loc, TOK.call, __traits(classInstanceSize, CallExp), e); } extern (D) this(const ref Loc loc, Expression e, Expression earg1) { super(loc, TOK.call, __traits(classInstanceSize, CallExp), e); this.arguments = new Expressions(); if (earg1) this.arguments.push(earg1); } extern (D) this(const ref Loc loc, Expression e, Expression earg1, Expression earg2) { super(loc, TOK.call, __traits(classInstanceSize, CallExp), e); auto arguments = new Expressions(2); (*arguments)[0] = earg1; (*arguments)[1] = earg2; this.arguments = arguments; } /*********************************************************** * Instatiates a new function call expression * Params: * loc = location * fd = the declaration of the function to call * earg1 = the function argument */ extern(D) this(const ref Loc loc, FuncDeclaration fd, Expression earg1) { this(loc, new VarExp(loc, fd, false), earg1); this.f = fd; } static CallExp create(Loc loc, Expression e, Expressions* exps) { return new CallExp(loc, e, exps); } static CallExp create(Loc loc, Expression e) { return new CallExp(loc, e); } static CallExp create(Loc loc, Expression e, Expression earg1) { return new CallExp(loc, e, earg1); } /*********************************************************** * Creates a new function call expression * Params: * loc = location * fd = the declaration of the function to call * earg1 = the function argument */ static CallExp create(Loc loc, FuncDeclaration fd, Expression earg1) { return new CallExp(loc, fd, earg1); } override CallExp syntaxCopy() { return new CallExp(loc, e1.syntaxCopy(), arraySyntaxCopy(arguments)); } override bool isLvalue() { Type tb = e1.type.toBasetype(); if (tb.ty == Tdelegate || tb.ty == Tpointer) tb = tb.nextOf(); auto tf = tb.isTypeFunction(); if (tf && tf.isref) { if (auto dve = e1.isDotVarExp()) if (dve.var.isCtorDeclaration()) return false; return true; // function returns a reference } return false; } override Expression toLvalue(Scope* sc, Expression e) { if (isLvalue()) return this; return Expression.toLvalue(sc, e); } override Expression addDtorHook(Scope* sc) { /* Only need to add dtor hook if it's a type that needs destruction. * Use same logic as VarDeclaration::callScopeDtor() */ if (auto tf = e1.type.isTypeFunction()) { if (tf.isref) return this; } Type tv = type.baseElemOf(); if (auto ts = tv.isTypeStruct()) { StructDeclaration sd = ts.sym; if (sd.dtor) { /* Type needs destruction, so declare a tmp * which the back end will recognize and call dtor on */ auto tmp = copyToTemp(0, "__tmpfordtor", this); auto de = new DeclarationExp(loc, tmp); auto ve = new VarExp(loc, tmp); Expression e = new CommaExp(loc, de, ve); e = e.expressionSemantic(sc); return e; } } return this; } override void accept(Visitor v) { v.visit(this); } } FuncDeclaration isFuncAddress(Expression e, bool* hasOverloads = null) { if (auto ae = e.isAddrExp()) { auto ae1 = ae.e1; if (auto ve = ae1.isVarExp()) { if (hasOverloads) *hasOverloads = ve.hasOverloads; return ve.var.isFuncDeclaration(); } if (auto dve = ae1.isDotVarExp()) { if (hasOverloads) *hasOverloads = dve.hasOverloads; return dve.var.isFuncDeclaration(); } } else { if (auto soe = e.isSymOffExp()) { if (hasOverloads) *hasOverloads = soe.hasOverloads; return soe.var.isFuncDeclaration(); } if (auto dge = e.isDelegateExp()) { if (hasOverloads) *hasOverloads = dge.hasOverloads; return dge.func.isFuncDeclaration(); } } return null; } /*********************************************************** */ extern (C++) final class AddrExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, TOK.address, __traits(classInstanceSize, AddrExp), e); } extern (D) this(const ref Loc loc, Expression e, Type t) { this(loc, e); type = t; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class PtrExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, TOK.star, __traits(classInstanceSize, PtrExp), e); //if (e.type) // type = ((TypePointer *)e.type).next; } extern (D) this(const ref Loc loc, Expression e, Type t) { super(loc, TOK.star, __traits(classInstanceSize, PtrExp), e); type = t; } override Modifiable checkModifiable(Scope* sc, int flag) { if (auto se = e1.isSymOffExp()) { return se.var.checkModify(loc, sc, null, flag); } else if (auto ae = e1.isAddrExp()) { return ae.e1.checkModifiable(sc, flag); } return Modifiable.yes; } override bool isLvalue() { return true; } override Expression toLvalue(Scope* sc, Expression e) { return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { //printf("PtrExp::modifiableLvalue() %s, type %s\n", toChars(), type.toChars()); return Expression.modifiableLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class NegExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, TOK.negate, __traits(classInstanceSize, NegExp), e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class UAddExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, TOK.uadd, __traits(classInstanceSize, UAddExp), e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ComExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, TOK.tilde, __traits(classInstanceSize, ComExp), e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class NotExp : UnaExp { extern (D) this(const ref Loc loc, Expression e) { super(loc, TOK.not, __traits(classInstanceSize, NotExp), e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DeleteExp : UnaExp { bool isRAII; // true if called automatically as a result of scoped destruction extern (D) this(const ref Loc loc, Expression e, bool isRAII) { super(loc, TOK.delete_, __traits(classInstanceSize, DeleteExp), e); this.isRAII = isRAII; } override Expression toBoolean(Scope* sc) { error("`delete` does not give a boolean result"); return ErrorExp.get(); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * Possible to cast to one type while painting to another type */ extern (C++) final class CastExp : UnaExp { Type to; // type to cast to ubyte mod = cast(ubyte)~0; // MODxxxxx extern (D) this(const ref Loc loc, Expression e, Type t) { super(loc, TOK.cast_, __traits(classInstanceSize, CastExp), e); this.to = t; } /* For cast(const) and cast(immutable) */ extern (D) this(const ref Loc loc, Expression e, ubyte mod) { super(loc, TOK.cast_, __traits(classInstanceSize, CastExp), e); this.mod = mod; } override CastExp syntaxCopy() { return to ? new CastExp(loc, e1.syntaxCopy(), to.syntaxCopy()) : new CastExp(loc, e1.syntaxCopy(), mod); } override bool isLvalue() { //printf("e1.type = %s, to.type = %s\n", e1.type.toChars(), to.toChars()); if (!e1.isLvalue()) return false; return (to.ty == Tsarray && (e1.type.ty == Tvector || e1.type.ty == Tsarray)) || e1.type.mutableOf().unSharedOf().equals(to.mutableOf().unSharedOf()); } override Expression toLvalue(Scope* sc, Expression e) { if (isLvalue()) return this; return Expression.toLvalue(sc, e); } override Expression addDtorHook(Scope* sc) { if (to.toBasetype().ty == Tvoid) // look past the cast(void) e1 = e1.addDtorHook(sc); return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class VectorExp : UnaExp { TypeVector to; // the target vector type before semantic() uint dim = ~0; // number of elements in the vector OwnedBy ownedByCtfe = OwnedBy.code; extern (D) this(const ref Loc loc, Expression e, Type t) { super(loc, TOK.vector, __traits(classInstanceSize, VectorExp), e); assert(t.ty == Tvector); to = cast(TypeVector)t; } static VectorExp create(Loc loc, Expression e, Type t) { return new VectorExp(loc, e, t); } // Same as create, but doesn't allocate memory. static void emplace(UnionExp* pue, Loc loc, Expression e, Type type) { emplaceExp!(VectorExp)(pue, loc, e, type); } override VectorExp syntaxCopy() { return new VectorExp(loc, e1.syntaxCopy(), to.syntaxCopy()); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * e1.array property for vectors. * * https://dlang.org/spec/simd.html#properties */ extern (C++) final class VectorArrayExp : UnaExp { extern (D) this(const ref Loc loc, Expression e1) { super(loc, TOK.vectorArray, __traits(classInstanceSize, VectorArrayExp), e1); } override bool isLvalue() { return e1.isLvalue(); } override Expression toLvalue(Scope* sc, Expression e) { e1 = e1.toLvalue(sc, e); return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * e1 [lwr .. upr] * * http://dlang.org/spec/expression.html#slice_expressions */ extern (C++) final class SliceExp : UnaExp { Expression upr; // null if implicit 0 Expression lwr; // null if implicit [length - 1] VarDeclaration lengthVar; bool upperIsInBounds; // true if upr <= e1.length bool lowerIsLessThanUpper; // true if lwr <= upr bool arrayop; // an array operation, rather than a slice /************************************************************/ extern (D) this(const ref Loc loc, Expression e1, IntervalExp ie) { super(loc, TOK.slice, __traits(classInstanceSize, SliceExp), e1); this.upr = ie ? ie.upr : null; this.lwr = ie ? ie.lwr : null; } extern (D) this(const ref Loc loc, Expression e1, Expression lwr, Expression upr) { super(loc, TOK.slice, __traits(classInstanceSize, SliceExp), e1); this.upr = upr; this.lwr = lwr; } override SliceExp syntaxCopy() { auto se = new SliceExp(loc, e1.syntaxCopy(), lwr ? lwr.syntaxCopy() : null, upr ? upr.syntaxCopy() : null); se.lengthVar = this.lengthVar; // bug7871 return se; } override Modifiable checkModifiable(Scope* sc, int flag) { //printf("SliceExp::checkModifiable %s\n", toChars()); if (e1.type.ty == Tsarray || (e1.op == TOK.index && e1.type.ty != Tarray) || e1.op == TOK.slice) { return e1.checkModifiable(sc, flag); } return Modifiable.yes; } override bool isLvalue() { /* slice expression is rvalue in default, but * conversion to reference of static array is only allowed. */ return (type && type.toBasetype().ty == Tsarray); } override Expression toLvalue(Scope* sc, Expression e) { //printf("SliceExp::toLvalue(%s) type = %s\n", toChars(), type ? type.toChars() : NULL); return (type && type.toBasetype().ty == Tsarray) ? this : Expression.toLvalue(sc, e); } override Expression modifiableLvalue(Scope* sc, Expression e) { error("slice expression `%s` is not a modifiable lvalue", toChars()); return this; } override bool isBool(bool result) { return e1.isBool(result); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ArrayLengthExp : UnaExp { extern (D) this(const ref Loc loc, Expression e1) { super(loc, TOK.arrayLength, __traits(classInstanceSize, ArrayLengthExp), e1); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * e1 [ a0, a1, a2, a3 ,... ] * * http://dlang.org/spec/expression.html#index_expressions */ extern (C++) final class ArrayExp : UnaExp { Expressions* arguments; // Array of Expression's a0..an size_t currentDimension; // for opDollar VarDeclaration lengthVar; extern (D) this(const ref Loc loc, Expression e1, Expression index = null) { super(loc, TOK.array, __traits(classInstanceSize, ArrayExp), e1); arguments = new Expressions(); if (index) arguments.push(index); } extern (D) this(const ref Loc loc, Expression e1, Expressions* args) { super(loc, TOK.array, __traits(classInstanceSize, ArrayExp), e1); arguments = args; } override ArrayExp syntaxCopy() { auto ae = new ArrayExp(loc, e1.syntaxCopy(), arraySyntaxCopy(arguments)); ae.lengthVar = this.lengthVar; // bug7871 return ae; } override bool isLvalue() { if (type && type.toBasetype().ty == Tvoid) return false; return true; } override Expression toLvalue(Scope* sc, Expression e) { if (type && type.toBasetype().ty == Tvoid) error("`void`s have no value"); return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DotExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.dot, __traits(classInstanceSize, DotExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class CommaExp : BinExp { /// This is needed because AssignExp rewrites CommaExp, hence it needs /// to trigger the deprecation. const bool isGenerated; /// Temporary variable to enable / disable deprecation of comma expression /// depending on the context. /// Since most constructor calls are rewritting, the only place where /// false will be passed will be from the parser. bool allowCommaExp; extern (D) this(const ref Loc loc, Expression e1, Expression e2, bool generated = true) { super(loc, TOK.comma, __traits(classInstanceSize, CommaExp), e1, e2); allowCommaExp = isGenerated = generated; } override Modifiable checkModifiable(Scope* sc, int flag) { return e2.checkModifiable(sc, flag); } override bool isLvalue() { return e2.isLvalue(); } override Expression toLvalue(Scope* sc, Expression e) { e2 = e2.toLvalue(sc, null); return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { e2 = e2.modifiableLvalue(sc, e); return this; } override bool isBool(bool result) { return e2.isBool(result); } override Expression toBoolean(Scope* sc) { auto ex2 = e2.toBoolean(sc); if (ex2.op == TOK.error) return ex2; e2 = ex2; type = e2.type; return this; } override Expression addDtorHook(Scope* sc) { e2 = e2.addDtorHook(sc); return this; } override void accept(Visitor v) { v.visit(this); } /** * If the argument is a CommaExp, set a flag to prevent deprecation messages * * It's impossible to know from CommaExp.semantic if the result will * be used, hence when there is a result (type != void), a deprecation * message is always emitted. * However, some construct can produce a result but won't use it * (ExpStatement and for loop increment). Those should call this function * to prevent unwanted deprecations to be emitted. * * Params: * exp = An expression that discards its result. * If the argument is null or not a CommaExp, nothing happens. */ static void allow(Expression exp) { if (exp) if (auto ce = exp.isCommaExp()) ce.allowCommaExp = true; } } /*********************************************************** * Mainly just a placeholder */ extern (C++) final class IntervalExp : Expression { Expression lwr; Expression upr; extern (D) this(const ref Loc loc, Expression lwr, Expression upr) { super(loc, TOK.interval, __traits(classInstanceSize, IntervalExp)); this.lwr = lwr; this.upr = upr; } override Expression syntaxCopy() { return new IntervalExp(loc, lwr.syntaxCopy(), upr.syntaxCopy()); } override void accept(Visitor v) { v.visit(this); } } extern (C++) final class DelegatePtrExp : UnaExp { extern (D) this(const ref Loc loc, Expression e1) { super(loc, TOK.delegatePointer, __traits(classInstanceSize, DelegatePtrExp), e1); } override bool isLvalue() { return e1.isLvalue(); } override Expression toLvalue(Scope* sc, Expression e) { e1 = e1.toLvalue(sc, e); return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { if (sc.func.setUnsafe()) { error("cannot modify delegate pointer in `@safe` code `%s`", toChars()); return ErrorExp.get(); } return Expression.modifiableLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DelegateFuncptrExp : UnaExp { extern (D) this(const ref Loc loc, Expression e1) { super(loc, TOK.delegateFunctionPointer, __traits(classInstanceSize, DelegateFuncptrExp), e1); } override bool isLvalue() { return e1.isLvalue(); } override Expression toLvalue(Scope* sc, Expression e) { e1 = e1.toLvalue(sc, e); return this; } override Expression modifiableLvalue(Scope* sc, Expression e) { if (sc.func.setUnsafe()) { error("cannot modify delegate function pointer in `@safe` code `%s`", toChars()); return ErrorExp.get(); } return Expression.modifiableLvalue(sc, e); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * e1 [ e2 ] */ extern (C++) final class IndexExp : BinExp { VarDeclaration lengthVar; bool modifiable = false; // assume it is an rvalue bool indexIsInBounds; // true if 0 <= e2 && e2 <= e1.length - 1 extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.index, __traits(classInstanceSize, IndexExp), e1, e2); //printf("IndexExp::IndexExp('%s')\n", toChars()); } override IndexExp syntaxCopy() { auto ie = new IndexExp(loc, e1.syntaxCopy(), e2.syntaxCopy()); ie.lengthVar = this.lengthVar; // bug7871 return ie; } override Modifiable checkModifiable(Scope* sc, int flag) { if (e1.type.ty == Tsarray || e1.type.ty == Taarray || (e1.op == TOK.index && e1.type.ty != Tarray) || e1.op == TOK.slice) { return e1.checkModifiable(sc, flag); } return Modifiable.yes; } override bool isLvalue() { if (e1.op == TOK.assocArrayLiteral) return false; if (e1.type.ty == Tsarray || (e1.op == TOK.index && e1.type.ty != Tarray)) { return e1.isLvalue(); } return true; } override Expression toLvalue(Scope* sc, Expression e) { if (isLvalue()) return this; return Expression.toLvalue(sc, e); } override Expression modifiableLvalue(Scope* sc, Expression e) { //printf("IndexExp::modifiableLvalue(%s)\n", toChars()); Expression ex = markSettingAAElem(); if (ex.op == TOK.error) return ex; return Expression.modifiableLvalue(sc, e); } extern (D) Expression markSettingAAElem() { if (e1.type.toBasetype().ty == Taarray) { Type t2b = e2.type.toBasetype(); if (t2b.ty == Tarray && t2b.nextOf().isMutable()) { error("associative arrays can only be assigned values with immutable keys, not `%s`", e2.type.toChars()); return ErrorExp.get(); } modifiable = true; if (auto ie = e1.isIndexExp()) { Expression ex = ie.markSettingAAElem(); if (ex.op == TOK.error) return ex; assert(ex == e1); } } return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * For both i++ and i-- */ extern (C++) final class PostExp : BinExp { extern (D) this(TOK op, const ref Loc loc, Expression e) { super(loc, op, __traits(classInstanceSize, PostExp), e, IntegerExp.literal!1); assert(op == TOK.minusMinus || op == TOK.plusPlus); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * For both ++i and --i */ extern (C++) final class PreExp : UnaExp { extern (D) this(TOK op, const ref Loc loc, Expression e) { super(loc, op, __traits(classInstanceSize, PreExp), e); assert(op == TOK.preMinusMinus || op == TOK.prePlusPlus); } override void accept(Visitor v) { v.visit(this); } } enum MemorySet { none = 0, // simple assignment blockAssign = 1, // setting the contents of an array referenceInit = 2, // setting the reference of STC.ref_ variable } /*********************************************************** */ extern (C++) class AssignExp : BinExp { MemorySet memset; /************************************************************/ /* op can be TOK.assign, TOK.construct, or TOK.blit */ extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.assign, __traits(classInstanceSize, AssignExp), e1, e2); } this(const ref Loc loc, TOK tok, Expression e1, Expression e2) { super(loc, tok, __traits(classInstanceSize, AssignExp), e1, e2); } override final bool isLvalue() { // Array-op 'x[] = y[]' should make an rvalue. // Setting array length 'x.length = v' should make an rvalue. if (e1.op == TOK.slice || e1.op == TOK.arrayLength) { return false; } return true; } override final Expression toLvalue(Scope* sc, Expression ex) { if (e1.op == TOK.slice || e1.op == TOK.arrayLength) { return Expression.toLvalue(sc, ex); } /* In front-end level, AssignExp should make an lvalue of e1. * Taking the address of e1 will be handled in low level layer, * so this function does nothing. */ return this; } override final Expression toBoolean(Scope* sc) { // Things like: // if (a = b) ... // are usually mistakes. error("assignment cannot be used as a condition, perhaps `==` was meant?"); return ErrorExp.get(); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ConstructExp : AssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.construct, e1, e2); } // Internal use only. If `v` is a reference variable, the assignment // will become a reference initialization automatically. extern (D) this(const ref Loc loc, VarDeclaration v, Expression e2) { auto ve = new VarExp(loc, v); assert(v.type && ve.type); super(loc, TOK.construct, ve, e2); if (v.storage_class & (STC.ref_ | STC.out_)) memset = MemorySet.referenceInit; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class BlitExp : AssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.blit, e1, e2); } // Internal use only. If `v` is a reference variable, the assinment // will become a reference rebinding automatically. extern (D) this(const ref Loc loc, VarDeclaration v, Expression e2) { auto ve = new VarExp(loc, v); assert(v.type && ve.type); super(loc, TOK.blit, ve, e2); if (v.storage_class & (STC.ref_ | STC.out_)) memset = MemorySet.referenceInit; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class AddAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.addAssign, __traits(classInstanceSize, AddAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class MinAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.minAssign, __traits(classInstanceSize, MinAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class MulAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.mulAssign, __traits(classInstanceSize, MulAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class DivAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.divAssign, __traits(classInstanceSize, DivAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ModAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.modAssign, __traits(classInstanceSize, ModAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class AndAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.andAssign, __traits(classInstanceSize, AndAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class OrAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.orAssign, __traits(classInstanceSize, OrAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class XorAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.xorAssign, __traits(classInstanceSize, XorAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class PowAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.powAssign, __traits(classInstanceSize, PowAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ShlAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.leftShiftAssign, __traits(classInstanceSize, ShlAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ShrAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.rightShiftAssign, __traits(classInstanceSize, ShrAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class UshrAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.unsignedRightShiftAssign, __traits(classInstanceSize, UshrAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * The ~= operator. It can have one of the following operators: * * TOK.concatenateAssign - appending T[] to T[] * TOK.concatenateElemAssign - appending T to T[] * TOK.concatenateDcharAssign - appending dchar to T[] * * The parser initially sets it to TOK.concatenateAssign, and semantic() later decides which * of the three it will be set to. */ extern (C++) class CatAssignExp : BinAssignExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.concatenateAssign, __traits(classInstanceSize, CatAssignExp), e1, e2); } extern (D) this(const ref Loc loc, TOK tok, Expression e1, Expression e2) { super(loc, tok, __traits(classInstanceSize, CatAssignExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /// extern (C++) final class CatElemAssignExp : CatAssignExp { extern (D) this(const ref Loc loc, Type type, Expression e1, Expression e2) { super(loc, TOK.concatenateElemAssign, e1, e2); this.type = type; } override void accept(Visitor v) { v.visit(this); } } /// extern (C++) final class CatDcharAssignExp : CatAssignExp { extern (D) this(const ref Loc loc, Type type, Expression e1, Expression e2) { super(loc, TOK.concatenateDcharAssign, e1, e2); this.type = type; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#add_expressions */ extern (C++) final class AddExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.add, __traits(classInstanceSize, AddExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class MinExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.min, __traits(classInstanceSize, MinExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#cat_expressions */ extern (C++) final class CatExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.concatenate, __traits(classInstanceSize, CatExp), e1, e2); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { e1 = e1.resolveLoc(loc, sc); e2 = e2.resolveLoc(loc, sc); return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#mul_expressions */ extern (C++) final class MulExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.mul, __traits(classInstanceSize, MulExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#mul_expressions */ extern (C++) final class DivExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.div, __traits(classInstanceSize, DivExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#mul_expressions */ extern (C++) final class ModExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.mod, __traits(classInstanceSize, ModExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#pow_expressions */ extern (C++) final class PowExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.pow, __traits(classInstanceSize, PowExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ShlExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.leftShift, __traits(classInstanceSize, ShlExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ShrExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.rightShift, __traits(classInstanceSize, ShrExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class UshrExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.unsignedRightShift, __traits(classInstanceSize, UshrExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class AndExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.and, __traits(classInstanceSize, AndExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class OrExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.or, __traits(classInstanceSize, OrExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class XorExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.xor, __traits(classInstanceSize, XorExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * http://dlang.org/spec/expression.html#andand_expressions * http://dlang.org/spec/expression.html#oror_expressions */ extern (C++) final class LogicalExp : BinExp { extern (D) this(const ref Loc loc, TOK op, Expression e1, Expression e2) { super(loc, op, __traits(classInstanceSize, LogicalExp), e1, e2); assert(op == TOK.andAnd || op == TOK.orOr); } override Expression toBoolean(Scope* sc) { auto ex2 = e2.toBoolean(sc); if (ex2.op == TOK.error) return ex2; e2 = ex2; return this; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `op` is one of: * TOK.lessThan, TOK.lessOrEqual, TOK.greaterThan, TOK.greaterOrEqual * * http://dlang.org/spec/expression.html#relation_expressions */ extern (C++) final class CmpExp : BinExp { extern (D) this(TOK op, const ref Loc loc, Expression e1, Expression e2) { super(loc, op, __traits(classInstanceSize, CmpExp), e1, e2); assert(op == TOK.lessThan || op == TOK.lessOrEqual || op == TOK.greaterThan || op == TOK.greaterOrEqual); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class InExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.in_, __traits(classInstanceSize, InExp), e1, e2); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * This deletes the key e1 from the associative array e2 */ extern (C++) final class RemoveExp : BinExp { extern (D) this(const ref Loc loc, Expression e1, Expression e2) { super(loc, TOK.remove, __traits(classInstanceSize, RemoveExp), e1, e2); type = Type.tbool; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `==` and `!=` * * TOK.equal and TOK.notEqual * * http://dlang.org/spec/expression.html#equality_expressions */ extern (C++) final class EqualExp : BinExp { extern (D) this(TOK op, const ref Loc loc, Expression e1, Expression e2) { super(loc, op, __traits(classInstanceSize, EqualExp), e1, e2); assert(op == TOK.equal || op == TOK.notEqual); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `is` and `!is` * * TOK.identity and TOK.notIdentity * * http://dlang.org/spec/expression.html#identity_expressions */ extern (C++) final class IdentityExp : BinExp { extern (D) this(TOK op, const ref Loc loc, Expression e1, Expression e2) { super(loc, op, __traits(classInstanceSize, IdentityExp), e1, e2); assert(op == TOK.identity || op == TOK.notIdentity); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** * `econd ? e1 : e2` * * http://dlang.org/spec/expression.html#conditional_expressions */ extern (C++) final class CondExp : BinExp { Expression econd; extern (D) this(const ref Loc loc, Expression econd, Expression e1, Expression e2) { super(loc, TOK.question, __traits(classInstanceSize, CondExp), e1, e2); this.econd = econd; } override CondExp syntaxCopy() { return new CondExp(loc, econd.syntaxCopy(), e1.syntaxCopy(), e2.syntaxCopy()); } override Modifiable checkModifiable(Scope* sc, int flag) { if (e1.checkModifiable(sc, flag) != Modifiable.no && e2.checkModifiable(sc, flag) != Modifiable.no) return Modifiable.yes; return Modifiable.no; } override bool isLvalue() { return e1.isLvalue() && e2.isLvalue(); } override Expression toLvalue(Scope* sc, Expression ex) { // convert (econd ? e1 : e2) to *(econd ? &e1 : &e2) CondExp e = cast(CondExp)copy(); e.e1 = e1.toLvalue(sc, null).addressOf(); e.e2 = e2.toLvalue(sc, null).addressOf(); e.type = type.pointerTo(); return new PtrExp(loc, e, type); } override Expression modifiableLvalue(Scope* sc, Expression e) { //error("conditional expression %s is not a modifiable lvalue", toChars()); e1 = e1.modifiableLvalue(sc, e1); e2 = e2.modifiableLvalue(sc, e2); return toLvalue(sc, this); } override Expression toBoolean(Scope* sc) { auto ex1 = e1.toBoolean(sc); auto ex2 = e2.toBoolean(sc); if (ex1.op == TOK.error) return ex1; if (ex2.op == TOK.error) return ex2; e1 = ex1; e2 = ex2; return this; } void hookDtors(Scope* sc) { extern (C++) final class DtorVisitor : StoppableVisitor { alias visit = typeof(super).visit; public: Scope* sc; CondExp ce; VarDeclaration vcond; bool isThen; extern (D) this(Scope* sc, CondExp ce) { this.sc = sc; this.ce = ce; } override void visit(Expression e) { //printf("(e = %s)\n", e.toChars()); } override void visit(DeclarationExp e) { auto v = e.declaration.isVarDeclaration(); if (v && !v.isDataseg()) { if (v._init) { if (auto ei = v._init.isExpInitializer()) walkPostorder(ei.exp, this); } if (v.edtor) walkPostorder(v.edtor, this); if (v.needsScopeDtor()) { if (!vcond) { vcond = copyToTemp(STC.volatile_, "__cond", ce.econd); vcond.dsymbolSemantic(sc); Expression de = new DeclarationExp(ce.econd.loc, vcond); de = de.expressionSemantic(sc); Expression ve = new VarExp(ce.econd.loc, vcond); ce.econd = Expression.combine(de, ve); } //printf("\t++v = %s, v.edtor = %s\n", v.toChars(), v.edtor.toChars()); Expression ve = new VarExp(vcond.loc, vcond); if (isThen) v.edtor = new LogicalExp(v.edtor.loc, TOK.andAnd, ve, v.edtor); else v.edtor = new LogicalExp(v.edtor.loc, TOK.orOr, ve, v.edtor); v.edtor = v.edtor.expressionSemantic(sc); //printf("\t--v = %s, v.edtor = %s\n", v.toChars(), v.edtor.toChars()); } } } } scope DtorVisitor v = new DtorVisitor(sc, this); //printf("+%s\n", toChars()); v.isThen = true; walkPostorder(e1, v); v.isThen = false; walkPostorder(e2, v); //printf("-%s\n", toChars()); } override void accept(Visitor v) { v.visit(this); } } /// Returns: if this token is the `op` for a derived `DefaultInitExp` class. bool isDefaultInitOp(TOK op) pure nothrow @safe @nogc { return op == TOK.prettyFunction || op == TOK.functionString || op == TOK.line || op == TOK.moduleString || op == TOK.file || op == TOK.fileFullPath ; } /*********************************************************** */ extern (C++) class DefaultInitExp : Expression { extern (D) this(const ref Loc loc, TOK op, int size) { super(loc, op, size); } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class FileInitExp : DefaultInitExp { extern (D) this(const ref Loc loc, TOK tok) { super(loc, tok, __traits(classInstanceSize, FileInitExp)); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { //printf("FileInitExp::resolve() %s\n", toChars()); const(char)* s; if (op == TOK.fileFullPath) s = FileName.toAbsolute(loc.isValid() ? loc.filename : sc._module.srcfile.toChars()); else s = loc.isValid() ? loc.filename : sc._module.ident.toChars(); Expression e = new StringExp(loc, s.toDString()); e = e.expressionSemantic(sc); e = e.castTo(sc, type); return e; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class LineInitExp : DefaultInitExp { extern (D) this(const ref Loc loc) { super(loc, TOK.line, __traits(classInstanceSize, LineInitExp)); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { Expression e = new IntegerExp(loc, loc.linnum, Type.tint32); e = e.castTo(sc, type); return e; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class ModuleInitExp : DefaultInitExp { extern (D) this(const ref Loc loc) { super(loc, TOK.moduleString, __traits(classInstanceSize, ModuleInitExp)); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { const auto s = (sc.callsc ? sc.callsc : sc)._module.toPrettyChars().toDString(); Expression e = new StringExp(loc, s); e = e.expressionSemantic(sc); e = e.castTo(sc, type); return e; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class FuncInitExp : DefaultInitExp { extern (D) this(const ref Loc loc) { super(loc, TOK.functionString, __traits(classInstanceSize, FuncInitExp)); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { const(char)* s; if (sc.callsc && sc.callsc.func) s = sc.callsc.func.Dsymbol.toPrettyChars(); else if (sc.func) s = sc.func.Dsymbol.toPrettyChars(); else s = ""; Expression e = new StringExp(loc, s.toDString()); e = e.expressionSemantic(sc); e.type = Type.tstring; return e; } override void accept(Visitor v) { v.visit(this); } } /*********************************************************** */ extern (C++) final class PrettyFuncInitExp : DefaultInitExp { extern (D) this(const ref Loc loc) { super(loc, TOK.prettyFunction, __traits(classInstanceSize, PrettyFuncInitExp)); } override Expression resolveLoc(const ref Loc loc, Scope* sc) { FuncDeclaration fd = (sc.callsc && sc.callsc.func) ? sc.callsc.func : sc.func; const(char)* s; if (fd) { const funcStr = fd.Dsymbol.toPrettyChars(); OutBuffer buf; functionToBufferWithIdent(fd.type.isTypeFunction(), &buf, funcStr, fd.isStatic); s = buf.extractChars(); } else { s = ""; } Expression e = new StringExp(loc, s.toDString()); e = e.expressionSemantic(sc); e.type = Type.tstring; return e; } override void accept(Visitor v) { v.visit(this); } } /** * Objective-C class reference expression. * * Used to get the metaclass of an Objective-C class, `NSObject.Class`. */ extern (C++) final class ObjcClassReferenceExp : Expression { ClassDeclaration classDeclaration; extern (D) this(const ref Loc loc, ClassDeclaration classDeclaration) { super(loc, TOK.objcClassReference, __traits(classInstanceSize, ObjcClassReferenceExp)); this.classDeclaration = classDeclaration; type = objc.getRuntimeMetaclass(classDeclaration).getType(); } override void accept(Visitor v) { v.visit(this); } }
D
/Users/laurin/Documents/School/fbxpollenfallen/build/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/RadarChartRenderer.o : /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/Legend.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/Description.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/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/laurin/Documents/School/fbxpollenfallen/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/laurin/Documents/School/fbxpollenfallen/build/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Users/laurin/Documents/School/fbxpollenfallen/build/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/RadarChartRenderer~partial.swiftmodule : /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/Legend.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/Description.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/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/laurin/Documents/School/fbxpollenfallen/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/laurin/Documents/School/fbxpollenfallen/build/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Users/laurin/Documents/School/fbxpollenfallen/build/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/RadarChartRenderer~partial.swiftdoc : /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/Legend.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/Description.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/laurin/Documents/School/fbxpollenfallen/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/laurin/Documents/School/fbxpollenfallen/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/laurin/Documents/School/fbxpollenfallen/build/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap
D
/Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Sockets.build/Core/Types.swift.o : /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Address/Address+C.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Pipe.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Config.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Buffer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Error.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Descriptor.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Types.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Conversions.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/SocketOptions.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Address/Address.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Exports.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Select.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/FDSet.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Socket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/UDP/UDPSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPEstablishedSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPReadableSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPWriteableSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/InternetSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPInternetSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/RawSocket.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /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/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Bits.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/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Transport.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/CSQLite.build/module.modulemap /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/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Sockets.build/Types~partial.swiftmodule : /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Address/Address+C.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Pipe.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Config.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Buffer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Error.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Descriptor.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Types.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Conversions.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/SocketOptions.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Address/Address.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Exports.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Select.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/FDSet.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Socket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/UDP/UDPSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPEstablishedSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPReadableSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPWriteableSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/InternetSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPInternetSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/RawSocket.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /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/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Bits.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/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Transport.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/CSQLite.build/module.modulemap /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/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Sockets.build/Types~partial.swiftdoc : /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Address/Address+C.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Pipe.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Config.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Buffer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Error.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Descriptor.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Types.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/Conversions.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/SocketOptions.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Address/Address.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Exports.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Select.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Core/FDSet.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/Socket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/UDP/UDPSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPEstablishedSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPReadableSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPWriteableSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/InternetSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/TCP/TCPInternetSocket.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/sockets.git-972942978533733666/Sources/Sockets/Socket/RawSocket.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /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/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Bits.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/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Transport.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/CSQLite.build/module.modulemap /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
instance DMT_12130_MORIUS(Npc_Default) { name[0] = "Мориус, Хранитель Тьмы"; guild = GIL_OUT; level = 500; voice = 18; id = 12130; flags = 0; flags = NPC_FLAG_IMMORTAL; aivar[94] = NPC_EPIC; aivar[AIV_EnemyOverride] = TRUE; aivar[AIV_ToughGuy] = TRUE; aivar[AIV_ToughGuyNewsOverride] = TRUE; aivar[AIV_IGNORE_Murder] = TRUE; aivar[AIV_IGNORE_Theft] = TRUE; aivar[AIV_IGNORE_Sheepkiller] = TRUE; aivar[AIV_IgnoresArmor] = TRUE; B_SetAttributesToChapter(self,8); fight_tactic = FAI_HUMAN_MASTER; B_SetNpcVisual(self,MALE,"Hum_Head_Bald",Face_B_Guardian,BodyTex_Guardians,itar_guardian); Mdl_SetModelFatness(self,0); Mdl_ApplyOverlayMds(self,"Humans_Mage.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,30); Npc_SetTalentSkill(self,NPC_TALENT_MAGE,6); aivar[AIV_MagicUser] = MAGIC_ALWAYS; daily_routine = rtn_start_12130; }; func void rtn_start_12130() { TA_Read_Bookstand(8,0,21,0,"WP_GUARDIANS_MORIUS"); TA_Read_Bookstand(21,0,8,0,"WP_GUARDIANS_MORIUS"); }; func void rtn_tot_12130() { TA_Stand_ArmsCrossed(8,0,21,0,"TOT"); TA_Stand_ArmsCrossed(21,0,8,0,"TOT"); };
D
1 edwin_s_porter 38914 carlos_saura 28675 bruce_malmuth 6148 stuart_heisler 46714 joe_johnston 18439 tom_gries 32776 gregory_nava 12299 david_swift_ii 6157 s_sylvan_simon 22542 don__edmonds 15 dw_griffith 14352 arthur_hiller 45400 christopher_crowe 12306 ken_annakin 38931 eliseo_subiela 34836 corey_yuen 6165 leslie_arliss 14359 ermanno_olmi 24601 randal_kleiser 30746 amy_heckerling 2075 leni_riefenstahl 27279 robert-kaylor 36918 elem_klimov 29019 moustapha_akkad 2084 george_stevens 32805 joshua_white 4139 john_huston 13845 john_ford_henry_hathaway 37554 david_hare 26670 jeannot_szwarc 4144 orson_welles 28780 ivan_passer 2099 1028179-william_a_seiter 6198 jean_delannoy 34871 savage_steve_holland 8248 roy_del_ruth 31412 mikael_ekman 38972 george_mendeluk 22592 diego_munoz 47170 steve_kloves 20547 franco_zeffirelli 10309 roger_corman 22598 bill_rebane 8263 brian_desmond_hurst 36936 christopher_cain 16457 jiri_menzel 38942 george-pavlou 3767 edward_buzzell 47180 michael_herz 39266 nick_broomfield 2126 sam_wood 33464 wd_richter 36946 mike_newell 6232 harve_foster 29028 robert_guenette 22618 just_jaeckin 38020 howard_deutch 12380 john_llewellyn_moxey 38586 peter-faiman 49035 wayne_wang 8287 charles_lamont 39008 alan_smithee 24674 john_de_bello 100 charlie_chaplin 2149 1050292-david_butler 8294 robert_pirosh 12391 jeanluc_godard 16489 jun_fukuda 42343 william_phelps 15893 claude_lelouch 16494 volker_schloendorff 25277 robert_zemeckis 24690 chia-liang-liu 44051 francis_megahy 36980 rod_daniel 10358 francis_d_lyon 119 yakov_protazanov 22648 frank_beyer 16505 kihachi_okamoto 39036 spike_lee 10367 leslie_norman 30849 amy_holden_jones 2178 robert_n_bradbury 13675 _0668227 132 daniel_bressanutti 135 fritz_lang 32904 mel_damski 34034 paul_bogart 16522 silvio_narizzano 16407 david_lane 12428 jamie_nolan 8334 _0823906 2192 gregory_la_cava 16529 king_hu 20626 kenji_misumi 42691 jonathan_kaplan 148 herbert_blache 44595 andrew_fleming 28822 sam_raimi 43159 katsuhiro_otomo 38740 jerrold_freedman 46788 cameron_crowe 48495 jeff_burr 18588 mel_brooks 28829 hector_babenco 28016 lasse_aberg 16547 shohei_imamura 14500 anton_leader 166 robert_wiene 24743 steve_rash 39275 carol_frank 6315 alfred_e_green 30830 boaz_davidson 34649 jackie_kong 47279 john_dahl 26995 floyd_mutrux 39092 renny_harlin 6325 bj_alexander 47286 hal_hartley 8376 budd_boetticher 12473 karel_reisz 2234 robert_z_leonard 187 carl_boese 714 carl_theodor_dreyer 45248 greg_beeman 41675 jerry-rees 23943 joe_camp 18630 denis_sanders 47304 carl_schenkel 34958 162659443 22732 _0587706 42366 bille_august 16590 eric_rohmer 32975 pierre_boutron 28024 marino_girolami 33827 douglas_cheek 4308 spencer_williams 14550 richard_lester 34173 stephen_weeks 20534 william_crain 10460 robert_d_webb 13690 roman_polanski 39134 david_seltzer 223 fw_murnau 41184 john_mctiernan 49377 patrice_leconte 30946 thomas_k_avildsen 31582 robert_towne 10469 gerd_oswald 44935 mark_goldblatt 14570 guy_hamilton 35051 danny_steinmann 20716 sarah_kernochan 49389 jonathan_wacks 4335 sidney_lanfield 39976 allan_burns 46456 steven_soderbergh 20724 buichi_saito 14581 sergio_leone 42494 bill_froehlich 33018 roland_joffe 48877 brian_yuzna 16638 stuart_rosenberg 20735 franco_brusati 2304 charlie_s_chaplin 36224 alan_metter 14595 hiroshi_teshigahara 260 john_s_robertson 48291 rowdy_herrington 12550 lewis_gilbert 15148 sergei_parajanov 31515 paolo_taviani 43052 george_scribner 28938 dusan_makavejev 47029 phillip_noyce 27116 michael_nankin 34178 malcolm_mowbray 4366 arthur_lubin 49246 pekka_parikka 27352 alvin_rakoff 274 dorothy_arzner 40665 jim_drake_ii 39664 dale_schott 48175 thomas_j_wright 26330 neal_israel 30768 peter_greenaway 22820 joan_micklin_silver 31017 graeme_ferguson 10538 valentine_davies 6443 sidney_gilliat 19506 laslo_benedek 45019 daniel_goldberg 2351 william_wyler 20785 arthur_marks 22834 david_cronenberg 41011 john_duigan 25310 _0434211 37174 lisa_gottlieb 33079 alex_cox 312 benjamin_christensen 20793 rene_laloux 41274 jerry_london 16700 john_allison 6461 akira_kurosawa 47425 bob_radler 22923 dan_curtis 325 robert_flaherty 28998 joel_m_reed 43335 gary_a_sherman 18760 john_hough 26954 art_linson 6475 george_seaton 16717 james_clavell 19853 peter_sasdy 38121 randa_haines 32824 clive_a_smith 29011 jean_rollin 14676 william_asher 5518 vittorio_de_sica 24918 donald_wrye 44202 tony_randel 20824 sf_brownrigg 29655 james_cameron 10587 nunnally_johnson 348 fred_c_newmeyer 6495 mitchell_leisen 44179 stan_winston 14690 don_weis 26980 taylor_hackford 16744 michael_winner 361 buster-keaton-jr 31083 steno 16749 winston_hibler 10606 arnold_laven 29039 andrea-bianchi 24944 edouard_molinaro 49171 _0006860 10611 jack_pollexfen 46142 bernard_rose 32337 anne_julien 46329 frederic_back 31097 albert_pyun 6523 joseph_l_mankiewicz 45439 marisa_silver 43392 vincent_ward 38976 1036678-tom_moore 22914 nagisa_oshima 39157 david_beaird 6532 james_edward_grant 31110 tim_burstall 31809 michael_verhoeven 38667 jim_wynorski 16777 _0111656 2442 william_cameron_menzies 12683 antonioni 19181 alejandro_jodorowsky 23619 frank_d_gilroy 35223 walter_murch 8600 rene_clement 16793 arthur_h_nadel 6554 anthony_mann 37971 ron_clements 4508 michael_powell 27038 bruce_beresford 2463 louis_j_gasnier 13040 cy_endfield 14756 walter_grauman 40689 rodney_amateau 42568 _0743962 8617 henry_levin 37290 donna_deitch 26695 jeffrey_bloom 47532 david_irving 39022 jim_goddard 6576 elia_kazan 14769 ubaldo_ragona 25535 robert_benton 45491 ghasem-ebrahimian 40318 bruce_robinson 18505 bernardo_bertolucci 41400 clive_barker 27065 lang_elliott 20923 bernard_mceveety 14780 carl-lerner 35681 1041838-tom_holland 20929 marco_ferreri 31170 richard_loncraine 49227 howard_brookner 22982 _0445844 455 alfred_hitchcock 10696 albert_lamorisse 31178 les_blank 33978 cheh_chang 20942 james_bridges 16849 vilgot_sjoman 31186 david_s_ward 10318 virgil_w_vogel 12758 frank_tashlin 2519 1072502-marc_connelly 23002 alfred-sole 25053 meir_zarchi 48912 tibor_takacs 12767 1042605-richard_murphy 41547 charles_shyer 41888 atom_egoyan 31204 robert_allman 12773 mikio_naruse 45542 stuart_burge 43307 john_carl_buechler 18924 roy_boulting 14829 george_roy_hill 45930 michael_hoffman 29167 margarethe_von_trotta 6640 douglas_sirk 27431 james_glickenhaus 6642 bill_roberts 15906 harald_reinl 16884 richard_rush 6910 harold_d_schuster 20982 terrence_malick 6647 henry_koster 18937 william_friedkin 23036 alain_tanner 47613 jim_kouf 21589 peter_davis 512 sergei_eisenstein 4609 erle_c_kenton 41474 david_mamet 41387 kathryn_bigelow 18949 albert_maysles 6662 robert_rosen 14081 herschell_gordon_lewis 47004 gus_van_sant 39311 james_foley 33293 hugh_wilson 18959 sergei_bondarchuk 21009 robin-hardy 16916 david_swift 14869 james_neilson 6678 henry_hathaway 34661 marek_kanievska 10777 sidney_lumet 19249 mel_stuart 542 rupert_julian 4639 _0478303 33200 fritz_kiersch 8738 richard_fleischer 2595 cecil_b_demille 12836 jerome_robbins 32518 robert_dalva 37297 michael_rubbo 29224 jeremy_kagan 18985 michael_wadleigh 29447 bill_forsyth 43564 peter_macdonald 43118 guiseppe_tornatore 4654 1010653-david_miller 14897 jack_cardiff 563 clyde_bruckman 47669 jeanclaude_lord 40713 patrick-conrad 10335 roger_vadim 23306 michael_schultz 2622 _0176699 41397 jorg_buttgereit 10817 terence_fisher 16962 theodore_j_flicker 4675 irving_rapper 36572 stephen_frears 8774 phil_karlson 583 bonnie_hill 42778 hiroyuki_yamaga 16971 martin_scorsese 27212 william_lustig 25165 colin_higgins 33358 thom_eberhardt 591 george_fitzmaurice 12882 curtis_harrington 23651 elaine_may 23124 david_lynch 782 georg_wilhelm_pabst 10838 george_abbott 31319 tony_aboyantz 19032 david_monahan 602 albert_parker 12389 terence_young 21088 buzz_kulik 2657 archie_mayo 39355 richard_lowenstein 39525 stephen_herek 42585 simon_langton 17001 da_pennebaker 12906 daniel_petrie 25196 john_a_alonzo 37651 aki_kaurismaeki 27252 _0684509 12917 robert_rossen 39544 harry_winer 22072 jang_hyunsoo 30143 philip_jackson 10877 george_w_george 45845 yahoo_serious 19073 cy_howard 643 josef_von_sternberg 33414 john_byrum 6792 don_hartman 20588 conrad_rooks 39562 christopher_morahan 46895 chris_walas 41612 tony_scott 45710 agnieszka_holland 655 walter_ruttmann 19089 melvin_van_peebles 14994 mihalis_kakogiannis 12947 irwin_allen 47764 valerie_breiman 6805 hc_potter 30710 _0240439 6811 irving_reis 17052 ken_russell 27418 peter_collinson 23198 kevin_connor 673 ja_howe 10914 val_guest 23277 peter_sykes 41414 deborah_brock 23206 1041374-james_fargo 21159 alan_gibson 681 paul_leni 3527 dave_fleischer 34930 martha_coolidge 25262 1041643-david_greene 8879 daniel_davis_edward_d_wood_jr 6832 carol_reed 39694 bob-dahlin 690 walt_disney 46195 martin_stellman 15028 peter_glenville 19125 brian_de_palma 38071 john_mcnaughton 23224 robert_moore 25273 richard_marquand 8890 jack_arnold 24010 don_hulette 31422 pedro_almodovar 34803 juzo_itami 4800 john_rawlins 705 1051480-david_sutherland 48715 will_mackenzie 35316 susan_seidelmun 23238 george_p_cosmatos 12999 gottfried_reinhardt 19145 roy_andersson 2762 enrique_tovar_avalos 6263 bob_cormack 4813 william_keighley 39630 marshall_brickman 37583 joyce_chopra 31440 slava_tsukerman 49272 heiner_carow 42613 daniel_petrie_sr 29398 brian_d_clark 45177 _0813583 15064 kaneto_shindo 4825 billy_wilder 6874 abraham_polonsky 2779 lambert_hillyer 23261 james_frawley 734 edward_m_sedgwick 10975 nathan_juran 19169 eb-clucher 17123 george_a_romero 2788 david_hand 37670 evelyn_purcell 7633 jacques_tati 13034 philip_dunne 25323 yuen_woping 35564 jonathan_lynn 749 _0064600 37396 michael_dinner 8944 richard_talmadge 34307 richard_tuggle 10998 mikhail_kalatozov 29431 geoff_murphy 43770 ramon_menendez 8957 roy_rowland 11006 stanley_kramer 46262 stephen-chiodo 23298 pupi_avati 19205 dario_argento 775 james_w_horne 21256 robert_clouse 4908 ray_enright 2826 william_dieterle 25047 john_alan_schwartz 11021 boris_petroff 4878 john_farrow 19218 michael_sarne 31507 terry_hughes 29461 hans_iveberg 3545 1042400-george_marshall 20612 george_mccowan 22940 richard_donner 11035 robert_mulligan 796 dziga_verto 800 luis_bunuel 31638 pierre_de_moro 37667 hideshi_hino 28055 roger_spottiswoode 17189 don-hawks 806 robert_florey 11047 bert_i_gordon 39721 thomas_michael_donnelly 17194 lindsay_anderson 9004 1028855-david_butler 15154 russ_meyer 31225 cetin_inanc 17201 franklin_j_schaffner 2866 jean_renoir 4915 frank_tuttle 821 lewis_milestone 29111 desmond_davis 13116 pier_paolo_pasolini 22191 ken-shapiro 17216 ted_post 9028 george_sidney 26965 harold_ramis 9356 david_macdonald 6986 hamilton_luske 42462 1000993-bruce_barry 43853 william_porter 17233 john_boorman 23692 wim_wenders 20805 michael_crichton 9045 eugene_lourie 23382 jeff_lieberman 47962 charles_dutton 860 roland_west 2910 sidney_franklin 19296 hal_ashby 6288 hal_walker 11106 andrzej_wajda 43875 ron_shelton 13156 george_pal 7013 anatole_litvak 21351 tonino_vale_ii 15208 wojciech_has 37738 geoffrey-g-bowers 21355 john_g_avildsen 19308 nicolas_roeg 2926 julien_duvivier 31602 michael_blakemore 25459 jeff_cochran 27508 adrian_lyne 29807 _0873385 45942 robert_bierman 21368 douglas_hickox 49079 mick_jackson 9085 samuel_fuller 31614 jean_marie_poire 29567 stanislaw_bareja 44425 paul_flaherty 23425 1042742-alan_parker 13189 don_chaffey 9095 arthur_hilton 19337 alan_j_pakula 31059 jayne-loader 17291 sergio_corbucci 27533 william_sachs 16877 edward_montagne 21396 toshiya_fujita 918 victor_heerman 29508 william-a-fraker 15258 sidney_j_furie 21404 kinji_fukasaku 13213 sam_peckinpah 7071 joseph_losey 27325 joel_oliansky 5025 roy_william_neill 21410 arthur_barron 9124 charles_frend 38726 richard_pearce 27558 julien_temple 32924 sam_firstenberg 23468 jeanjacques_annaud 27566 james_l_conway 42669 ron-casden 49301 bruce_mcdonald 13811 chris_marker 24991 john_berry 951 edmund_goulding 3000 king_vidor 19385 ian_mcnaughton 5050 lewis_seiler 13244 pietro_germi 27581 terry_marcel 11199 masaki_kobayashi 19392 boris_sagal 48068 richard_greenberg 27591 armand_mastroianni 38358 robert_m_young 5067 luchino_visconti 3022 henry_king 21456 victor_erice 25554 gary_nelson 979 jean_cocteau 13268 allen_baron 5079 emeric_pressburger 24740 mike_hodges 31636 joe_layton 46046 mira_nair 991 james_whale 41953 peter_del_monte 31714 gillian_armstrong 9187 charles_marquis_warren 43610 john_cornell 31569 stuart_gillard 25084 derek_jarman 13290 andrei_tarkovsky 7147 charles_walters 45220 frank_laloggia 29680 alan_myerson 33778 jim_jarmusch 11251 james_a_contner 24243 john_cardos 41976 bob-giraldi 24404 john-flynn 39930 harley_cokeliss 33586 ethan_coen 29692 georges_lautner 21501 christopher-larkin 33790 roger_donaldson 35840 ken_kwapis 15361 elliot_silverstein 11270 196111261 8705 daniel_mann 46252 _0703890 25610 david_lowell_rich 31756 1040953-nick_castle 29709 joseph_zito 7184 jules_dassin 19475 directorjohn_cassavetes 15381 daniel_haller 32601 charles_band 25627 tinto_brass 27676 _0770474 33821 jeff_kanew 41224 bigas_luna 17440 ken_hughes 27682 _0676336 16219 sydney_pollack 25636 don_coscarelli 17585 michael_oherlihy 5160 john_m_stahl 39772 trevor_nunn 37930 brian_gibson 34065 douglas_day_stewart 27826 richard_lang 41703 steve_de_jarnatt 17458 gilberto_de_anda 25653 jamaa_fanaka 27702 slobodan_sijan 17464 michael_reeves 40885 zhang_yimou 19514 giuliano_montaldo 39995 jackson_hunsicker 28170 lewis_coates 27710 ronald_f_maxwell 44295 hiroshi_nishikiori 23392 peter-clifton 44098 penelope_spheeris 5187 henrigeorges_clouzot 9285 1094889-richard_brooks 19527 gordon_parks 21578 antonio_margheriti 30461 steven_lisberger 46946 masami-hata 23631 barbara_kopple 26808 piers_haggard 15442 elio-petri 25683 ivan_reitman 1109 norman_z_mcleod 5206 herman_shumlin 47160 david_schmoeller 3940 edward-cline 33180 michael_radford 15451 elmar-klos 25786 1042523-george_miller 1893 770890969 1121 rene_clair 36931 claude_lanzmann 20667 _0198790 11365 morton_dacosta 31847 serif-goren 5224 jacques_tourneur 35946 tim_burton 21611 liliana_cavani 46685 jeff_blyth 23662 ettore_scola 25711 lewis_john_carlino 21617 lina-wertmuller 31858 robert_j_rosenthal 5235 fred_m_wilcox 1140 william_wellman 28339 jeanjacques_beineix 9334 inoshiro-honda 11383 mario_monicelli 33913 dorian_walker 15485 guy_green 9343 mario_bava 5248 delmer_daves 19586 robert_fuest 35691 stuart_gordon 31876 _0588553 3208 anthony_asquith 7308 kenji_mizoguchi 46274 charles_sturridge 19598 wei_lo 1169 frank_capra 40083 kevin_s_tenney 42766 tom_mankiewicz 17557 werner_herzog 11415 albert_band 7321 max-ophuls 11418 quentin_lawrence 15516 james_b_harris 25757 ted_kotcheff 40094 denys_arcand 3231 dmitri_vasilyev 28886 uli_edel 27810 1122335-charles_kaufman 1187 mervyn_leroy 15525 clive_donner 17576 hubert_cornfield 40106 alain_cavalier 42156 paul_weiland 19629 edwin_sherin 32910 lynne-littman 32285 noel_black 9392 robert_aldrich 11441 lesley_selander 3250 1043170-george_b_seitz 33972 _0464846 31925 philip_kaufman 30532 andrew_prendergast 29879 emir_kusturica 27832 william_peter_blatty 21690 martin_davidson 14634 john_rich 29890 andrew_bergman 13509 herk_harvey 34684 steve_barron 27850 eric-karson 1229 frank_borzage 11472 ronald_neame 17499 barry_shear 7381 stanley_donen 13526 agnes_varda 25818 franc_roddam 27867 gilbert_cates 47369 zelda_barron 7390 james_algar_and_clyde_geronimi 29920 jean_girault 31972 joe-alves 17637 bob_rafelson 11497 melville_shavelson 9451 _0290371 30396 tommy_lee_wallace 23790 john-lounsbery 29565 friz_freleng 3312 _0138893 27890 yasmina-reza 11507 martin_ritt 38132 eugene_corr 1270 ernst_lubitsch 23800 james_goldstone 22740 yu_wang 25231 jane_wagner 13545 joseph_green 5372 mark_robson 17705 charles_jarrott 29841 howard_r_cohen 929 clarence_brown 42242 susan_seidelman 13573 ralph_nelson 32231 george_bowers 25864 john_sayles 15625 george_pollock 7436 anthony_pelissier 13583 basil_dearden 3344 norman_taurog 11537 ralph_thomas 40210 han_min_kim 23827 menghwa_ho 19732 jack_hill 29974 ulu_grosbard 19740 rainer_werner_fassbinder 7453 robert_hamer 40222 john_woo 27937 jay_sandrich 19746 monte_hellman 42277 michael_gottlieb 21041 1041041-larry_cohen 21800 reva_rose 1321 norman_mcleod 44874 martin_campbell 2951 marcel_carne 25900 lewis_teague 28210 menahem_golan 38191 charles_mccracken_ii 27952 _0675479 1331 victor_halperin 43230 augusto_camintino 21814 jonathan_demme 38984 david_anspaugh 19771 george_sherman 3389 richard_thorpe 9534 lewis_allen 34111 neil_jordan 11585 j_lee_thompson 15682 stephen_c_apostolof 27971 robert_houston 42308 pat_oconnor 26044 william_richert 13639 abe_levitow 21833 bertrand_blier 11594 arthur_penn 30028 jonas_cornell 35042 jack_sholder 49203 nancy_savoca 5455 thorold_dickinson 20572 bava 19793 george_lucas 30035 errol_morris 40277 gyula_gazdag 24664 martin_rosen 48015 mark_disalle 40506 bruce_pittman 31055 jules_bass 34144 roland_emmerich 1377 irving_pichel 14094 henri_verneuil 16955 irvin_kershner 15717 1001975-richard_brooks 42281 gary-goddard 9579 hiroshi_inagaki 30061 luis_valdez 40303 emile_ardolino 21872 steve_carver 5489 otto_preminger 42355 joe_roth 39327 jim_mcbride 22078 jeff_gillen 48502 jane_campion 11639 364630944 25976 harold_becker 23444 lamont_johnson 9594 byron_haskin 15739 bill_melendez 22762 ellen_hovde 5502 norman_ferguson 7552 allan_dwan 19841 richard_c_sarafian 30082 james_ivory 46467 nick_park 31826 ian_sharp 1413 charles-brabin 5511 edward_dmytryk 17801 robert_butler 32138 paul_brickman 11659 louis_malle 18572 harold_prince 3470 frank_popper 21903 jamie_uys 23952 john_landis 44418 jerome_foulon 34197 stan_lathan 15767 fred_coe 30105 eric_weston 1434 frank_lloyd 36628 david_greenwalt 11677 renny_bartlett 9631 satyajit_ray 25840 lucio_fulci 7586 robert_wise 26019 bob_clark_iii 43513 carl_schultz 30117 edo-bertoglio 42408 percy_adlon 5545 leslie_goodwins 3499 1041609-michael_gordon 29938 joe-flood 5551 reginald_le_borg 28232 vernon_zimmerman 21747 michael_cimino 48564 francis_veber 1463 frank_r_strayer 5560 edgarulmer 16211 george_axelrod 46523 michael_lehmann 7612 nicholas_ray 47690 julian_doyle 28094 robert-downey-sr 19903 jerry-schatzberg 20384 perry_henzell 1474 robert_f_hill 29259 gary_sherman 48060 joe_pytka 9671 joshua_logan 37367 simon_wincer 5577 edward_ludwig 17866 milton_moses_ginsberg 47036 al_reinert 46540 phil_alden_robinson 34253 joel_silberg 5582 lew_landers 20045 1059231-john_waters 15824 seijun_suzuki 9681 norman_foster 17874 bruce_kessler 34723 robert_epstein 26714 sean_s_cunningham 34261 1041466-richard_franklin 7638 yasujiro_ozu 1495 thornton_freeland 42456 jeff_bleckner 5028 robert_siodmak 28122 robert_greenwald 15837 gillo_pontecorvo 16144 john_guillermin 7650 victor_saville 46331 sandor_stern 26084 howard_zieff 9701 clyde_geronimi 30183 gaston_kabore 44521 1088175-martin_donovan 21994 andy_warhol 24043 1060941-anthony_page 17900 peter_r_hunt 21074 michael_campus 21757 gordon_hessler 19954 steven_spielberg 5619 alf-sjoberg 19956 dalton_trumbo 28150 alan_rudolph 45993 isao_takahata 1528 lloyd_bacon 32254 stan_dragoti 29269 wes_craven 46424 jim_sheridan 15875 mike_nichols 19973 claude_jutra 26120 bill_l_norton 22026 shigehiro_ozawa 13835 gordon_douglas 17935 lee_h_katzin 9749 stanley_kubrick 16896 bud_yorkin 28249 gerald_potterton 46618 stephen_hopkins 27226 vladimir_menshov 18192 james_b_clark 35582 jonathan_r_betuel 1570 wesley_ruggles 28195 rob_cohen 27793 bertrand_tavernier 11813 francois_truffaut 32296 robert_hiltzik 26204 john_irvin 30250 daniel_vigne 30983 frank_henenlotter 42540 david-hugh-jones 40493 chuck_russell 15918 bruce_brown 32444 _0523310 32304 james_signorelli 1585 michael_curtiz 7730 kurt_neumann 17971 haskell_wexler 48115 thomas_schlamme 20021 peter_medak 13879 frank_perry 7736 andrew_marton 11833 william_castle 30266 godfrey_reggio 38495 glen_pitre 11836 jack_clayton 1598 rouben_mamoulian 26175 martin_brest 41857 john_r_cherry_iii 41568 lyndall_hobbs 5698 charles_vidor 32324 curtis_hanson 46656 dominique_otheningirard 3655 a_edward_sutherland 22088 tobe_hooper 45593 george_sluizer 9803 edward_wood 1613 jean_vigo 24142 michael_pressman 39181 richard_w_haines 15288 claudia_carey 42578 ching_siutung 46495 edward_zwick 21433 james_william_guercio 22105 jerry_jameson 36111 lance_hool 18012 william_a_graham 33722 joseph_ruben 22111 jerzy_hoffman 5729 gunther_von_fritsch 1634 george_cukor 26212 abel_ferrara 15974 burt_kennedy 5393 vincente_minnelli 25884 joe-damato 5737 jean_negulesco 40554 chris_columbus 48747 joel_shumacher 26220 walter_hill 28083 william_wiard 28424 hugh-hudson 30321 damiano_damiani 11891 edward_bernds 28276 ted-berman 20085 bernard_mceveety_ii 3702 alfred_l_werker 18025 kevin_reynolds 15993 vincent_mceveety 13946 rudolph_mate 24187 ken_wiederhorn 3708 garson_kanin 23146 amos_poe 48767 peter_manoogian 22144 josef_rusnak 42935 atsuko_fukushima 13956 _0119819 36118 luis_puenzo 3719 vincent_sherman 1672 ernest_b_schoedsack 34412 lars_von_trier 22154 1040928-john_carpenter 40587 peter_george 42637 gabriel_axel 44687 bruno_nuytten 47667 euzhan_palcy 48790 costas_mandylor 13977 wolfgang_reitherman 18074 karen_everett 28315 mike_nawrocki 7838 joseph_h_lewis 28319 wolfgang_petersen 26274 allan_arkush 42660 phil_joanou 26039 carroll_ballard 27403 joseph_ellison 13993 francisco-perez-dolz 1706 alexander_korda 42338 charles_loventhal 13597 norman_panama 46024 danny_huston 26290 hayao_miyazaki 11955 ib_melchior 44316 bill-fishman 9911 john_sturges 22202 bo_arne_vibenius 11963 grigori_chukhraj_and_valentin_yezhov 5820 abbasmustan 20157 vicente_aranda 44734 glenn_gordon_caron 21109 john_d_hancock 40640 tamar_simon_hoffs 40361 peter_jackson 3778 ben_sharpsteen 15307 kevin_brownlow 9924 kaj_munk 18038 claude_chabrol 18118 leonard_kastle 16073 1041809-james_hill 34517 leos_carax 1422 leo_mccarey 31019 william_dear 9946 melvin_frank 1756 mark_sandrich 18141 jesus_franco 11998 john_boulting 32479 bruce_kimmel 5859 erie_c_kenton 26340 bruce_bilson 28087 _0210130 40572 ethan_wiley 18154 arthur_allan_seidelman 30445 tim_hunter 29309 sidney_furie 36593 daniel_attias 26358 russ_mayberry 13609 freddie_francis 26361 krzysztof_kieslowski 15833 leslie_h_martinson 24316 george_butler 1789 john_cromwell 5886 david_lean 7937 federico_fellini 20226 lee_frost 29995 derek_burbidge 26373 mark_l_lester 1798 charley_rogers 3848 james_algar 22152 jack-haley-jr 23511 bruno_bozzetto 30476 don_bluth 47626 marc_rocco 12046 tom_graeff 3856 christy_cabanne 26386 paul_schrader 36613 _0783676 5914 george_sidney_ii 47407 shinya_tsukamoto 20252 charles_cozart 49114 robert_cary 48929 dan_hoskins 1826 stuart_marshall 28451 steve_miner 12070 marcel_camus 46887 jeremiah_s_chechik 23452 fred_schepisi 24199 john_badham 42796 james_toback 36401 paul_donovan 34568 albert_magnoli 34607 stewart_raffill 17032 frederick_wiseman 36147 1022918-andrew_davis 20278 ralph_bakshi 28471 rick-rosenthal 22328 peter_weir 32569 luc_besson 16186 _0417691 7995 wilfred_jackson 18236 jack_couffer 46730 john_musker 24384 joseph_brooks 46913 mary_lambert 10050 richard_brooks_i 1860 1059518-alexander_hall 47414 cedric_sundstrom 15815 marco_bellocchio 18401 _0649096 28488 steven_hilliard_stern 16202 alan_rafkin 14156 howard_e_baker 1870 howard_hawks 48690 todd_holland_ii 20304 milton_katselas 10065 ladislaus_vajda 44882 mick_garris 5971 roberto_rossellini 20308 douglas_trumbull 45617 mike_figgis 30550 nanni_moretti 14169 john_schlesinger 20314 peter_h_hunt 12123 paul_wendkos 43322 dwight_h_little 37835 russell_mulcahy 28512 istvan_szabo 48618 jay_levey 46163 terence_davies 8036 christian_nyby 5989 joseph_kane 18278 larry_peerce 23795 craig_schlattman 39228 fred_dekker 49127 jon_amiel 46636 rob_hedden 31378 eric_till 20337 charles_b_pierce 22387 jim_sharman 8054 _0401680 6007 robert_bresson 47340 norman_rene 12153 david_decoteau 3962 victor_schertzinger 10108 edvin_laine 12160 alain_resnais 38786 jeffrey_delman 10115 1063458-michael_anderson 6020 deryn_warren 16261 norman_tokar 29623 glenn_jordan 30017 juliusz_machulski 36746 david_drury 14219 peter_yates 3981 jean_yarbrough 45805 anthony_hickox 24463 ruggero_deodato 24466 nikita_mikhalkov 12180 robert_frank 42073 lawrence-bassoff 49047 david_webb_peoples 30620 malcolm_leo 24218 director-ridley-scott 10142 don_siegel 6047 walter_lang 14240 norman_jewison 30625 graeme_clifford 32526 peter_markle 34459 willard_huyck 49060 damian_harris 12197 kon_ichikawa 8102 _0005789 32682 john_korty 14251 francis_ford_coppola 47021 robert_ellis_miller 30638 ken_finkleman 6063 albert_lewin 26544 hank_milestone 32689 dick_maas 13299 john_frankenheimer 22453 philippe_mora 25929 nicholas_meyer 18361 barbet_schroeder 42940 will-vinton 28605 tom_desimone 8130 charles_crichton 26563 desmond_gumbs 45187 bud_s_smith 28613 lawrence_kasdan 31368 richard_t_heffron 14283 george_englund 24526 peter_hyams 40911 michael_gornick 22571 paul_verhoeven 14291 cliff_owen 32729 john_herzfeld 4058 ford_beebe 18395 bernard_l_kowalski 16348 _0319241 42975 agustin_villaronga 8161 alexander_mackendrick 38883 masanori_hata 12260 tony_richardson 4070 joe_may 34129 _0752922 34793 _0092372 41639 ben_bolt 24559 michael_apted 18419 michael_ritchie 24564 lou_adler 22518 armando_crispino 44713 genevieve_robert 16378 jack_smight 4091 preston_sturges 12285 george_franju 8533 roy_ward_baker
D
a slippery smoothness a magazine printed on good quality paper a film of oil or garbage floating on top of water a trowel used to make a surface slick make slick or smooth give a smooth and glossy appearance made slick by e.g. ice or grease having only superficial plausibility having a smooth, gleaming surface reflecting light marked by skill in deception
D
module android.java.org.apache.http.conn.ssl.StrictHostnameVerifier_d_interface; import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers; static import arsd.jni; import import1 = android.java.javax.net.ssl.SSLSession_d_interface; import import2 = android.java.java.security.cert.X509Certificate_d_interface; import import3 = android.java.java.lang.Class_d_interface; import import0 = android.java.javax.net.ssl.SSLSocket_d_interface; final class StrictHostnameVerifier : IJavaObject { static immutable string[] _d_canCastTo = [ ]; @Import this(arsd.jni.Default); @Import void verify(string, string, string[][]); @Import @JavaName("toString") string toString_(); override string toString() { return arsd.jni.javaObjectToString(this); } @Import void verify(string, import0.SSLSocket); @Import bool verify(string, import1.SSLSession); @Import void verify(string, import2.X509Certificate); @Import void verify(string, string, string, bool[][]); @Import static bool acceptableCountryWildcard(string); @Import static string[] getCNs(import2.X509Certificate); @Import static string[] getDNSSubjectAlts(import2.X509Certificate); @Import static int countDots(string); @Import import3.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 = "Lorg/apache/http/conn/ssl/StrictHostnameVerifier;"; }
D
///* 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. // */ // // //import flow.bpmn.model.FlowElement; //import flow.bpmn.model.ScriptTask; // //import com.fasterxml.jackson.databind.ObjectMapper; //import com.fasterxml.jackson.databind.node.ObjectNode; // ///** // * Created by Pardo David on 5/12/2016. // */ //class ScriptTaskPropertiesParser : BasePropertiesParser { // // override // protected ObjectNode createPropertiesNode(FlowElement flowElement, ObjectNode flowElementNode, ObjectMapper objectMapper) { // ScriptTask scriptTask = (ScriptTask) flowElement; // // ObjectNode scriptTextNode = objectMapper.createObjectNode(); // putPropertyValue(BPMN_MODEL_VALUE, scriptTask.getScript(), scriptTextNode); // putPropertyValue(DYNAMIC_VALUE, flowElementNode.path(SCRIPT_TASK_SCRIPT).textValue(), scriptTextNode); // // ObjectNode propertiesNode = objectMapper.createObjectNode(); // propertiesNode.set(SCRIPT_TASK_SCRIPT, scriptTextNode); // return propertiesNode; // } // // override // public bool supports(FlowElement flowElement) { // return flowElement instanceof ScriptTask; // } //}
D
/++ Bubble Sort for Forward Ranges Authors: Xinok License: Public Domain ++/ module xsort.bubblesort; import std.range, std.algorithm, std.functional; /++ Sorts a forward range in-place using the bubble sort algorithm Params: LessFun = Predicate used for comparing elements Range = Type of the range being sorted ++/ @safe @nogc void bubbleSort(alias LessFun = "a < b", Range)(Range r) { static assert(isForwardRange!Range); static assert(!isInfinite!Range); static assert(hasAssignableElements!Range || hasSwappableElements!Range); BubbleSortImpl!(Range, LessFun).sort(r); if(!__ctfe) assert(isSorted!(LessFun)(r.save), "Range is not sorted"); } /// unittest { auto array = [5, 10, 2, 1, 6, 7, 8, 4, 3, 9]; // Sort array bubbleSort(array); assert(array == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); // Sort array in reverse order bubbleSort!"b < a"(array); assert(array == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]); } template BubbleSortImpl(Range, alias LessFun) { static assert(isForwardRange!Range); static assert(!isInfinite!Range); static assert(hasAssignableElements!Range || hasSwappableElements!Range); alias ElementType!Range Element; alias binaryFun!LessFun less; @safe @nogc void sort()(Range r) { /+ The greatest element is moved into place on each pass. We can save time by skipping these elements once they're in place. +/ for(size_t end = walkLength(r); end > 1; --end) { Range a = r.save; Range b = r.save; b.popFront(); foreach(i; 1 .. end) { if(less(b.front, a.front)) swapFront(a, b); a.popFront(); b.popFront(); } } } // Swap front elements of two forward ranges @safe @nogc void swapFront()(Range a, Range b) { static if(hasSwappableElements!Range) swap(a.front, b.front); else { auto o = a.front; a.front = b.front; b.front = o; } } } unittest { /+ General Sorting Test The array contains the elements 0 to 31 in a random order. After sorting, it should be true that array[i] == i for all i. +/ @safe @nogc pure static void checkArray(R)(R array) { foreach(a, b; array) assert(a == b); } auto array = [ 2, 17, 19, 22, 0, 7, 30, 5, 9, 12, 23, 8, 18, 21, 11, 20, 15, 4, 28, 25, 3, 1, 26, 24, 31, 13, 6, 16, 14, 29, 10, 27 ]; bubbleSort(array); checkArray(array); /+ Few Elements Test Special test cases when the array has no more than a few elements +/ array = []; bubbleSort(array); checkArray(array); array = [0]; bubbleSort(array); checkArray(array); array = [1, 0]; bubbleSort(array); checkArray(array); /+ Attributes Test Check that the following function compiles without any errors +/ @safe @nogc pure static void purityTest() { // Test attributes on custom predicate @safe @nogc pure static bool pred(int a, int b){ return b > a; } // Allocate static array to prevent GC allocation int[8] array = [3, 4, 2, 6, 7, 1, 0, 5]; bubbleSort!pred(array[]); } }
D
module app; import derelict.sdl2.sdl; import derelict.sdl2.image; // import derelict.sdl2.mixer; import derelict.sdl2.ttf; // import derelict.sdl2.net; import std.stdio; import std.random; import std.conv; import std.string; import sdlutil; import destination; import unit; import movement; import resources; import std.stdio; class App { SDL_Window *window; SDL_Renderer *renderer; SDL_Color score_color = { 0, 0, 0 }; float score = 0.0; int clicks_count = 0; Resources resources = new Resources(); uint time; bool game_over = false; bool give_up_and_quit = false; bool units_all_dead = false; bool paused = false; int height; int width; int background_tile_size; string base_path; // where to look for resources int app_speed = 200; // how fast to render int app_speed_fast = 200; int app_speed_slow = 200; Destination destination; Unit[] units; this(int width, int height, int tile_size, int world_size, string base_path){ this.width = width; this.height = height; this.background_tile_size = tile_size; this.base_path = base_path; this.destination = new Destination(); this(); } this() { DerelictSDL2.load(); DerelictSDL2Image.load(); DerelictSDL2ttf.load(); if (SDL_Init(SDL_INIT_EVERYTHING) != 0){ log_SDL_error("SDL_Init Error"); this.give_up_and_quit = true; } if ((IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG) != IMG_INIT_PNG){ log_SDL_error("IMG_Init"); this.give_up_and_quit = true; } this.window = SDL_CreateWindow("Hello World!", 100, 100, this.width, this.height, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); if (this.window == null){ log_SDL_error( "SDL_CreateWindow"); this.give_up_and_quit = true; } this.renderer = SDL_CreateRenderer(this.window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); if (this.renderer == null ){ log_SDL_error("SDL_CreateRenderer"); this.give_up_and_quit = true; } this.resources.load_all(this.renderer); } ~this() { this.destination.destroy(); for (int i = 0; i < this.units.length; i++) { this.units[i].destroy(); } this.resources.destroy(); SDL_DestroyWindow(this.window); IMG_Quit(); SDL_Quit(); } //void set_background(string file_path) { //writeln(this.base_path ~ file_path); //SDL_Texture *background = load_texture( //this.base_path ~ file_path, //this.renderer //); //this.background = background; //if (background == null ){ //writeln("background is null"); //this.give_up_and_quit = true; //} //} void set_destination() { this.destination = new Destination(); } void load_units(int how_many) { // units[0] is the prey, now we load the hunters // loading how_many + 1 because we already added the prey for (int i = 1; i < how_many + 1; i++) { float x = uniform(5, this.width - 5); float y = uniform(5, this.height - 5); this.units ~= new Unit("hunter", this.resources.live, this.resources.dead); this.units[i].place_on_map(x,y); } } void load_prey() { this.units ~= new Unit("prey", this.resources.prey, this.resources.dead); this.place_prey(); } void place_prey() { float x = uniform(5, this.width - 5); float y = uniform(5, this.height - 5); this.units[0].place_on_map(x,y); debug writeln("loaded prey at ", x, " " , y); } void render_units() { for (int i = 0; i < this.units.length; i++) { if (this.units[i] !is null) { if (this.units[i].is_dead) { render_texture( this.units[i].dead_texture, this.renderer, this.units[i].x, this.units[i].y ); } else { render_texture( this.units[i].live_texture, this.renderer, this.units[i].x, this.units[i].y ); } } } } void move_units() { // writeln("moving units"); int dead_units = 0; if (this.destination.active) { colision_check_center_distance(); // move the prey if (this.units[0].is_dead) { dead_units++; } else { this.units[0].move(this.destination, &movement.move_one_unit); } //Destination prey = new Destination(this.units[0].x, this.units[0].y); //debug writeln("target is at ", this.destination.x, " " , this.destination.y, " prey is at " , prey.x, " ", prey.y); //if (!this.units[0].is_dead) prey.active = true; //for (int i = 1; i < this.units.length; i++) { //if (this.units[i].is_dead == true) { //dead_units++; //continue; //} //this.units[i].move(prey, &movement.move_one_unit); //} } this.score = dead_units; // units.length - 1 : all hunters are dead or the prey is dead and one hunter alive if ( (dead_units == this.units.length - 1 ) || (this.units[0].is_dead) ) { this.game_over = true; } } void colision_check_center_coordinates() { int[string] occupied_spots; for (int i = 0; i < this.units.length; i++) { if (this.units[i] !is null) { if(this.units[i].is_dead == true) { string dead_unit_position = to!string(this.units[i].x) ~ " " ~ to!string(this.units[i].y); occupied_spots[dead_unit_position] = i; continue; } this.units[i].move(this.destination, &movement.move_one_unit); string test_key = to!string(this.units[i].x) ~ " " ~ to!string(this.units[i].y); if ( test_key in occupied_spots ) { if ( this.units[occupied_spots[test_key]].is_dead == false) { this.units[occupied_spots[test_key]].is_dead = true; } debug writeln( "units died " ~ to!string(occupied_spots[test_key]) ~ " and " ~ to!string(i) ); this.units[i].is_dead = true; } else { occupied_spots[test_key] = i; } } } } void colision_check_center_distance() { for (int i = 0; i < this.units.length; i++) { Unit unit1 = this.units[i]; if (unit1.is_dead == true) { continue; } for (int j = 0; j < this.units.length; j++) { if (i == j) { continue; } Unit unit2 = this.units[j]; bool colided = movement.check_for_colision_radius(unit1.x, unit1.y, unit1.radius, unit2.x, unit2.y, unit2.radius); if ( colided == true ) { unit1.is_dead = true; unit2.is_dead = true; debug writeln("!!!!!!!!!!!!!!!! colision " ~ to!string(colided)); } } } // compute the distance between all the units // if distance smaller than a threshold, set the two units as dead // needs a new property in Unit: size } void clear_scene() { SDL_RenderClear(this.renderer); } void render_scene() { int x,y; SDL_GetWindowSize(this.window, &x,&y); this.width = x; this.height = y; this.render_background(); this.render_destination(); this.render_units(); } void render_score() { string score_text = format("Score: %.2f", this.score ); SDL_Surface* score_surface = TTF_RenderText_Solid( this.resources.score_font, std.string.toStringz(score_text), score_color ); if ( score_surface == null ) { writeln( "Unable to render text surface! SDL_ttf Error: " ~ to!string(TTF_GetError()) ); } else { SDL_Texture* score_texture = SDL_CreateTextureFromSurface( this.renderer, score_surface ); if( score_texture == null ) { log_SDL_error( "Unable to create texture from rendered text! SDL Error: "); } else { SDL_FreeSurface( score_surface ); render_texture(score_texture, this.renderer, 3, 3); } } } void run( int how_many_hunters ) { this.load_prey(); this.load_units(how_many_hunters); writeln("after units"); while (!this.give_up_and_quit){ this.handle_events(); if (this.paused == true) { this.app_speed = this.app_speed_slow; continue; } else { this.app_speed = this.app_speed_fast; } if ( this.game_over != true) { this.move_units(); this.clear_scene(); this.render_scene(); this.render_score(); this.draw_all(); } else { this.clear_scene(); this.render_scene(); this.render_game_over(); this.draw_all(); writeln("rendered game over"); } } } void render_game_over() { string game_over_text = format("GAME OVER Score: %.2f", this.score ); SDL_Surface* text_surface = TTF_RenderText_Solid( this.resources.score_font, std.string.toStringz(game_over_text), score_color ); if ( text_surface == null ) { writeln( "Unable to render text surface! SDL_ttf Error: " ~ to!string(TTF_GetError()) ); } else { SDL_Texture* text_texture = SDL_CreateTextureFromSurface( this.renderer, text_surface ); if( text_texture == null ) { log_SDL_error( "Unable to create texture from rendered text! SDL Error: "); } else { SDL_FreeSurface( text_surface ); int x = this.width/2 - 30; int y = this.height/2 - 30; // debug writeln("rendering at ", x, " " , y); render_texture(text_texture, this.renderer, cast(int)x, cast(int)y); } } } void render_background() { sdlutil.render_background( this.resources.background, this.renderer, this.width, this.height, this.background_tile_size); } void render_destination() { if (this.destination.active) { sdlutil.render_texture( this.resources.destination, this.renderer, this.destination.x -5, this.destination.y - 5 ); } } void handle_events() { SDL_Event e; SDL_Delay(this.app_speed); while (SDL_PollEvent(&e)){ if( e.type == SDL_QUIT ) { this.give_up_and_quit = true; } else if ( e.type == SDL_MOUSEBUTTONDOWN ) { debug writeln("mouse is down"); int x, y; if (SDL_GetMouseState(&x, &y) & SDL_BUTTON(SDL_BUTTON_LEFT)) { debug writeln("x is ", x, " y is ", y); this.destination.active = true; this.destination.set_position(x,y); this.clicks_count++; } else if (SDL_GetMouseState(&x, &y) & SDL_BUTTON(SDL_BUTTON_RIGHT) ) { // no teleporting if the app is paused if(this.paused == false) this.place_prey(); } else if (SDL_GetMouseState(&x, &y) & SDL_BUTTON(SDL_BUTTON_MIDDLE) ) { this.toggle_paused_state(); debug writeln("middle button pressed"); } else { debug writeln("other mouse event"); } } else if ( e.type == SDL_MOUSEWHEEL ) { if (e.wheel.y < 0 ) { debug writeln("mouse wheel down ", e.wheel.y); } else { debug writeln("mouse wheel up ", e.wheel.y); } } } } void toggle_paused_state() { if ( this.paused == true ) { this.app_speed = this.app_speed_fast; this.paused = false; } else { this.app_speed = this.app_speed_slow; this.paused = true; } } void draw_all() { SDL_RenderPresent(this.renderer); } }
D
/** * TypeInfo support code. * * Copyright: Copyright Digital Mars 2004 - 2009. * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). * Authors: Walter Bright */ /* Copyright Digital Mars 2004 - 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 rt.typeinfo.ti_float; private import rt.util.typeinfo; // float class TypeInfo_f : TypeInfo { pure: nothrow: @safe: alias F = float; override string toString() const { return F.stringof; } override size_t getHash(in void* p) const @trusted { return Floating!F.hashOf(*cast(F*)p); } override bool equals(in void* p1, in void* p2) const @trusted { return Floating!F.equals(*cast(F*)p1, *cast(F*)p2); } override int compare(in void* p1, in void* p2) const @trusted { return Floating!F.compare(*cast(F*)p1, *cast(F*)p2); } override @property size_t tsize() const { return F.sizeof; } override void swap(void *p1, void *p2) const @trusted { F t = *cast(F*)p1; *cast(F*)p1 = *cast(F*)p2; *cast(F*)p2 = t; } override const(void)[] init() const @trusted { static immutable F r; return (&r)[0 .. 1]; } version (Windows) { } else version (X86_64) { // 2 means arg to function is passed in XMM registers override @property uint flags() const { return 2; } } }
D
module godot.toolbutton; import std.meta : AliasSeq, staticIndexOf; import std.traits : Unqual; import godot.d.meta; import godot.core; import godot.c; import godot.object; import godot.classdb; import godot.button; @GodotBaseClass struct ToolButton { static immutable string _GODOT_internal_name = "ToolButton"; public: union { godot_object _godot_object; Button base; } alias base this; alias BaseClasses = AliasSeq!(typeof(base), typeof(base).BaseClasses); package(godot) void* opCast(T : void*)() const { return cast(void*)_godot_object.ptr; } godot_object opCast(T : godot_object)() const { return cast(godot_object)_godot_object; } bool opEquals(in ToolButton other) const { return _godot_object.ptr is other._godot_object.ptr; } ToolButton opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } bool opCast(T : bool)() const { return _godot_object.ptr !is null; } inout(T) opCast(T)() inout if(isGodotBaseClass!T) { static assert(staticIndexOf!(ToolButton, T.BaseClasses) != -1, "Godot class "~T.stringof~" does not inherit ToolButton"); if(_godot_object.ptr is null) return T.init; String c = String(T._GODOT_internal_name); if(is_class(c)) return inout(T)(_godot_object); return T.init; } inout(T) opCast(T)() inout if(extendsGodotBaseClass!T) { static assert(is(typeof(T.owner) : ToolButton) || staticIndexOf!(ToolButton, typeof(T.owner).BaseClasses) != -1, "D class "~T.stringof~" does not extend ToolButton"); if(_godot_object.ptr is null) return null; if(has_method(String(`_GDNATIVE_D_typeid`))) { Object o = cast(Object)godot_nativescript_get_userdata(opCast!godot_object); return cast(inout(T))o; } return null; } static ToolButton _new() { static godot_class_constructor constructor; if(constructor is null) constructor = godot_get_class_constructor("ToolButton"); if(constructor is null) return typeof(this).init; return cast(ToolButton)(constructor()); } }
D
/Users/caijie/MLJRCode/Bowling/Example/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/MultipartFormData.o : /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/MultipartFormData.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Timeline.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Alamofire.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Response.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/TaskDelegate.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/SessionDelegate.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/ParameterEncoding.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Validation.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/ResponseSerialization.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/SessionManager.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/AFError.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Notifications.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Result.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Request.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/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/caijie/MLJRCode/Bowling/Example/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/caijie/MLJRCode/Bowling/Example/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/caijie/MLJRCode/Bowling/Example/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/MultipartFormData~partial.swiftmodule : /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/MultipartFormData.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Timeline.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Alamofire.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Response.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/TaskDelegate.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/SessionDelegate.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/ParameterEncoding.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Validation.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/ResponseSerialization.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/SessionManager.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/AFError.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Notifications.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Result.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Request.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/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/caijie/MLJRCode/Bowling/Example/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/caijie/MLJRCode/Bowling/Example/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/caijie/MLJRCode/Bowling/Example/build/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/MultipartFormData~partial.swiftdoc : /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/MultipartFormData.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Timeline.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Alamofire.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Response.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/TaskDelegate.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/SessionDelegate.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/ParameterEncoding.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Validation.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/ResponseSerialization.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/SessionManager.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/AFError.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Notifications.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Result.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/Request.swift /Users/caijie/MLJRCode/Bowling/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/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/caijie/MLJRCode/Bowling/Example/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/caijie/MLJRCode/Bowling/Example/build/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
/Users/apple/Desktop/save/HW9.01/build/Pods.build/Debug-iphonesimulator/AlamofireImage.build/Objects-normal/x86_64/UIImage+AlamofireImage.o : /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/AFIError.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/Image.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/ImageCache.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/ImageDownloader.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/ImageFilter.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/Request+AlamofireImage.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/UIButton+AlamofireImage.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/UIImage+AlamofireImage.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/UIImageView+AlamofireImage.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/apple/Desktop/save/HW9.01/Pods/Target\ Support\ Files/AlamofireImage/AlamofireImage-umbrella.h /Users/apple/Desktop/save/HW9.01/build/Pods.build/Debug-iphonesimulator/AlamofireImage.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.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/SwiftOnoneSupport.swiftmodule /Users/apple/Desktop/save/HW9.01/build/Debug-iphonesimulator/Alamofire/Alamofire.framework/Modules/Alamofire.swiftmodule/x86_64.swiftmodule /Users/apple/Desktop/save/HW9.01/build/Debug-iphonesimulator/Alamofire/Alamofire.framework/Headers/Alamofire-Swift.h /Users/apple/Desktop/save/HW9.01/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/apple/Desktop/save/HW9.01/build/Pods.build/Debug-iphonesimulator/Alamofire.build/module.modulemap /Users/apple/Desktop/save/HW9.01/build/Pods.build/Debug-iphonesimulator/AlamofireImage.build/Objects-normal/x86_64/UIImage+AlamofireImage~partial.swiftmodule : /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/AFIError.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/Image.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/ImageCache.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/ImageDownloader.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/ImageFilter.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/Request+AlamofireImage.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/UIButton+AlamofireImage.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/UIImage+AlamofireImage.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/UIImageView+AlamofireImage.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/apple/Desktop/save/HW9.01/Pods/Target\ Support\ Files/AlamofireImage/AlamofireImage-umbrella.h /Users/apple/Desktop/save/HW9.01/build/Pods.build/Debug-iphonesimulator/AlamofireImage.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.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/SwiftOnoneSupport.swiftmodule /Users/apple/Desktop/save/HW9.01/build/Debug-iphonesimulator/Alamofire/Alamofire.framework/Modules/Alamofire.swiftmodule/x86_64.swiftmodule /Users/apple/Desktop/save/HW9.01/build/Debug-iphonesimulator/Alamofire/Alamofire.framework/Headers/Alamofire-Swift.h /Users/apple/Desktop/save/HW9.01/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/apple/Desktop/save/HW9.01/build/Pods.build/Debug-iphonesimulator/Alamofire.build/module.modulemap /Users/apple/Desktop/save/HW9.01/build/Pods.build/Debug-iphonesimulator/AlamofireImage.build/Objects-normal/x86_64/UIImage+AlamofireImage~partial.swiftdoc : /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/AFIError.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/Image.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/ImageCache.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/ImageDownloader.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/ImageFilter.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/Request+AlamofireImage.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/UIButton+AlamofireImage.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/UIImage+AlamofireImage.swift /Users/apple/Desktop/save/HW9.01/Pods/AlamofireImage/Source/UIImageView+AlamofireImage.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/apple/Desktop/save/HW9.01/Pods/Target\ Support\ Files/AlamofireImage/AlamofireImage-umbrella.h /Users/apple/Desktop/save/HW9.01/build/Pods.build/Debug-iphonesimulator/AlamofireImage.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.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/SwiftOnoneSupport.swiftmodule /Users/apple/Desktop/save/HW9.01/build/Debug-iphonesimulator/Alamofire/Alamofire.framework/Modules/Alamofire.swiftmodule/x86_64.swiftmodule /Users/apple/Desktop/save/HW9.01/build/Debug-iphonesimulator/Alamofire/Alamofire.framework/Headers/Alamofire-Swift.h /Users/apple/Desktop/save/HW9.01/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/apple/Desktop/save/HW9.01/build/Pods.build/Debug-iphonesimulator/Alamofire.build/module.modulemap
D
/Users/lanussebaptiste/Desktop/CubeSavinien/Build/Intermediates/CubeSavinien.build/Debug-iphoneos/CubeSavinien.build/Objects-normal/armv7/RectangleLayer.o : /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/BottomViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/RightViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/TopViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/OvalLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/HolderView.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/FrontViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/RectangleLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/ViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/LeftViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/ArcLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/TriangleLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/Colors.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/ContainerViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Security.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/CoreImage.swiftmodule /Users/lanussebaptiste/Desktop/CubeSavinien/Build/Intermediates/CubeSavinien.build/Debug-iphoneos/CubeSavinien.build/Objects-normal/armv7/RectangleLayer~partial.swiftmodule : /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/BottomViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/RightViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/TopViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/OvalLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/HolderView.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/FrontViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/RectangleLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/ViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/LeftViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/ArcLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/TriangleLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/Colors.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/ContainerViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Security.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/CoreImage.swiftmodule /Users/lanussebaptiste/Desktop/CubeSavinien/Build/Intermediates/CubeSavinien.build/Debug-iphoneos/CubeSavinien.build/Objects-normal/armv7/RectangleLayer~partial.swiftdoc : /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/BottomViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/RightViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/TopViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/OvalLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/HolderView.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/FrontViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/RectangleLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/ViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/LeftViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/ArcLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/TriangleLayer.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/Colors.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/ContainerViewController.swift /Users/lanussebaptiste/Desktop/CubeSavinien/CubeSavinien/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/Security.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/32/CoreImage.swiftmodule
D
// Written in the D programming language. /** * Templates which extract information about types and symbols at compile time. * * $(SCRIPT inhibitQuickIndex = 1;) * * $(DIVC quickindex, * $(BOOKTABLE , * $(TR $(TH Category) $(TH Templates)) * $(TR $(TD Symbol Name _traits) $(TD * $(LREF fullyQualifiedName) * $(LREF moduleName) * $(LREF packageName) * )) * $(TR $(TD Function _traits) $(TD * $(LREF arity) * $(LREF functionAttributes) * $(LREF functionLinkage) * $(LREF FunctionTypeOf) * $(LREF isSafe) * $(LREF isUnsafe) * $(LREF ParameterDefaults) * $(LREF ParameterIdentifierTuple) * $(LREF ParameterStorageClassTuple) * $(LREF Parameters) * $(LREF ReturnType) * $(LREF SetFunctionAttributes) * $(LREF variadicFunctionStyle) * )) * $(TR $(TD Aggregate Type _traits) $(TD * $(LREF BaseClassesTuple) * $(LREF BaseTypeTuple) * $(LREF classInstanceAlignment) * $(LREF EnumMembers) * $(LREF FieldNameTuple) * $(LREF Fields) * $(LREF hasAliasing) * $(LREF hasElaborateAssign) * $(LREF hasElaborateCopyConstructor) * $(LREF hasElaborateDestructor) * $(LREF hasIndirections) * $(LREF hasMember) * $(LREF hasNested) * $(LREF hasUnsharedAliasing) * $(LREF InterfacesTuple) * $(LREF isNested) * $(LREF MemberFunctionsTuple) * $(LREF RepresentationTypeTuple) * $(LREF TemplateArgsOf) * $(LREF TemplateOf) * $(LREF TransitiveBaseTypeTuple) * )) * $(TR $(TD Type Conversion) $(TD * $(LREF CommonType) * $(LREF ImplicitConversionTargets) * $(LREF CopyTypeQualifiers) * $(LREF CopyConstness) * $(LREF isAssignable) * $(LREF isCovariantWith) * $(LREF isImplicitlyConvertible) * )) * <!--$(TR $(TD SomethingTypeOf) $(TD * $(LREF BooleanTypeOf) * $(LREF IntegralTypeOf) * $(LREF FloatingPointTypeOf) * $(LREF NumericTypeOf) * $(LREF UnsignedTypeOf) * $(LREF SignedTypeOf) * $(LREF CharTypeOf) * $(LREF StaticArrayTypeOf) * $(LREF DynamicArrayTypeOf) * $(LREF ArrayTypeOf) * $(LREF StringTypeOf) * $(LREF AssocArrayTypeOf) * $(LREF BuiltinTypeOf) * ))--> * $(TR $(TD Categories of types) $(TD * $(LREF isAggregateType) * $(LREF isArray) * $(LREF isAssociativeArray) * $(LREF isBasicType) * $(LREF isBoolean) * $(LREF isBuiltinType) * $(LREF isDynamicArray) * $(LREF isFloatingPoint) * $(LREF isIntegral) * $(LREF isNarrowString) * $(LREF isAutodecodableString) * $(LREF isNumeric) * $(LREF isPointer) * $(LREF isScalarType) * $(LREF isSigned) * $(LREF isSomeChar) * $(LREF isSomeString) * $(LREF isStaticArray) * $(LREF isUnsigned) * )) * $(TR $(TD Type behaviours) $(TD * $(LREF isAbstractClass) * $(LREF isAbstractFunction) * $(LREF isCallable) * $(LREF isDelegate) * $(LREF isExpressions) * $(LREF isFinalClass) * $(LREF isFinalFunction) * $(LREF isFunctionPointer) * $(LREF isInstanceOf) * $(LREF isIterable) * $(LREF isMutable) * $(LREF isSomeFunction) * $(LREF isTypeTuple) * )) * $(TR $(TD General Types) $(TD * $(LREF ForeachType) * $(LREF KeyType) * $(LREF Largest) * $(LREF mostNegative) * $(LREF OriginalType) * $(LREF PointerTarget) * $(LREF Signed) * $(LREF Unqual) * $(LREF Unsigned) * $(LREF ValueType) * )) * $(TR $(TD Misc) $(TD * $(LREF mangledName) * $(LREF Select) * $(LREF select) * )) * $(TR $(TD User-Defined Attributes) $(TD * $(LREF hasUDA) * $(LREF getUDAs) * $(LREF getSymbolsByUDA) * )) * ) * ) * * Macros: * WIKI = Phobos/StdTraits * * Copyright: Copyright Digital Mars 2005 - 2009. * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). * Authors: $(WEB digitalmars.com, Walter Bright), * Tomasz Stachowiak ($(D isExpressions)), * $(WEB erdani.org, Andrei Alexandrescu), * Shin Fujishiro, * $(WEB octarineparrot.com, Robert Clipsham), * $(WEB klickverbot.at, David Nadlinger), * Kenji Hara, * Shoichi Kato * Source: $(PHOBOSSRC std/_traits.d) */ /* Copyright Digital Mars 2005 - 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.traits; import std.typetuple; /////////////////////////////////////////////////////////////////////////////// // Functions /////////////////////////////////////////////////////////////////////////////// // Petit demangler // (this or similar thing will eventually go to std.demangle if necessary // ctfe stuffs are available) private { struct Demangle(T) { T value; // extracted information string rest; } /* Demangles mstr as the storage class part of Argument. */ Demangle!uint demangleParameterStorageClass(string mstr) { uint pstc = 0; // parameter storage class // Argument --> Argument2 | M Argument2 if (mstr.length > 0 && mstr[0] == 'M') { pstc |= ParameterStorageClass.scope_; mstr = mstr[1 .. $]; } // Argument2 --> Type | J Type | K Type | L Type ParameterStorageClass stc2; switch (mstr.length ? mstr[0] : char.init) { case 'J': stc2 = ParameterStorageClass.out_; break; case 'K': stc2 = ParameterStorageClass.ref_; break; case 'L': stc2 = ParameterStorageClass.lazy_; break; case 'N': if (mstr.length >= 2 && mstr[1] == 'k') stc2 = ParameterStorageClass.return_; break; default : break; } if (stc2 != ParameterStorageClass.init) { pstc |= stc2; mstr = mstr[1 .. $]; if (stc2 & ParameterStorageClass.return_) mstr = mstr[1 .. $]; } return Demangle!uint(pstc, mstr); } /* Demangles mstr as FuncAttrs. */ Demangle!uint demangleFunctionAttributes(string mstr) { enum LOOKUP_ATTRIBUTE = [ 'a': FunctionAttribute.pure_, 'b': FunctionAttribute.nothrow_, 'c': FunctionAttribute.ref_, 'd': FunctionAttribute.property, 'e': FunctionAttribute.trusted, 'f': FunctionAttribute.safe, 'i': FunctionAttribute.nogc, 'j': FunctionAttribute.return_ ]; uint atts = 0; // FuncAttrs --> FuncAttr | FuncAttr FuncAttrs // FuncAttr --> empty | Na | Nb | Nc | Nd | Ne | Nf | Ni | Nj // except 'Ng' == inout, because it is a qualifier of function type while (mstr.length >= 2 && mstr[0] == 'N' && mstr[1] != 'g' && mstr[1] != 'k') { if (FunctionAttribute att = LOOKUP_ATTRIBUTE[ mstr[1] ]) { atts |= att; mstr = mstr[2 .. $]; } else assert(0); } return Demangle!uint(atts, mstr); } static if (is(ucent)) { alias CentTypeList = TypeTuple!(cent, ucent); alias SignedCentTypeList = TypeTuple!(cent); alias UnsignedCentTypeList = TypeTuple!(ucent); } else { alias CentTypeList = TypeTuple!(); alias SignedCentTypeList = TypeTuple!(); alias UnsignedCentTypeList = TypeTuple!(); } alias IntegralTypeList = TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong, CentTypeList); alias SignedIntTypeList = TypeTuple!(byte, short, int, long, SignedCentTypeList); alias UnsignedIntTypeList = TypeTuple!(ubyte, ushort, uint, ulong, UnsignedCentTypeList); alias FloatingPointTypeList = TypeTuple!(float, double, real); alias ImaginaryTypeList = TypeTuple!(ifloat, idouble, ireal); alias ComplexTypeList = TypeTuple!(cfloat, cdouble, creal); alias NumericTypeList = TypeTuple!(IntegralTypeList, FloatingPointTypeList); alias CharTypeList = TypeTuple!(char, wchar, dchar); } package { /// Add specific qualifier to the given type T. template MutableOf(T) { alias MutableOf = T ; } } /// Add specific qualifier to the given type T. template InoutOf(T) { alias InoutOf = inout(T) ; } /// ditto. template ConstOf(T) { alias ConstOf = const(T) ; } /// ditto. template SharedOf(T) { alias SharedOf = shared(T) ; } /// ditto. template SharedInoutOf(T) { alias SharedInoutOf = shared(inout(T)); } /// ditto. template SharedConstOf(T) { alias SharedConstOf = shared(const(T)); } /// ditto. template ImmutableOf(T) { alias ImmutableOf = immutable(T) ; } unittest { static assert(is( MutableOf!int == int)); static assert(is( InoutOf!int == inout int)); static assert(is( ConstOf!int == const int)); static assert(is( SharedOf!int == shared int)); static assert(is(SharedInoutOf!int == shared inout int)); static assert(is(SharedConstOf!int == shared const int)); static assert(is( ImmutableOf!int == immutable int)); } // Get qualifier template from the given type T template QualifierOf(T) { static if (is(T == shared(const U), U)) alias QualifierOf = SharedConstOf; else static if (is(T == const U , U)) alias QualifierOf = ConstOf; else static if (is(T == shared(inout U), U)) alias QualifierOf = SharedInoutOf; else static if (is(T == inout U , U)) alias QualifierOf = InoutOf; else static if (is(T == immutable U , U)) alias QualifierOf = ImmutableOf; else static if (is(T == shared U , U)) alias QualifierOf = SharedOf; else alias QualifierOf = MutableOf; } unittest { alias Qual1 = QualifierOf!( int); static assert(is(Qual1!long == long)); alias Qual2 = QualifierOf!( inout int); static assert(is(Qual2!long == inout long)); alias Qual3 = QualifierOf!( const int); static assert(is(Qual3!long == const long)); alias Qual4 = QualifierOf!(shared int); static assert(is(Qual4!long == shared long)); alias Qual5 = QualifierOf!(shared inout int); static assert(is(Qual5!long == shared inout long)); alias Qual6 = QualifierOf!(shared const int); static assert(is(Qual6!long == shared const long)); alias Qual7 = QualifierOf!( immutable int); static assert(is(Qual7!long == immutable long)); } version(unittest) { alias TypeQualifierList = TypeTuple!(MutableOf, ConstOf, SharedOf, SharedConstOf, ImmutableOf); struct SubTypeOf(T) { T val; alias val this; } } private alias parentOf(alias sym) = Identity!(__traits(parent, sym)); private alias parentOf(alias sym : T!Args, alias T, Args...) = Identity!(__traits(parent, T)); /** * Get the full package name for the given symbol. */ template packageName(alias T) { import std.algorithm : startsWith; static if (__traits(compiles, parentOf!T)) enum parent = packageName!(parentOf!T); else enum string parent = null; static if (T.stringof.startsWith("package ")) enum packageName = (parent.length ? parent ~ '.' : "") ~ T.stringof[8 .. $]; else static if (parent) enum packageName = parent; else static assert(false, T.stringof ~ " has no parent"); } /// unittest { import std.traits; static assert(packageName!packageName == "std"); } unittest { import std.array; // Commented out because of dmd @@@BUG8922@@@ // static assert(packageName!std == "std"); // this package (currently: "std.std") static assert(packageName!(std.traits) == "std"); // this module static assert(packageName!packageName == "std"); // symbol in this module static assert(packageName!(std.array) == "std"); // other module from same package import core.sync.barrier; // local import static assert(packageName!core == "core"); static assert(packageName!(core.sync) == "core.sync"); static assert(packageName!Barrier == "core.sync"); struct X12287(T) { T i; } static assert(packageName!(X12287!int.i) == "std"); } version (none) version(unittest) //Please uncomment me when changing packageName to test global imports { import core.sync.barrier; // global import static assert(packageName!core == "core"); static assert(packageName!(core.sync) == "core.sync"); static assert(packageName!Barrier == "core.sync"); } /** * Get the module name (including package) for the given symbol. */ template moduleName(alias T) { import std.algorithm : startsWith; static assert(!T.stringof.startsWith("package "), "cannot get the module name for a package"); static if (T.stringof.startsWith("module ")) { static if (__traits(compiles, packageName!T)) enum packagePrefix = packageName!T ~ '.'; else enum packagePrefix = ""; enum moduleName = packagePrefix ~ T.stringof[7..$]; } else alias moduleName = moduleName!(parentOf!T); // If you use enum, it will cause compiler ICE } /// unittest { import std.traits; static assert(moduleName!moduleName == "std.traits"); } unittest { import std.array; static assert(!__traits(compiles, moduleName!std)); static assert(moduleName!(std.traits) == "std.traits"); // this module static assert(moduleName!moduleName == "std.traits"); // symbol in this module static assert(moduleName!(std.array) == "std.array"); // other module static assert(moduleName!(std.array.array) == "std.array"); // symbol in other module import core.sync.barrier; // local import static assert(!__traits(compiles, moduleName!(core.sync))); static assert(moduleName!(core.sync.barrier) == "core.sync.barrier"); static assert(moduleName!Barrier == "core.sync.barrier"); struct X12287(T) { T i; } static assert(moduleName!(X12287!int.i) == "std.traits"); } version (none) version(unittest) //Please uncomment me when changing moduleName to test global imports { import core.sync.barrier; // global import static assert(!__traits(compiles, moduleName!(core.sync))); static assert(moduleName!(core.sync.barrier) == "core.sync.barrier"); static assert(moduleName!Barrier == "core.sync.barrier"); } /*** * Get the fully qualified name of a type or a symbol. Can act as an intelligent type/symbol to string converter. Example: ----------------- module myModule; struct MyStruct {} static assert(fullyQualifiedName!(const MyStruct[]) == "const(myModule.MyStruct[])"); ----------------- */ template fullyQualifiedName(T...) if (T.length == 1) { static if (is(T)) enum fullyQualifiedName = fqnType!(T[0], false, false, false, false); else enum fullyQualifiedName = fqnSym!(T[0]); } /// unittest { static assert(fullyQualifiedName!fullyQualifiedName == "std.traits.fullyQualifiedName"); } version(unittest) { // Used for both fqnType and fqnSym unittests private struct QualifiedNameTests { struct Inner { } ref const(Inner[string]) func( ref Inner var1, lazy scope string var2 ); ref const(Inner[string]) retfunc( return ref Inner var1 ); Inner inoutFunc(inout Inner) inout; shared(const(Inner[string])[]) data; const Inner delegate(double, string) @safe nothrow deleg; inout(int) delegate(inout int) inout inoutDeleg; Inner function(out double, string) funcPtr; extern(C) Inner function(double, string) cFuncPtr; extern(C) void cVarArg(int, ...); void dVarArg(...); void dVarArg2(int, ...); void typesafeVarArg(int[] ...); Inner[] array; Inner[16] sarray; Inner[Inner] aarray; const(Inner[const(Inner)]) qualAarray; shared(immutable(Inner) delegate(ref double, scope string) const shared @trusted nothrow) attrDeleg; struct Data(T) { int x; } void tfunc(T...)(T args) {} template Inst(alias A) { int x; } class Test12309(T, int x, string s) {} } private enum QualifiedEnum { a = 42 } } private template fqnSym(alias T : X!A, alias X, A...) { template fqnTuple(T...) { static if (T.length == 0) enum fqnTuple = ""; else static if (T.length == 1) { static if (isExpressionTuple!T) enum fqnTuple = T[0].stringof; else enum fqnTuple = fullyQualifiedName!(T[0]); } else enum fqnTuple = fqnTuple!(T[0]) ~ ", " ~ fqnTuple!(T[1 .. $]); } enum fqnSym = fqnSym!(__traits(parent, X)) ~ '.' ~ __traits(identifier, X) ~ "!(" ~ fqnTuple!A ~ ")"; } private template fqnSym(alias T) { static if (__traits(compiles, __traits(parent, T))) enum parentPrefix = fqnSym!(__traits(parent, T)) ~ '.'; else enum parentPrefix = null; static string adjustIdent(string s) { import std.algorithm : skipOver, findSplit; if (s.skipOver("package ") || s.skipOver("module ")) return s; return s.findSplit("(")[0]; } enum fqnSym = parentPrefix ~ adjustIdent(__traits(identifier, T)); } unittest { alias fqn = fullyQualifiedName; // Make sure those 2 are the same static assert(fqnSym!fqn == fqn!fqn); static assert(fqn!fqn == "std.traits.fullyQualifiedName"); alias qnTests = QualifiedNameTests; enum prefix = "std.traits.QualifiedNameTests."; static assert(fqn!(qnTests.Inner) == prefix ~ "Inner"); static assert(fqn!(qnTests.func) == prefix ~ "func"); static assert(fqn!(qnTests.Data!int) == prefix ~ "Data!(int)"); static assert(fqn!(qnTests.Data!int.x) == prefix ~ "Data!(int).x"); static assert(fqn!(qnTests.tfunc!(int[])) == prefix ~ "tfunc!(int[])"); static assert(fqn!(qnTests.Inst!(Object)) == prefix ~ "Inst!(object.Object)"); static assert(fqn!(qnTests.Inst!(Object).x) == prefix ~ "Inst!(object.Object).x"); static assert(fqn!(qnTests.Test12309!(int, 10, "str")) == prefix ~ "Test12309!(int, 10, \"str\")"); import core.sync.barrier; static assert(fqn!Barrier == "core.sync.barrier.Barrier"); } private template fqnType(T, bool alreadyConst, bool alreadyImmutable, bool alreadyShared, bool alreadyInout) { import std.format : format; // Convenience tags enum { _const = 0, _immutable = 1, _shared = 2, _inout = 3 } alias qualifiers = TypeTuple!(is(T == const), is(T == immutable), is(T == shared), is(T == inout)); alias noQualifiers = TypeTuple!(false, false, false, false); string storageClassesString(uint psc)() @property { alias PSC = ParameterStorageClass; return format("%s%s%s%s%s", psc & PSC.scope_ ? "scope " : "", psc & PSC.return_ ? "return " : "", psc & PSC.out_ ? "out " : "", psc & PSC.ref_ ? "ref " : "", psc & PSC.lazy_ ? "lazy " : "" ); } string parametersTypeString(T)() @property { alias parameters = Parameters!(T); alias parameterStC = ParameterStorageClassTuple!(T); enum variadic = variadicFunctionStyle!T; static if (variadic == Variadic.no) enum variadicStr = ""; else static if (variadic == Variadic.c) enum variadicStr = ", ..."; else static if (variadic == Variadic.d) enum variadicStr = parameters.length ? ", ..." : "..."; else static if (variadic == Variadic.typesafe) enum variadicStr = " ..."; else static assert(0, "New variadic style has been added, please update fullyQualifiedName implementation"); static if (parameters.length) { import std.algorithm : map; import std.range : join, zip; string result = join( map!(a => format("%s%s", a[0], a[1]))( zip([staticMap!(storageClassesString, parameterStC)], [staticMap!(fullyQualifiedName, parameters)]) ), ", " ); return result ~= variadicStr; } else return variadicStr; } string linkageString(T)() @property { enum linkage = functionLinkage!T; if (linkage != "D") return format("extern(%s) ", linkage); else return ""; } string functionAttributeString(T)() @property { alias FA = FunctionAttribute; enum attrs = functionAttributes!T; static if (attrs == FA.none) return ""; else return format("%s%s%s%s%s%s%s%s", attrs & FA.pure_ ? " pure" : "", attrs & FA.nothrow_ ? " nothrow" : "", attrs & FA.ref_ ? " ref" : "", attrs & FA.property ? " @property" : "", attrs & FA.trusted ? " @trusted" : "", attrs & FA.safe ? " @safe" : "", attrs & FA.nogc ? " @nogc" : "", attrs & FA.return_ ? " return" : "" ); } string addQualifiers(string typeString, bool addConst, bool addImmutable, bool addShared, bool addInout) { auto result = typeString; if (addShared) { result = format("shared(%s)", result); } if (addConst || addImmutable || addInout) { result = format("%s(%s)", addConst ? "const" : addImmutable ? "immutable" : "inout", result ); } return result; } // Convenience template to avoid copy-paste template chain(string current) { enum chain = addQualifiers(current, qualifiers[_const] && !alreadyConst, qualifiers[_immutable] && !alreadyImmutable, qualifiers[_shared] && !alreadyShared, qualifiers[_inout] && !alreadyInout); } static if (is(T == string)) { enum fqnType = "string"; } else static if (is(T == wstring)) { enum fqnType = "wstring"; } else static if (is(T == dstring)) { enum fqnType = "dstring"; } else static if (isBasicType!T && !is(T == enum)) { enum fqnType = chain!((Unqual!T).stringof); } else static if (isAggregateType!T || is(T == enum)) { enum fqnType = chain!(fqnSym!T); } else static if (isStaticArray!T) { import std.conv; enum fqnType = chain!( format("%s[%s]", fqnType!(typeof(T.init[0]), qualifiers), T.length) ); } else static if (isArray!T) { enum fqnType = chain!( format("%s[]", fqnType!(typeof(T.init[0]), qualifiers)) ); } else static if (isAssociativeArray!T) { enum fqnType = chain!( format("%s[%s]", fqnType!(ValueType!T, qualifiers), fqnType!(KeyType!T, noQualifiers)) ); } else static if (isSomeFunction!T) { static if (is(T F == delegate)) { enum qualifierString = format("%s%s", is(F == shared) ? " shared" : "", is(F == inout) ? " inout" : is(F == immutable) ? " immutable" : is(F == const) ? " const" : "" ); enum formatStr = "%s%s delegate(%s)%s%s"; enum fqnType = chain!( format(formatStr, linkageString!T, fqnType!(ReturnType!T, noQualifiers), parametersTypeString!(T), functionAttributeString!T, qualifierString) ); } else { static if (isFunctionPointer!T) enum formatStr = "%s%s function(%s)%s"; else enum formatStr = "%s%s(%s)%s"; enum fqnType = chain!( format(formatStr, linkageString!T, fqnType!(ReturnType!T, noQualifiers), parametersTypeString!(T), functionAttributeString!T) ); } } else static if (isPointer!T) { enum fqnType = chain!( format("%s*", fqnType!(PointerTarget!T, qualifiers)) ); } else static if (is(T : __vector(V[N]), V, size_t N)) { enum fqnType = chain!( format("__vector(%s[%s])", fqnType!(V, qualifiers), N) ); } else // In case something is forgotten static assert(0, "Unrecognized type " ~ T.stringof ~ ", can't convert to fully qualified string"); } unittest { import std.format : format; alias fqn = fullyQualifiedName; // Verify those 2 are the same for simple case alias Ambiguous = const(QualifiedNameTests.Inner); static assert(fqn!Ambiguous == fqnType!(Ambiguous, false, false, false, false)); // Main tests enum inner_name = "std.traits.QualifiedNameTests.Inner"; with (QualifiedNameTests) { // Special cases static assert(fqn!(string) == "string"); static assert(fqn!(wstring) == "wstring"); static assert(fqn!(dstring) == "dstring"); // Basic qualified name static assert(fqn!(Inner) == inner_name); static assert(fqn!(QualifiedEnum) == "std.traits.QualifiedEnum"); // type static assert(fqn!(QualifiedEnum.a) == "std.traits.QualifiedEnum.a"); // symbol // Array types static assert(fqn!(typeof(array)) == format("%s[]", inner_name)); static assert(fqn!(typeof(sarray)) == format("%s[16]", inner_name)); static assert(fqn!(typeof(aarray)) == format("%s[%s]", inner_name, inner_name)); // qualified key for AA static assert(fqn!(typeof(qualAarray)) == format("const(%s[const(%s)])", inner_name, inner_name)); // Qualified composed data types static assert(fqn!(typeof(data)) == format("shared(const(%s[string])[])", inner_name)); // Function types + function attributes static assert(fqn!(typeof(func)) == format("const(%s[string])(ref %s, scope lazy string) ref", inner_name, inner_name)); static assert(fqn!(typeof(retfunc)) == format("const(%s[string])(return %s) ref", inner_name, inner_name)); static assert(fqn!(typeof(inoutFunc)) == format("inout(%s(inout(%s)))", inner_name, inner_name)); static assert(fqn!(typeof(deleg)) == format("const(%s delegate(double, string) nothrow @safe)", inner_name)); static assert(fqn!(typeof(inoutDeleg)) == "inout(int) delegate(inout(int)) inout"); static assert(fqn!(typeof(funcPtr)) == format("%s function(out double, string)", inner_name)); static assert(fqn!(typeof(cFuncPtr)) == format("extern(C) %s function(double, string)", inner_name)); // Delegate type with qualified function type static assert(fqn!(typeof(attrDeleg)) == format("shared(immutable(%s) "~ "delegate(ref double, scope string) nothrow @trusted shared const)", inner_name)); // Variable argument function types static assert(fqn!(typeof(cVarArg)) == "extern(C) void(int, ...)"); static assert(fqn!(typeof(dVarArg)) == "void(...)"); static assert(fqn!(typeof(dVarArg2)) == "void(int, ...)"); static assert(fqn!(typeof(typesafeVarArg)) == "void(int[] ...)"); // SIMD vector static if (is(__vector(float[4]))) { static assert(fqn!(__vector(float[4])) == "__vector(float[4])"); } } } /*** * Get the type of the return value from a function, * a pointer to function, a delegate, a struct * with an opCall, a pointer to a struct with an opCall, * or a class with an $(D opCall). Please note that $(D_KEYWORD ref) * is not part of a type, but the attribute of the function * (see template $(LREF functionAttributes)). */ template ReturnType(func...) if (func.length == 1 && isCallable!func) { static if (is(FunctionTypeOf!func R == return)) alias ReturnType = R; else static assert(0, "argument has no return type"); } /// unittest { int foo(); ReturnType!foo x; // x is declared as int } unittest { struct G { int opCall (int i) { return 1;} } alias ShouldBeInt = ReturnType!G; static assert(is(ShouldBeInt == int)); G g; static assert(is(ReturnType!g == int)); G* p; alias pg = ReturnType!p; static assert(is(pg == int)); class C { int opCall (int i) { return 1;} } static assert(is(ReturnType!C == int)); C c; static assert(is(ReturnType!c == int)); class Test { int prop() @property { return 0; } } alias R_Test_prop = ReturnType!(Test.prop); static assert(is(R_Test_prop == int)); alias R_dglit = ReturnType!((int a) { return a; }); static assert(is(R_dglit == int)); } /*** Get, as a tuple, the types of the parameters to a function, a pointer to function, a delegate, a struct with an $(D opCall), a pointer to a struct with an $(D opCall), or a class with an $(D opCall). */ template Parameters(func...) if (func.length == 1 && isCallable!func) { static if (is(FunctionTypeOf!func P == function)) alias Parameters = P; else static assert(0, "argument has no parameters"); } /// unittest { int foo(int, long); void bar(Parameters!foo); // declares void bar(int, long); void abc(Parameters!foo[1]); // declares void abc(long); } /** * Alternate name for $(LREF Parameters), kept for legacy compatibility. */ alias ParameterTypeTuple = Parameters; unittest { int foo(int i, bool b) { return 0; } static assert(is(ParameterTypeTuple!foo == TypeTuple!(int, bool))); static assert(is(ParameterTypeTuple!(typeof(&foo)) == TypeTuple!(int, bool))); struct S { real opCall(real r, int i) { return 0.0; } } S s; static assert(is(ParameterTypeTuple!S == TypeTuple!(real, int))); static assert(is(ParameterTypeTuple!(S*) == TypeTuple!(real, int))); static assert(is(ParameterTypeTuple!s == TypeTuple!(real, int))); class Test { int prop() @property { return 0; } } alias P_Test_prop = ParameterTypeTuple!(Test.prop); static assert(P_Test_prop.length == 0); alias P_dglit = ParameterTypeTuple!((int a){}); static assert(P_dglit.length == 1); static assert(is(P_dglit[0] == int)); } /** Returns the number of arguments of function $(D func). arity is undefined for variadic functions. */ template arity(alias func) if ( isCallable!func && variadicFunctionStyle!func == Variadic.no ) { enum size_t arity = Parameters!func.length; } /// unittest { void foo(){} static assert(arity!foo==0); void bar(uint){} static assert(arity!bar==1); void variadicFoo(uint...){} static assert(__traits(compiles,arity!variadicFoo)==false); } /** Returns a tuple consisting of the storage classes of the parameters of a function $(D func). */ enum ParameterStorageClass : uint { /** * These flags can be bitwise OR-ed together to represent complex storage * class. */ none = 0, scope_ = 0b000_1, /// ditto out_ = 0b001_0, /// ditto ref_ = 0b010_0, /// ditto lazy_ = 0b100_0, /// ditto return_ = 0b1000_0, /// ditto } /// ditto template ParameterStorageClassTuple(func...) if (func.length == 1 && isCallable!func) { alias Func = Unqual!(FunctionTypeOf!func); /* * TypeFuncion: * CallConvention FuncAttrs Arguments ArgClose Type */ alias Params = Parameters!Func; // chop off CallConvention and FuncAttrs enum margs = demangleFunctionAttributes(mangledName!Func[1 .. $]).rest; // demangle Arguments and store parameter storage classes in a tuple template demangleNextParameter(string margs, size_t i = 0) { static if (i < Params.length) { enum demang = demangleParameterStorageClass(margs); enum skip = mangledName!(Params[i]).length; // for bypassing Type enum rest = demang.rest; alias demangleNextParameter = TypeTuple!( demang.value + 0, // workaround: "not evaluatable at ..." demangleNextParameter!(rest[skip .. $], i + 1) ); } else // went thru all the parameters { alias demangleNextParameter = TypeTuple!(); } } alias ParameterStorageClassTuple = demangleNextParameter!margs; } /// unittest { alias STC = ParameterStorageClass; // shorten the enum name void func(ref int ctx, out real result, real param) { } alias pstc = ParameterStorageClassTuple!func; static assert(pstc.length == 3); // three parameters static assert(pstc[0] == STC.ref_); static assert(pstc[1] == STC.out_); static assert(pstc[2] == STC.none); } unittest { alias STC = ParameterStorageClass; void noparam() {} static assert(ParameterStorageClassTuple!noparam.length == 0); void test(scope int, ref int, out int, lazy int, int, return ref int) { } alias test_pstc = ParameterStorageClassTuple!test; static assert(test_pstc.length == 6); static assert(test_pstc[0] == STC.scope_); static assert(test_pstc[1] == STC.ref_); static assert(test_pstc[2] == STC.out_); static assert(test_pstc[3] == STC.lazy_); static assert(test_pstc[4] == STC.none); static assert(test_pstc[5] == STC.return_); interface Test { void test_const(int) const; void test_sharedconst(int) shared const; } Test testi; alias test_const_pstc = ParameterStorageClassTuple!(Test.test_const); static assert(test_const_pstc.length == 1); static assert(test_const_pstc[0] == STC.none); alias test_sharedconst_pstc = ParameterStorageClassTuple!(testi.test_sharedconst); static assert(test_sharedconst_pstc.length == 1); static assert(test_sharedconst_pstc[0] == STC.none); alias dglit_pstc = ParameterStorageClassTuple!((ref int a) {}); static assert(dglit_pstc.length == 1); static assert(dglit_pstc[0] == STC.ref_); // Bugzilla 9317 static inout(int) func(inout int param) { return param; } static assert(ParameterStorageClassTuple!(typeof(func))[0] == STC.none); } unittest { // Bugzilla 14253 static struct Foo { ref Foo opAssign(ref Foo rhs) return { return this; } } alias tup = ParameterStorageClassTuple!(__traits(getOverloads, Foo, "opAssign")[0]); } /** Get, as a tuple, the identifiers of the parameters to a function symbol. */ template ParameterIdentifierTuple(func...) if (func.length == 1 && isCallable!func) { static if (is(FunctionTypeOf!func PT == __parameters)) { template Get(size_t i) { static if (!isFunctionPointer!func && !isDelegate!func // Unnamed parameters yield CT error. && is(typeof(__traits(identifier, PT[i..i+1]))x)) { enum Get = __traits(identifier, PT[i..i+1]); } else { enum Get = ""; } } } else { static assert(0, func[0].stringof ~ "is not a function"); // Define dummy entities to avoid pointless errors template Get(size_t i) { enum Get = ""; } alias PT = TypeTuple!(); } template Impl(size_t i = 0) { static if (i == PT.length) alias Impl = TypeTuple!(); else alias Impl = TypeTuple!(Get!i, Impl!(i+1)); } alias ParameterIdentifierTuple = Impl!(); } /// unittest { int foo(int num, string name, int); static assert([ParameterIdentifierTuple!foo] == ["num", "name", ""]); } unittest { alias PIT = ParameterIdentifierTuple; void bar(int num, string name, int[] array){} static assert([PIT!bar] == ["num", "name", "array"]); // might be changed in the future? void function(int num, string name) fp; static assert([PIT!fp] == ["", ""]); // might be changed in the future? void delegate(int num, string name, int[long] aa) dg; static assert([PIT!dg] == ["", "", ""]); interface Test { @property string getter(); @property void setter(int a); Test method(int a, long b, string c); } static assert([PIT!(Test.getter)] == []); static assert([PIT!(Test.setter)] == ["a"]); static assert([PIT!(Test.method)] == ["a", "b", "c"]); /+ // depends on internal void baw(int, string, int[]){} static assert([PIT!baw] == ["_param_0", "_param_1", "_param_2"]); // depends on internal void baz(TypeTuple!(int, string, int[]) args){} static assert([PIT!baz] == ["_param_0", "_param_1", "_param_2"]); +/ } /** Get, as a tuple, the default value of the parameters to a function symbol. If a parameter doesn't have the default value, $(D void) is returned instead. */ template ParameterDefaults(func...) if (func.length == 1 && isCallable!func) { static if (is(FunctionTypeOf!(func[0]) PT == __parameters)) { template Get(size_t i) { enum ParamName = ParameterIdentifierTuple!(func[0])[i]; static if (ParamName.length) enum get = (PT[i..i+1]) => mixin(ParamName); else // Unnamed parameter enum get = (PT[i..i+1] __args) => __args[0]; static if (is(typeof(get()))) enum Get = get(); else alias Get = void; // If default arg doesn't exist, returns void instead. } } else static if (is(FunctionTypeOf!func PT == __parameters)) { template Get(size_t i) { enum Get = ""; } } else { static assert(0, func[0].stringof ~ "is not a function"); // Define dummy entities to avoid pointless errors template Get(size_t i) { enum Get = ""; } alias PT = TypeTuple!(); } template Impl(size_t i = 0) { static if (i == PT.length) alias Impl = TypeTuple!(); else alias Impl = TypeTuple!(Get!i, Impl!(i+1)); } alias ParameterDefaults = Impl!(); } /// unittest { int foo(int num, string name = "hello", int[] = [1,2,3]); static assert(is(ParameterDefaults!foo[0] == void)); static assert( ParameterDefaults!foo[1] == "hello"); static assert( ParameterDefaults!foo[2] == [1,2,3]); } /** * Alternate name for $(LREF ParameterDefaults), kept for legacy compatibility. */ alias ParameterDefaultValueTuple = ParameterDefaults; unittest { alias PDVT = ParameterDefaultValueTuple; void bar(int n = 1, string s = "hello"){} static assert(PDVT!bar.length == 2); static assert(PDVT!bar[0] == 1); static assert(PDVT!bar[1] == "hello"); static assert(is(typeof(PDVT!bar) == typeof(TypeTuple!(1, "hello")))); void baz(int x, int n = 1, string s = "hello"){} static assert(PDVT!baz.length == 3); static assert(is(PDVT!baz[0] == void)); static assert( PDVT!baz[1] == 1); static assert( PDVT!baz[2] == "hello"); static assert(is(typeof(PDVT!baz) == typeof(TypeTuple!(void, 1, "hello")))); // bug 10800 - property functions return empty string @property void foo(int x = 3) { } static assert(PDVT!foo.length == 1); static assert(PDVT!foo[0] == 3); static assert(is(typeof(PDVT!foo) == typeof(TypeTuple!(3)))); struct Colour { ubyte a,r,g,b; static immutable Colour white = Colour(255,255,255,255); } void bug8106(Colour c = Colour.white){} //pragma(msg, PDVT!bug8106); static assert(PDVT!bug8106[0] == Colour.white); } /** Returns the attributes attached to a function $(D func). */ enum FunctionAttribute : uint { /** * These flags can be bitwise OR-ed together to represent a complex attribute. */ none = 0, pure_ = 1 << 0, /// ditto nothrow_ = 1 << 1, /// ditto ref_ = 1 << 2, /// ditto property = 1 << 3, /// ditto trusted = 1 << 4, /// ditto safe = 1 << 5, /// ditto nogc = 1 << 6, /// ditto system = 1 << 7, /// ditto const_ = 1 << 8, /// ditto immutable_ = 1 << 9, /// ditto inout_ = 1 << 10, /// ditto shared_ = 1 << 11, /// ditto return_ = 1 << 12, /// ditto } /// ditto template functionAttributes(func...) if (func.length == 1 && isCallable!func) { // @bug: workaround for opCall alias FuncSym = Select!(is(typeof(__traits(getFunctionAttributes, func))), func, Unqual!(FunctionTypeOf!func)); enum FunctionAttribute functionAttributes = extractAttribFlags!(__traits(getFunctionAttributes, FuncSym))(); } /// unittest { import std.traits : functionAttributes, FunctionAttribute; alias FA = FunctionAttribute; // shorten the enum name real func(real x) pure nothrow @safe { return x; } static assert(functionAttributes!func & FA.pure_); static assert(functionAttributes!func & FA.safe); static assert(!(functionAttributes!func & FA.trusted)); // not @trusted } unittest { alias FA = FunctionAttribute; struct S { int noF() { return 0; } int constF() const { return 0; } int immutableF() immutable { return 0; } int inoutF() inout { return 0; } int sharedF() shared { return 0; } int x; ref int refF() return { return x; } int propertyF() @property { return 0; } int nothrowF() nothrow { return 0; } int nogcF() @nogc { return 0; } int systemF() @system { return 0; } int trustedF() @trusted { return 0; } int safeF() @safe { return 0; } int pureF() pure { return 0; } } static assert(functionAttributes!(S.noF) == FA.system); static assert(functionAttributes!(typeof(S.noF)) == FA.system); static assert(functionAttributes!(S.constF) == (FA.const_ | FA.system)); static assert(functionAttributes!(typeof(S.constF)) == (FA.const_ | FA.system)); static assert(functionAttributes!(S.immutableF) == (FA.immutable_ | FA.system)); static assert(functionAttributes!(typeof(S.immutableF)) == (FA.immutable_ | FA.system)); static assert(functionAttributes!(S.inoutF) == (FA.inout_ | FA.system)); static assert(functionAttributes!(typeof(S.inoutF)) == (FA.inout_ | FA.system)); static assert(functionAttributes!(S.sharedF) == (FA.shared_ | FA.system)); static assert(functionAttributes!(typeof(S.sharedF)) == (FA.shared_ | FA.system)); static assert(functionAttributes!(S.refF) == (FA.ref_ | FA.system | FA.return_)); static assert(functionAttributes!(typeof(S.refF)) == (FA.ref_ | FA.system | FA.return_)); static assert(functionAttributes!(S.propertyF) == (FA.property | FA.system)); static assert(functionAttributes!(typeof(&S.propertyF)) == (FA.property | FA.system)); static assert(functionAttributes!(S.nothrowF) == (FA.nothrow_ | FA.system)); static assert(functionAttributes!(typeof(S.nothrowF)) == (FA.nothrow_ | FA.system)); static assert(functionAttributes!(S.nogcF) == (FA.nogc | FA.system)); static assert(functionAttributes!(typeof(S.nogcF)) == (FA.nogc | FA.system)); static assert(functionAttributes!(S.systemF) == FA.system); static assert(functionAttributes!(typeof(S.systemF)) == FA.system); static assert(functionAttributes!(S.trustedF) == FA.trusted); static assert(functionAttributes!(typeof(S.trustedF)) == FA.trusted); static assert(functionAttributes!(S.safeF) == FA.safe); static assert(functionAttributes!(typeof(S.safeF)) == FA.safe); static assert(functionAttributes!(S.pureF) == (FA.pure_ | FA.system)); static assert(functionAttributes!(typeof(S.pureF)) == (FA.pure_ | FA.system)); int pure_nothrow() nothrow pure { return 0; } void safe_nothrow() @safe nothrow { } static ref int static_ref_property() @property { return *(new int); } ref int ref_property() @property { return *(new int); } static assert(functionAttributes!(pure_nothrow) == (FA.pure_ | FA.nothrow_ | FA.system)); static assert(functionAttributes!(typeof(pure_nothrow)) == (FA.pure_ | FA.nothrow_ | FA.system)); static assert(functionAttributes!(safe_nothrow) == (FA.safe | FA.nothrow_)); static assert(functionAttributes!(typeof(safe_nothrow)) == (FA.safe | FA.nothrow_)); static assert(functionAttributes!(static_ref_property) == (FA.property | FA.ref_ | FA.system)); static assert(functionAttributes!(typeof(&static_ref_property)) == (FA.property | FA.ref_ | FA.system)); static assert(functionAttributes!(ref_property) == (FA.property | FA.ref_ | FA.system)); static assert(functionAttributes!(typeof(&ref_property)) == (FA.property | FA.ref_ | FA.system)); struct S2 { int pure_const() const pure { return 0; } int pure_sharedconst() const shared pure { return 0; } } static assert(functionAttributes!(S2.pure_const) == (FA.const_ | FA.pure_ | FA.system)); static assert(functionAttributes!(typeof(S2.pure_const)) == (FA.const_ | FA.pure_ | FA.system)); static assert(functionAttributes!(S2.pure_sharedconst) == (FA.const_ | FA.shared_ | FA.pure_ | FA.system)); static assert(functionAttributes!(typeof(S2.pure_sharedconst)) == (FA.const_ | FA.shared_ | FA.pure_ | FA.system)); static assert(functionAttributes!((int a) { }) == (FA.pure_ | FA.nothrow_ | FA.nogc | FA.safe)); static assert(functionAttributes!(typeof((int a) { })) == (FA.pure_ | FA.nothrow_ | FA.nogc | FA.safe)); auto safeDel = delegate() @safe { }; static assert(functionAttributes!(safeDel) == (FA.pure_ | FA.nothrow_ | FA.nogc | FA.safe)); static assert(functionAttributes!(typeof(safeDel)) == (FA.pure_ | FA.nothrow_ | FA.nogc | FA.safe)); auto trustedDel = delegate() @trusted { }; static assert(functionAttributes!(trustedDel) == (FA.pure_ | FA.nothrow_ | FA.nogc | FA.trusted)); static assert(functionAttributes!(typeof(trustedDel)) == (FA.pure_ | FA.nothrow_ | FA.nogc | FA.trusted)); auto systemDel = delegate() @system { }; static assert(functionAttributes!(systemDel) == (FA.pure_ | FA.nothrow_ | FA.nogc | FA.system)); static assert(functionAttributes!(typeof(systemDel)) == (FA.pure_ | FA.nothrow_ | FA.nogc | FA.system)); } private FunctionAttribute extractAttribFlags(Attribs...)() { auto res = FunctionAttribute.none; foreach (attrib; Attribs) { switch (attrib) with (FunctionAttribute) { case "pure": res |= pure_; break; case "nothrow": res |= nothrow_; break; case "ref": res |= ref_; break; case "@property": res |= property; break; case "@trusted": res |= trusted; break; case "@safe": res |= safe; break; case "@nogc": res |= nogc; break; case "@system": res |= system; break; case "const": res |= const_; break; case "immutable": res |= immutable_; break; case "inout": res |= inout_; break; case "shared": res |= shared_; break; case "return": res |= return_; break; default: assert(0, attrib); } } return res; } /** $(D true) if $(D func) is $(D @safe) or $(D @trusted). */ template isSafe(alias func) if(isCallable!func) { enum isSafe = (functionAttributes!func & FunctionAttribute.safe) != 0 || (functionAttributes!func & FunctionAttribute.trusted) != 0; } /// unittest { @safe int add(int a, int b) {return a+b;} @trusted int sub(int a, int b) {return a-b;} @system int mul(int a, int b) {return a*b;} static assert( isSafe!add); static assert( isSafe!sub); static assert(!isSafe!mul); } unittest { //Member functions interface Set { int systemF() @system; int trustedF() @trusted; int safeF() @safe; } static assert( isSafe!(Set.safeF)); static assert( isSafe!(Set.trustedF)); static assert(!isSafe!(Set.systemF)); //Functions @safe static safeFunc() {} @trusted static trustedFunc() {} @system static systemFunc() {} static assert( isSafe!safeFunc); static assert( isSafe!trustedFunc); static assert(!isSafe!systemFunc); //Delegates auto safeDel = delegate() @safe {}; auto trustedDel = delegate() @trusted {}; auto systemDel = delegate() @system {}; static assert( isSafe!safeDel); static assert( isSafe!trustedDel); static assert(!isSafe!systemDel); //Lambdas static assert( isSafe!({safeDel();})); static assert( isSafe!({trustedDel();})); static assert(!isSafe!({systemDel();})); //Static opCall struct SafeStatic { @safe static SafeStatic opCall() { return SafeStatic.init; } } struct TrustedStatic { @trusted static TrustedStatic opCall() { return TrustedStatic.init; } } struct SystemStatic { @system static SystemStatic opCall() { return SystemStatic.init; } } static assert( isSafe!(SafeStatic())); static assert( isSafe!(TrustedStatic())); static assert(!isSafe!(SystemStatic())); //Non-static opCall struct Safe { @safe Safe opCall() { return Safe.init; } } struct Trusted { @trusted Trusted opCall() { return Trusted.init; } } struct System { @system System opCall() { return System.init; } } static assert( isSafe!(Safe.init())); static assert( isSafe!(Trusted.init())); static assert(!isSafe!(System.init())); } /** $(D true) if $(D func) is $(D @system). */ template isUnsafe(alias func) { enum isUnsafe = !isSafe!func; } /// unittest { @safe int add(int a, int b) {return a+b;} @trusted int sub(int a, int b) {return a-b;} @system int mul(int a, int b) {return a*b;} static assert(!isUnsafe!add); static assert(!isUnsafe!sub); static assert( isUnsafe!mul); } unittest { //Member functions interface Set { int systemF() @system; int trustedF() @trusted; int safeF() @safe; } static assert(!isUnsafe!(Set.safeF)); static assert(!isUnsafe!(Set.trustedF)); static assert( isUnsafe!(Set.systemF)); //Functions @safe static safeFunc() {} @trusted static trustedFunc() {} @system static systemFunc() {} static assert(!isUnsafe!safeFunc); static assert(!isUnsafe!trustedFunc); static assert( isUnsafe!systemFunc); //Delegates auto safeDel = delegate() @safe {}; auto trustedDel = delegate() @trusted {}; auto systemDel = delegate() @system {}; static assert(!isUnsafe!safeDel); static assert(!isUnsafe!trustedDel); static assert( isUnsafe!systemDel); //Lambdas static assert(!isUnsafe!({safeDel();})); static assert(!isUnsafe!({trustedDel();})); static assert( isUnsafe!({systemDel();})); //Static opCall struct SafeStatic { @safe static SafeStatic opCall() { return SafeStatic.init; } } struct TrustedStatic { @trusted static TrustedStatic opCall() { return TrustedStatic.init; } } struct SystemStatic { @system static SystemStatic opCall() { return SystemStatic.init; } } static assert(!isUnsafe!(SafeStatic())); static assert(!isUnsafe!(TrustedStatic())); static assert( isUnsafe!(SystemStatic())); //Non-static opCall struct Safe { @safe Safe opCall() { return Safe.init; } } struct Trusted { @trusted Trusted opCall() { return Trusted.init; } } struct System { @system System opCall() { return System.init; } } static assert(!isUnsafe!(Safe.init())); static assert(!isUnsafe!(Trusted.init())); static assert( isUnsafe!(System.init())); } /** $(RED Deprecated. It's badly named and provides redundant functionality. It was also badly broken prior to 2.060 (bug# 8362), so any code which uses it probably needs to be changed anyway. Please use $(D allSatisfy(isSafe, ...)) instead. This will be removed in June 2015.) $(D true) all functions are $(D isSafe). Example ------------- @safe int add(int a, int b) {return a+b;} @trusted int sub(int a, int b) {return a-b;} @system int mul(int a, int b) {return a*b;} static assert( areAllSafe!(add, add)); static assert( areAllSafe!(add, sub)); static assert(!areAllSafe!(sub, mul)); ------------- */ deprecated("Please use allSatisfy(isSafe, ...) instead.") template areAllSafe(funcs...) if (funcs.length > 0) { static if (funcs.length == 1) { enum areAllSafe = isSafe!(funcs[0]); } else static if (isSafe!(funcs[0])) { enum areAllSafe = areAllSafe!(funcs[1..$]); } else { enum areAllSafe = false; } } // Verify Example deprecated unittest { @safe int add(int a, int b) {return a+b;} @trusted int sub(int a, int b) {return a-b;} @system int mul(int a, int b) {return a*b;} static assert( areAllSafe!(add, add)); static assert( areAllSafe!(add, sub)); static assert(!areAllSafe!(sub, mul)); } deprecated unittest { interface Set { int systemF() @system; int trustedF() @trusted; int safeF() @safe; } static assert( areAllSafe!((int a){}, Set.safeF)); static assert( areAllSafe!((int a){}, Set.safeF, Set.trustedF)); static assert(!areAllSafe!(Set.trustedF, Set.systemF)); } /** Returns the calling convention of function as a string. */ template functionLinkage(func...) if (func.length == 1 && isCallable!func) { alias Func = Unqual!(FunctionTypeOf!func); enum string functionLinkage = [ 'F': "D", 'U': "C", 'W': "Windows", 'V': "Pascal", 'R': "C++" ][ mangledName!Func[0] ]; } /// unittest { extern(D) void Dfunc() {} extern(C) void Cfunc() {} static assert(functionLinkage!Dfunc == "D"); static assert(functionLinkage!Cfunc == "C"); string a = functionLinkage!Dfunc; assert(a == "D"); auto fp = &Cfunc; string b = functionLinkage!fp; assert(b == "C"); } unittest { interface Test { void const_func() const; void sharedconst_func() shared const; } static assert(functionLinkage!(Test.const_func) == "D"); static assert(functionLinkage!(Test.sharedconst_func) == "D"); static assert(functionLinkage!((int a){}) == "D"); } /** Determines what kind of variadic parameters function has. */ enum Variadic { no, /// Function is not variadic. c, /// Function is a _C-style variadic function. /// Function is a _D-style variadic function, which uses d, /// __argptr and __arguments. typesafe, /// Function is a typesafe variadic function. } /// ditto template variadicFunctionStyle(func...) if (func.length == 1 && isCallable!func) { alias Func = Unqual!(FunctionTypeOf!func); // TypeFuncion --> CallConvention FuncAttrs Arguments ArgClose Type enum callconv = functionLinkage!Func; enum mfunc = mangledName!Func; enum mtype = mangledName!(ReturnType!Func); static assert(mfunc[$ - mtype.length .. $] == mtype, mfunc ~ "|" ~ mtype); enum argclose = mfunc[$ - mtype.length - 1]; static assert(argclose >= 'X' && argclose <= 'Z'); enum Variadic variadicFunctionStyle = argclose == 'X' ? Variadic.typesafe : argclose == 'Y' ? (callconv == "C") ? Variadic.c : Variadic.d : Variadic.no; // 'Z' } /// unittest { void func() {} static assert(variadicFunctionStyle!func == Variadic.no); extern(C) int printf(in char*, ...); static assert(variadicFunctionStyle!printf == Variadic.c); } unittest { import core.vararg; extern(D) void novar() {} extern(C) void cstyle(int, ...) {} extern(D) void dstyle(...) {} extern(D) void typesafe(int[]...) {} static assert(variadicFunctionStyle!novar == Variadic.no); static assert(variadicFunctionStyle!cstyle == Variadic.c); static assert(variadicFunctionStyle!dstyle == Variadic.d); static assert(variadicFunctionStyle!typesafe == Variadic.typesafe); static assert(variadicFunctionStyle!((int[] a...) {}) == Variadic.typesafe); } /** Get the function type from a callable object $(D func). Using builtin $(D typeof) on a property function yields the types of the property value, not of the property function itself. Still, $(D FunctionTypeOf) is able to obtain function types of properties. Note: Do not confuse function types with function pointer types; function types are usually used for compile-time reflection purposes. */ template FunctionTypeOf(func...) if (func.length == 1 && isCallable!func) { static if (is(typeof(& func[0]) Fsym : Fsym*) && is(Fsym == function) || is(typeof(& func[0]) Fsym == delegate)) { alias FunctionTypeOf = Fsym; // HIT: (nested) function symbol } else static if (is(typeof(& func[0].opCall) Fobj == delegate)) { alias FunctionTypeOf = Fobj; // HIT: callable object } else static if (is(typeof(& func[0].opCall) Ftyp : Ftyp*) && is(Ftyp == function)) { alias FunctionTypeOf = Ftyp; // HIT: callable type } else static if (is(func[0] T) || is(typeof(func[0]) T)) { static if (is(T == function)) alias FunctionTypeOf = T; // HIT: function else static if (is(T Fptr : Fptr*) && is(Fptr == function)) alias FunctionTypeOf = Fptr; // HIT: function pointer else static if (is(T Fdlg == delegate)) alias FunctionTypeOf = Fdlg; // HIT: delegate else static assert(0); } else static assert(0); } /// unittest { class C { int value() @property { return 0; } } static assert(is( typeof(C.value) == int )); static assert(is( FunctionTypeOf!(C.value) == function )); } unittest { int test(int a) { return 0; } int propGet() @property { return 0; } int propSet(int a) @property { return 0; } int function(int) test_fp; int delegate(int) test_dg; static assert(is( typeof(test) == FunctionTypeOf!(typeof(test)) )); static assert(is( typeof(test) == FunctionTypeOf!test )); static assert(is( typeof(test) == FunctionTypeOf!test_fp )); static assert(is( typeof(test) == FunctionTypeOf!test_dg )); alias int GetterType() @property; alias int SetterType(int) @property; static assert(is( FunctionTypeOf!propGet == GetterType )); static assert(is( FunctionTypeOf!propSet == SetterType )); interface Prop { int prop() @property; } Prop prop; static assert(is( FunctionTypeOf!(Prop.prop) == GetterType )); static assert(is( FunctionTypeOf!(prop.prop) == GetterType )); class Callable { int opCall(int) { return 0; } } auto call = new Callable; static assert(is( FunctionTypeOf!call == typeof(test) )); struct StaticCallable { static int opCall(int) { return 0; } } StaticCallable stcall_val; StaticCallable* stcall_ptr; static assert(is( FunctionTypeOf!stcall_val == typeof(test) )); static assert(is( FunctionTypeOf!stcall_ptr == typeof(test) )); interface Overloads { void test(string); real test(real); int test(int); int test() @property; } alias ov = TypeTuple!(__traits(getVirtualFunctions, Overloads, "test")); alias F_ov0 = FunctionTypeOf!(ov[0]); alias F_ov1 = FunctionTypeOf!(ov[1]); alias F_ov2 = FunctionTypeOf!(ov[2]); alias F_ov3 = FunctionTypeOf!(ov[3]); static assert(is(F_ov0* == void function(string))); static assert(is(F_ov1* == real function(real))); static assert(is(F_ov2* == int function(int))); static assert(is(F_ov3* == int function() @property)); alias F_dglit = FunctionTypeOf!((int a){ return a; }); static assert(is(F_dglit* : int function(int))); } /** * Constructs a new function or delegate type with the same basic signature * as the given one, but different attributes (including linkage). * * This is especially useful for adding/removing attributes to/from types in * generic code, where the actual type name cannot be spelt out. * * Params: * T = The base type. * linkage = The desired linkage of the result type. * attrs = The desired $(LREF FunctionAttribute)s of the result type. */ template SetFunctionAttributes(T, string linkage, uint attrs) if (isFunctionPointer!T || isDelegate!T) { mixin({ import std.algorithm : canFind; static assert(!(attrs & FunctionAttribute.trusted) || !(attrs & FunctionAttribute.safe), "Cannot have a function/delegate that is both trusted and safe."); enum linkages = ["D", "C", "Windows", "Pascal", "C++", "System"]; static assert(canFind(linkages, linkage), "Invalid linkage '" ~ linkage ~ "', must be one of " ~ linkages.stringof ~ "."); string result = "alias "; static if (linkage != "D") result ~= "extern(" ~ linkage ~ ") "; static if (attrs & FunctionAttribute.ref_) result ~= "ref "; result ~= "ReturnType!T"; static if (isDelegate!T) result ~= " delegate"; else result ~= " function"; result ~= "("; static if (Parameters!T.length > 0) result ~= "Parameters!T"; enum varStyle = variadicFunctionStyle!T; static if (varStyle == Variadic.c) result ~= ", ..."; else static if (varStyle == Variadic.d) result ~= "..."; else static if (varStyle == Variadic.typesafe) result ~= "..."; result ~= ")"; static if (attrs & FunctionAttribute.pure_) result ~= " pure"; static if (attrs & FunctionAttribute.nothrow_) result ~= " nothrow"; static if (attrs & FunctionAttribute.property) result ~= " @property"; static if (attrs & FunctionAttribute.trusted) result ~= " @trusted"; static if (attrs & FunctionAttribute.safe) result ~= " @safe"; static if (attrs & FunctionAttribute.nogc) result ~= " @nogc"; static if (attrs & FunctionAttribute.system) result ~= " @system"; static if (attrs & FunctionAttribute.const_) result ~= " const"; static if (attrs & FunctionAttribute.immutable_) result ~= " immutable"; static if (attrs & FunctionAttribute.inout_) result ~= " inout"; static if (attrs & FunctionAttribute.shared_) result ~= " shared"; static if (attrs & FunctionAttribute.return_) result ~= " return"; result ~= " SetFunctionAttributes;"; return result; }()); } /// Ditto template SetFunctionAttributes(T, string linkage, uint attrs) if (is(T == function)) { // To avoid a lot of syntactic headaches, we just use the above version to // operate on the corresponding function pointer type and then remove the // indirection again. alias SetFunctionAttributes = FunctionTypeOf!(SetFunctionAttributes!(T*, linkage, attrs)); } /// unittest { alias ExternC(T) = SetFunctionAttributes!(T, "C", functionAttributes!T); auto assumePure(T)(T t) if (isFunctionPointer!T || isDelegate!T) { enum attrs = functionAttributes!T | FunctionAttribute.pure_; return cast(SetFunctionAttributes!(T, functionLinkage!T, attrs)) t; } } version (unittest) { // Some function types to test. int sc(scope int, ref int, out int, lazy int, int); extern(System) int novar(); extern(C) int cstyle(int, ...); extern(D) int dstyle(...); extern(D) int typesafe(int[]...); } unittest { import std.algorithm : reduce; alias FA = FunctionAttribute; foreach (BaseT; TypeTuple!(typeof(&sc), typeof(&novar), typeof(&cstyle), typeof(&dstyle), typeof(&typesafe))) { foreach (T; TypeTuple!(BaseT, FunctionTypeOf!BaseT)) (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396 enum linkage = functionLinkage!T; enum attrs = functionAttributes!T; static assert(is(SetFunctionAttributes!(T, linkage, attrs) == T), "Identity check failed for: " ~ T.stringof); // Check that all linkage types work (D-style variadics require D linkage). static if (variadicFunctionStyle!T != Variadic.d) { foreach (newLinkage; TypeTuple!("D", "C", "Windows", "Pascal", "C++")) { alias New = SetFunctionAttributes!(T, newLinkage, attrs); static assert(functionLinkage!New == newLinkage, "Linkage test failed for: " ~ T.stringof ~ ", " ~ newLinkage ~ " (got " ~ New.stringof ~ ")"); } } // Add @safe. alias T1 = SetFunctionAttributes!(T, functionLinkage!T, FA.safe); static assert(functionAttributes!T1 == FA.safe); // Add all known attributes, excluding conflicting ones. enum allAttrs = reduce!"a | b"([EnumMembers!FA]) & ~FA.safe & ~FA.property & ~FA.const_ & ~FA.immutable_ & ~FA.inout_ & ~FA.shared_ & ~FA.system & ~FA.return_; alias T2 = SetFunctionAttributes!(T1, functionLinkage!T, allAttrs); static assert(functionAttributes!T2 == allAttrs); // Strip all attributes again. alias T3 = SetFunctionAttributes!(T2, functionLinkage!T, FA.none); static assert(is(T3 == T)); }(); } } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// // Aggregate Types //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// /** Determines whether $(D T) has its own context pointer. $(D T) must be either $(D class), $(D struct), or $(D union). */ template isNested(T) if(is(T == class) || is(T == struct) || is(T == union)) { enum isNested = __traits(isNested, T); } /// unittest { static struct S { } static assert(!isNested!S); int i; struct NestedStruct { void f() { ++i; } } static assert(isNested!NestedStruct); } /** Determines whether $(D T) or any of its representation types have a context pointer. */ template hasNested(T) { static if(isStaticArray!T && T.length) enum hasNested = hasNested!(typeof(T.init[0])); else static if(is(T == class) || is(T == struct) || is(T == union)) enum hasNested = isNested!T || anySatisfy!(.hasNested, Fields!T); else enum hasNested = false; } /// unittest { static struct S { } int i; struct NS { void f() { ++i; } } static assert(!hasNested!(S[2])); static assert(hasNested!(NS[2])); } unittest { static assert(!__traits(compiles, isNested!int)); static assert(!hasNested!int); static struct StaticStruct { } static assert(!isNested!StaticStruct); static assert(!hasNested!StaticStruct); int i; struct NestedStruct { void f() { ++i; } } static assert( isNested!NestedStruct); static assert( hasNested!NestedStruct); static assert( isNested!(immutable NestedStruct)); static assert( hasNested!(immutable NestedStruct)); static assert(!__traits(compiles, isNested!(NestedStruct[1]))); static assert( hasNested!(NestedStruct[1])); static assert(!hasNested!(NestedStruct[0])); struct S1 { NestedStruct nested; } static assert(!isNested!S1); static assert( hasNested!S1); static struct S2 { NestedStruct nested; } static assert(!isNested!S2); static assert( hasNested!S2); static struct S3 { NestedStruct[0] nested; } static assert(!isNested!S3); static assert(!hasNested!S3); static union U { NestedStruct nested; } static assert(!isNested!U); static assert( hasNested!U); static class StaticClass { } static assert(!isNested!StaticClass); static assert(!hasNested!StaticClass); class NestedClass { void f() { ++i; } } static assert( isNested!NestedClass); static assert( hasNested!NestedClass); static assert( isNested!(immutable NestedClass)); static assert( hasNested!(immutable NestedClass)); static assert(!__traits(compiles, isNested!(NestedClass[1]))); static assert( hasNested!(NestedClass[1])); static assert(!hasNested!(NestedClass[0])); } /*** * Get as a tuple the types of the fields of a struct, class, or union. * This consists of the fields that take up memory space, * excluding the hidden fields like the virtual function * table pointer or a context pointer for nested types. * If $(D T) isn't a struct, class, or union returns a tuple * with one element $(D T). */ template Fields(T) { static if (is(T == struct) || is(T == union)) alias Fields = typeof(T.tupleof[0 .. $ - isNested!T]); else static if (is(T == class)) alias Fields = typeof(T.tupleof); else alias Fields = TypeTuple!T; } /// unittest { struct S { int x; float y; } static assert(is(Fields!S == TypeTuple!(int, float))); } /** * Alternate name for $(LREF FieldTypeTuple), kept for legacy compatibility. */ alias FieldTypeTuple = Fields; unittest { static assert(is(FieldTypeTuple!int == TypeTuple!int)); static struct StaticStruct1 { } static assert(is(FieldTypeTuple!StaticStruct1 == TypeTuple!())); static struct StaticStruct2 { int a, b; } static assert(is(FieldTypeTuple!StaticStruct2 == TypeTuple!(int, int))); int i; struct NestedStruct1 { void f() { ++i; } } static assert(is(FieldTypeTuple!NestedStruct1 == TypeTuple!())); struct NestedStruct2 { int a; void f() { ++i; } } static assert(is(FieldTypeTuple!NestedStruct2 == TypeTuple!int)); class NestedClass { int a; void f() { ++i; } } static assert(is(FieldTypeTuple!NestedClass == TypeTuple!int)); } //Required for FieldNameTuple private enum NameOf(alias T) = T.stringof; /** * Get as an expression tuple the names of the fields of a struct, class, or * union. This consists of the fields that take up memory space, excluding the * hidden fields like the virtual function table pointer or a context pointer * for nested types. If $(D T) isn't a struct, class, or union returns an * expression tuple with an empty string. */ template FieldNameTuple(T) { static if (is(T == struct) || is(T == union)) alias FieldNameTuple = staticMap!(NameOf, T.tupleof[0 .. $ - isNested!T]); else static if (is(T == class)) alias FieldNameTuple = staticMap!(NameOf, T.tupleof); else alias FieldNameTuple = TypeTuple!""; } /// unittest { struct S { int x; float y; } static assert(FieldNameTuple!S == TypeTuple!("x", "y")); static assert(FieldNameTuple!int == TypeTuple!""); } unittest { static assert(FieldNameTuple!int == TypeTuple!""); static struct StaticStruct1 { } static assert(is(FieldNameTuple!StaticStruct1 == TypeTuple!())); static struct StaticStruct2 { int a, b; } static assert(FieldNameTuple!StaticStruct2 == TypeTuple!("a", "b")); int i; struct NestedStruct1 { void f() { ++i; } } static assert(is(FieldNameTuple!NestedStruct1 == TypeTuple!())); struct NestedStruct2 { int a; void f() { ++i; } } static assert(FieldNameTuple!NestedStruct2 == TypeTuple!"a"); class NestedClass { int a; void f() { ++i; } } static assert(FieldNameTuple!NestedClass == TypeTuple!"a"); } /*** Get the primitive types of the fields of a struct or class, in topological order. */ template RepresentationTypeTuple(T) { template Impl(T...) { static if (T.length == 0) { alias Impl = TypeTuple!(); } else { import std.typecons : Rebindable; static if (is(T[0] R: Rebindable!R)) { alias Impl = Impl!(Impl!R, T[1 .. $]); } else static if (is(T[0] == struct) || is(T[0] == union)) { // @@@BUG@@@ this should work //alias .RepresentationTypes!(T[0].tupleof) // RepresentationTypes; alias Impl = Impl!(FieldTypeTuple!(T[0]), T[1 .. $]); } else { alias Impl = TypeTuple!(T[0], Impl!(T[1 .. $])); } } } static if (is(T == struct) || is(T == union) || is(T == class)) { alias RepresentationTypeTuple = Impl!(FieldTypeTuple!T); } else { alias RepresentationTypeTuple = Impl!T; } } /// unittest { struct S1 { int a; float b; } struct S2 { char[] a; union { S1 b; S1 * c; } } alias R = RepresentationTypeTuple!S2; assert(R.length == 4 && is(R[0] == char[]) && is(R[1] == int) && is(R[2] == float) && is(R[3] == S1*)); } unittest { alias S1 = RepresentationTypeTuple!int; static assert(is(S1 == TypeTuple!int)); struct S2 { int a; } struct S3 { int a; char b; } struct S4 { S1 a; int b; S3 c; } static assert(is(RepresentationTypeTuple!S2 == TypeTuple!int)); static assert(is(RepresentationTypeTuple!S3 == TypeTuple!(int, char))); static assert(is(RepresentationTypeTuple!S4 == TypeTuple!(int, int, int, char))); struct S11 { int a; float b; } struct S21 { char[] a; union { S11 b; S11 * c; } } alias R = RepresentationTypeTuple!S21; assert(R.length == 4 && is(R[0] == char[]) && is(R[1] == int) && is(R[2] == float) && is(R[3] == S11*)); class C { int a; float b; } alias R1 = RepresentationTypeTuple!C; static assert(R1.length == 2 && is(R1[0] == int) && is(R1[1] == float)); /* Issue 6642 */ import std.typecons : Rebindable; struct S5 { int a; Rebindable!(immutable Object) b; } alias R2 = RepresentationTypeTuple!S5; static assert(R2.length == 2 && is(R2[0] == int) && is(R2[1] == immutable(Object))); } /* Statically evaluates to $(D true) if and only if $(D T)'s representation contains at least one field of pointer or array type. Members of class types are not considered raw pointers. Pointers to immutable objects are not considered raw aliasing. */ private template hasRawAliasing(T...) { template Impl(T...) { static if (T.length == 0) { enum Impl = false; } else { static if (is(T[0] foo : U*, U) && !isFunctionPointer!(T[0])) enum has = !is(U == immutable); else static if (is(T[0] foo : U[], U) && !isStaticArray!(T[0])) enum has = !is(U == immutable); else static if (isAssociativeArray!(T[0])) enum has = !is(T[0] == immutable); else enum has = false; enum Impl = has || Impl!(T[1 .. $]); } } enum hasRawAliasing = Impl!(RepresentationTypeTuple!T); } /// unittest { // simple types static assert(!hasRawAliasing!int); static assert( hasRawAliasing!(char*)); // references aren't raw pointers static assert(!hasRawAliasing!Object); // built-in arrays do contain raw pointers static assert( hasRawAliasing!(int[])); // aggregate of simple types struct S1 { int a; double b; } static assert(!hasRawAliasing!S1); // indirect aggregation struct S2 { S1 a; double b; } static assert(!hasRawAliasing!S2); } unittest { // struct with a pointer member struct S3 { int a; double * b; } static assert( hasRawAliasing!S3); // struct with an indirect pointer member struct S4 { S3 a; double b; } static assert( hasRawAliasing!S4); struct S5 { int a; Object z; int c; } static assert( hasRawAliasing!S3); static assert( hasRawAliasing!S4); static assert(!hasRawAliasing!S5); union S6 { int a; int b; } union S7 { int a; int * b; } static assert(!hasRawAliasing!S6); static assert( hasRawAliasing!S7); static assert(!hasRawAliasing!(void delegate())); static assert(!hasRawAliasing!(void delegate() const)); static assert(!hasRawAliasing!(void delegate() immutable)); static assert(!hasRawAliasing!(void delegate() shared)); static assert(!hasRawAliasing!(void delegate() shared const)); static assert(!hasRawAliasing!(const(void delegate()))); static assert(!hasRawAliasing!(immutable(void delegate()))); struct S8 { void delegate() a; int b; Object c; } class S12 { typeof(S8.tupleof) a; } class S13 { typeof(S8.tupleof) a; int* b; } static assert(!hasRawAliasing!S8); static assert(!hasRawAliasing!S12); static assert( hasRawAliasing!S13); enum S9 { a } static assert(!hasRawAliasing!S9); // indirect members struct S10 { S7 a; int b; } struct S11 { S6 a; int b; } static assert( hasRawAliasing!S10); static assert(!hasRawAliasing!S11); static assert( hasRawAliasing!(int[string])); static assert(!hasRawAliasing!(immutable(int[string]))); } /* Statically evaluates to $(D true) if and only if $(D T)'s representation contains at least one non-shared field of pointer or array type. Members of class types are not considered raw pointers. Pointers to immutable objects are not considered raw aliasing. */ private template hasRawUnsharedAliasing(T...) { template Impl(T...) { static if (T.length == 0) { enum Impl = false; } else { static if (is(T[0] foo : U*, U) && !isFunctionPointer!(T[0])) enum has = !is(U == immutable) && !is(U == shared); else static if (is(T[0] foo : U[], U) && !isStaticArray!(T[0])) enum has = !is(U == immutable) && !is(U == shared); else static if (isAssociativeArray!(T[0])) enum has = !is(T[0] == immutable) && !is(T[0] == shared); else enum has = false; enum Impl = has || Impl!(T[1 .. $]); } } enum hasRawUnsharedAliasing = Impl!(RepresentationTypeTuple!T); } /// unittest { // simple types static assert(!hasRawUnsharedAliasing!int); static assert( hasRawUnsharedAliasing!(char*)); static assert(!hasRawUnsharedAliasing!(shared char*)); // references aren't raw pointers static assert(!hasRawUnsharedAliasing!Object); // built-in arrays do contain raw pointers static assert( hasRawUnsharedAliasing!(int[])); static assert(!hasRawUnsharedAliasing!(shared int[])); // aggregate of simple types struct S1 { int a; double b; } static assert(!hasRawUnsharedAliasing!S1); // indirect aggregation struct S2 { S1 a; double b; } static assert(!hasRawUnsharedAliasing!S2); // struct with a pointer member struct S3 { int a; double * b; } static assert( hasRawUnsharedAliasing!S3); struct S4 { int a; shared double * b; } static assert(!hasRawUnsharedAliasing!S4); } unittest { // struct with a pointer member struct S3 { int a; double * b; } static assert( hasRawUnsharedAliasing!S3); struct S4 { int a; shared double * b; } static assert(!hasRawUnsharedAliasing!S4); // struct with an indirect pointer member struct S5 { S3 a; double b; } static assert( hasRawUnsharedAliasing!S5); struct S6 { S4 a; double b; } static assert(!hasRawUnsharedAliasing!S6); struct S7 { int a; Object z; int c; } static assert( hasRawUnsharedAliasing!S5); static assert(!hasRawUnsharedAliasing!S6); static assert(!hasRawUnsharedAliasing!S7); union S8 { int a; int b; } union S9 { int a; int* b; } union S10 { int a; shared int* b; } static assert(!hasRawUnsharedAliasing!S8); static assert( hasRawUnsharedAliasing!S9); static assert(!hasRawUnsharedAliasing!S10); static assert(!hasRawUnsharedAliasing!(void delegate())); static assert(!hasRawUnsharedAliasing!(void delegate() const)); static assert(!hasRawUnsharedAliasing!(void delegate() immutable)); static assert(!hasRawUnsharedAliasing!(void delegate() shared)); static assert(!hasRawUnsharedAliasing!(void delegate() shared const)); static assert(!hasRawUnsharedAliasing!(const(void delegate()))); static assert(!hasRawUnsharedAliasing!(const(void delegate() const))); static assert(!hasRawUnsharedAliasing!(const(void delegate() immutable))); static assert(!hasRawUnsharedAliasing!(const(void delegate() shared))); static assert(!hasRawUnsharedAliasing!(const(void delegate() shared const))); static assert(!hasRawUnsharedAliasing!(immutable(void delegate()))); static assert(!hasRawUnsharedAliasing!(immutable(void delegate() const))); static assert(!hasRawUnsharedAliasing!(immutable(void delegate() immutable))); static assert(!hasRawUnsharedAliasing!(immutable(void delegate() shared))); static assert(!hasRawUnsharedAliasing!(immutable(void delegate() shared const))); static assert(!hasRawUnsharedAliasing!(shared(void delegate()))); static assert(!hasRawUnsharedAliasing!(shared(void delegate() const))); static assert(!hasRawUnsharedAliasing!(shared(void delegate() immutable))); static assert(!hasRawUnsharedAliasing!(shared(void delegate() shared))); static assert(!hasRawUnsharedAliasing!(shared(void delegate() shared const))); static assert(!hasRawUnsharedAliasing!(shared(const(void delegate())))); static assert(!hasRawUnsharedAliasing!(shared(const(void delegate() const)))); static assert(!hasRawUnsharedAliasing!(shared(const(void delegate() immutable)))); static assert(!hasRawUnsharedAliasing!(shared(const(void delegate() shared)))); static assert(!hasRawUnsharedAliasing!(shared(const(void delegate() shared const)))); static assert(!hasRawUnsharedAliasing!(void function())); enum S13 { a } static assert(!hasRawUnsharedAliasing!S13); // indirect members struct S14 { S9 a; int b; } struct S15 { S10 a; int b; } struct S16 { S6 a; int b; } static assert( hasRawUnsharedAliasing!S14); static assert(!hasRawUnsharedAliasing!S15); static assert(!hasRawUnsharedAliasing!S16); static assert( hasRawUnsharedAliasing!(int[string])); static assert(!hasRawUnsharedAliasing!(shared(int[string]))); static assert(!hasRawUnsharedAliasing!(immutable(int[string]))); struct S17 { void delegate() shared a; void delegate() immutable b; void delegate() shared const c; shared(void delegate()) d; shared(void delegate() shared) e; shared(void delegate() immutable) f; shared(void delegate() shared const) g; immutable(void delegate()) h; immutable(void delegate() shared) i; immutable(void delegate() immutable) j; immutable(void delegate() shared const) k; shared(const(void delegate())) l; shared(const(void delegate() shared)) m; shared(const(void delegate() immutable)) n; shared(const(void delegate() shared const)) o; } struct S18 { typeof(S17.tupleof) a; void delegate() p; } struct S19 { typeof(S17.tupleof) a; Object p; } struct S20 { typeof(S17.tupleof) a; int* p; } class S21 { typeof(S17.tupleof) a; } class S22 { typeof(S17.tupleof) a; void delegate() p; } class S23 { typeof(S17.tupleof) a; Object p; } class S24 { typeof(S17.tupleof) a; int* p; } static assert(!hasRawUnsharedAliasing!S17); static assert(!hasRawUnsharedAliasing!(immutable(S17))); static assert(!hasRawUnsharedAliasing!(shared(S17))); static assert(!hasRawUnsharedAliasing!S18); static assert(!hasRawUnsharedAliasing!(immutable(S18))); static assert(!hasRawUnsharedAliasing!(shared(S18))); static assert(!hasRawUnsharedAliasing!S19); static assert(!hasRawUnsharedAliasing!(immutable(S19))); static assert(!hasRawUnsharedAliasing!(shared(S19))); static assert( hasRawUnsharedAliasing!S20); static assert(!hasRawUnsharedAliasing!(immutable(S20))); static assert(!hasRawUnsharedAliasing!(shared(S20))); static assert(!hasRawUnsharedAliasing!S21); static assert(!hasRawUnsharedAliasing!(immutable(S21))); static assert(!hasRawUnsharedAliasing!(shared(S21))); static assert(!hasRawUnsharedAliasing!S22); static assert(!hasRawUnsharedAliasing!(immutable(S22))); static assert(!hasRawUnsharedAliasing!(shared(S22))); static assert(!hasRawUnsharedAliasing!S23); static assert(!hasRawUnsharedAliasing!(immutable(S23))); static assert(!hasRawUnsharedAliasing!(shared(S23))); static assert( hasRawUnsharedAliasing!S24); static assert(!hasRawUnsharedAliasing!(immutable(S24))); static assert(!hasRawUnsharedAliasing!(shared(S24))); struct S25 {} class S26 {} interface S27 {} union S28 {} static assert(!hasRawUnsharedAliasing!S25); static assert(!hasRawUnsharedAliasing!S26); static assert(!hasRawUnsharedAliasing!S27); static assert(!hasRawUnsharedAliasing!S28); } /* Statically evaluates to $(D true) if and only if $(D T)'s representation includes at least one non-immutable object reference. */ private template hasObjects(T...) { static if (T.length == 0) { enum hasObjects = false; } else static if (is(T[0] == struct)) { enum hasObjects = hasObjects!( RepresentationTypeTuple!(T[0]), T[1 .. $]); } else { enum hasObjects = ((is(T[0] == class) || is(T[0] == interface)) && !is(T[0] == immutable)) || hasObjects!(T[1 .. $]); } } /* Statically evaluates to $(D true) if and only if $(D T)'s representation includes at least one non-immutable non-shared object reference. */ private template hasUnsharedObjects(T...) { static if (T.length == 0) { enum hasUnsharedObjects = false; } else static if (is(T[0] == struct)) { enum hasUnsharedObjects = hasUnsharedObjects!( RepresentationTypeTuple!(T[0]), T[1 .. $]); } else { enum hasUnsharedObjects = ((is(T[0] == class) || is(T[0] == interface)) && !is(T[0] == immutable) && !is(T[0] == shared)) || hasUnsharedObjects!(T[1 .. $]); } } /** Returns $(D true) if and only if $(D T)'s representation includes at least one of the following: $(OL $(LI a raw pointer $(D U*) and $(D U) is not immutable;) $(LI an array $(D U[]) and $(D U) is not immutable;) $(LI a reference to a class or interface type $(D C) and $(D C) is not immutable.) $(LI an associative array that is not immutable.) $(LI a delegate.)) */ template hasAliasing(T...) { import std.typecons : Rebindable; static if (T.length && is(T[0] : Rebindable!R, R)) { enum hasAliasing = hasAliasing!(R, T[1 .. $]); } else { template isAliasingDelegate(T) { enum isAliasingDelegate = isDelegate!T && !is(T == immutable) && !is(FunctionTypeOf!T == immutable); } enum hasAliasing = hasRawAliasing!T || hasObjects!T || anySatisfy!(isAliasingDelegate, T, RepresentationTypeTuple!T); } } /// unittest { struct S1 { int a; Object b; } struct S2 { string a; } struct S3 { int a; immutable Object b; } struct S4 { float[3] vals; } static assert( hasAliasing!S1); static assert(!hasAliasing!S2); static assert(!hasAliasing!S3); static assert(!hasAliasing!S4); } unittest { static assert( hasAliasing!(uint[uint])); static assert(!hasAliasing!(immutable(uint[uint]))); static assert( hasAliasing!(void delegate())); static assert( hasAliasing!(void delegate() const)); static assert(!hasAliasing!(void delegate() immutable)); static assert( hasAliasing!(void delegate() shared)); static assert( hasAliasing!(void delegate() shared const)); static assert( hasAliasing!(const(void delegate()))); static assert( hasAliasing!(const(void delegate() const))); static assert(!hasAliasing!(const(void delegate() immutable))); static assert( hasAliasing!(const(void delegate() shared))); static assert( hasAliasing!(const(void delegate() shared const))); static assert(!hasAliasing!(immutable(void delegate()))); static assert(!hasAliasing!(immutable(void delegate() const))); static assert(!hasAliasing!(immutable(void delegate() immutable))); static assert(!hasAliasing!(immutable(void delegate() shared))); static assert(!hasAliasing!(immutable(void delegate() shared const))); static assert( hasAliasing!(shared(const(void delegate())))); static assert( hasAliasing!(shared(const(void delegate() const)))); static assert(!hasAliasing!(shared(const(void delegate() immutable)))); static assert( hasAliasing!(shared(const(void delegate() shared)))); static assert( hasAliasing!(shared(const(void delegate() shared const)))); static assert(!hasAliasing!(void function())); interface I; static assert( hasAliasing!I); import std.typecons : Rebindable; static assert( hasAliasing!(Rebindable!(const Object))); static assert(!hasAliasing!(Rebindable!(immutable Object))); static assert( hasAliasing!(Rebindable!(shared Object))); static assert( hasAliasing!(Rebindable!Object)); struct S5 { void delegate() immutable b; shared(void delegate() immutable) f; immutable(void delegate() immutable) j; shared(const(void delegate() immutable)) n; } struct S6 { typeof(S5.tupleof) a; void delegate() p; } static assert(!hasAliasing!S5); static assert( hasAliasing!S6); struct S7 { void delegate() a; int b; Object c; } class S8 { int a; int b; } class S9 { typeof(S8.tupleof) a; } class S10 { typeof(S8.tupleof) a; int* b; } static assert( hasAliasing!S7); static assert( hasAliasing!S8); static assert( hasAliasing!S9); static assert( hasAliasing!S10); struct S11 {} class S12 {} interface S13 {} union S14 {} static assert(!hasAliasing!S11); static assert( hasAliasing!S12); static assert( hasAliasing!S13); static assert(!hasAliasing!S14); } /** Returns $(D true) if and only if $(D T)'s representation includes at least one of the following: $(OL $(LI a raw pointer $(D U*);) $(LI an array $(D U[]);) $(LI a reference to a class type $(D C).) $(LI an associative array.) $(LI a delegate.)) */ template hasIndirections(T) { static if (is(T == struct) || is(T == union)) enum hasIndirections = anySatisfy!(.hasIndirections, FieldTypeTuple!T); else static if (isStaticArray!T && is(T : E[N], E, size_t N)) enum hasIndirections = is(E == void) ? true : hasIndirections!E; else static if (isFunctionPointer!T) enum hasIndirections = false; else enum hasIndirections = isPointer!T || isDelegate!T || isDynamicArray!T || isAssociativeArray!T || is (T == class) || is(T == interface); } /// unittest { static assert( hasIndirections!(int[string])); static assert( hasIndirections!(void delegate())); static assert( hasIndirections!(void delegate() immutable)); static assert( hasIndirections!(immutable(void delegate()))); static assert( hasIndirections!(immutable(void delegate() immutable))); static assert(!hasIndirections!(void function())); static assert( hasIndirections!(void*[1])); static assert(!hasIndirections!(byte[1])); } unittest { // void static array hides actual type of bits, so "may have indirections". static assert( hasIndirections!(void[1])); interface I {} struct S1 {} struct S2 { int a; } struct S3 { int a; int b; } struct S4 { int a; int* b; } struct S5 { int a; Object b; } struct S6 { int a; string b; } struct S7 { int a; immutable Object b; } struct S8 { int a; immutable I b; } struct S9 { int a; void delegate() b; } struct S10 { int a; immutable(void delegate()) b; } struct S11 { int a; void delegate() immutable b; } struct S12 { int a; immutable(void delegate() immutable) b; } class S13 {} class S14 { int a; } class S15 { int a; int b; } class S16 { int a; Object b; } class S17 { string a; } class S18 { int a; immutable Object b; } class S19 { int a; immutable(void delegate() immutable) b; } union S20 {} union S21 { int a; } union S22 { int a; int b; } union S23 { int a; Object b; } union S24 { string a; } union S25 { int a; immutable Object b; } union S26 { int a; immutable(void delegate() immutable) b; } static assert( hasIndirections!I); static assert(!hasIndirections!S1); static assert(!hasIndirections!S2); static assert(!hasIndirections!S3); static assert( hasIndirections!S4); static assert( hasIndirections!S5); static assert( hasIndirections!S6); static assert( hasIndirections!S7); static assert( hasIndirections!S8); static assert( hasIndirections!S9); static assert( hasIndirections!S10); static assert( hasIndirections!S12); static assert( hasIndirections!S13); static assert( hasIndirections!S14); static assert( hasIndirections!S15); static assert( hasIndirections!S16); static assert( hasIndirections!S17); static assert( hasIndirections!S18); static assert( hasIndirections!S19); static assert(!hasIndirections!S20); static assert(!hasIndirections!S21); static assert(!hasIndirections!S22); static assert( hasIndirections!S23); static assert( hasIndirections!S24); static assert( hasIndirections!S25); static assert( hasIndirections!S26); } unittest //12000 { static struct S(T) { static assert(hasIndirections!T); } static class A(T) { S!A a; } A!int dummy; } /** Returns $(D true) if and only if $(D T)'s representation includes at least one of the following: $(OL $(LI a raw pointer $(D U*) and $(D U) is not immutable or shared;) $(LI an array $(D U[]) and $(D U) is not immutable or shared;) $(LI a reference to a class type $(D C) and $(D C) is not immutable or shared.) $(LI an associative array that is not immutable or shared.) $(LI a delegate that is not shared.)) */ template hasUnsharedAliasing(T...) { import std.typecons : Rebindable; static if (!T.length) { enum hasUnsharedAliasing = false; } else static if (is(T[0] R: Rebindable!R)) { enum hasUnsharedAliasing = hasUnsharedAliasing!R; } else { template unsharedDelegate(T) { enum bool unsharedDelegate = isDelegate!T && !is(T == shared) && !is(T == shared) && !is(T == immutable) && !is(FunctionTypeOf!T == shared) && !is(FunctionTypeOf!T == immutable); } enum hasUnsharedAliasing = hasRawUnsharedAliasing!(T[0]) || anySatisfy!(unsharedDelegate, RepresentationTypeTuple!(T[0])) || hasUnsharedObjects!(T[0]) || hasUnsharedAliasing!(T[1..$]); } } /// unittest { struct S1 { int a; Object b; } struct S2 { string a; } struct S3 { int a; immutable Object b; } static assert( hasUnsharedAliasing!S1); static assert(!hasUnsharedAliasing!S2); static assert(!hasUnsharedAliasing!S3); struct S4 { int a; shared Object b; } struct S5 { char[] a; } struct S6 { shared char[] b; } struct S7 { float[3] vals; } static assert(!hasUnsharedAliasing!S4); static assert( hasUnsharedAliasing!S5); static assert(!hasUnsharedAliasing!S6); static assert(!hasUnsharedAliasing!S7); } unittest { /* Issue 6642 */ import std.typecons : Rebindable; struct S8 { int a; Rebindable!(immutable Object) b; } static assert(!hasUnsharedAliasing!S8); static assert( hasUnsharedAliasing!(uint[uint])); static assert( hasUnsharedAliasing!(void delegate())); static assert( hasUnsharedAliasing!(void delegate() const)); static assert(!hasUnsharedAliasing!(void delegate() immutable)); static assert(!hasUnsharedAliasing!(void delegate() shared)); static assert(!hasUnsharedAliasing!(void delegate() shared const)); } unittest { import std.typecons : Rebindable; static assert( hasUnsharedAliasing!(const(void delegate()))); static assert( hasUnsharedAliasing!(const(void delegate() const))); static assert(!hasUnsharedAliasing!(const(void delegate() immutable))); static assert(!hasUnsharedAliasing!(const(void delegate() shared))); static assert(!hasUnsharedAliasing!(const(void delegate() shared const))); static assert(!hasUnsharedAliasing!(immutable(void delegate()))); static assert(!hasUnsharedAliasing!(immutable(void delegate() const))); static assert(!hasUnsharedAliasing!(immutable(void delegate() immutable))); static assert(!hasUnsharedAliasing!(immutable(void delegate() shared))); static assert(!hasUnsharedAliasing!(immutable(void delegate() shared const))); static assert(!hasUnsharedAliasing!(shared(void delegate()))); static assert(!hasUnsharedAliasing!(shared(void delegate() const))); static assert(!hasUnsharedAliasing!(shared(void delegate() immutable))); static assert(!hasUnsharedAliasing!(shared(void delegate() shared))); static assert(!hasUnsharedAliasing!(shared(void delegate() shared const))); static assert(!hasUnsharedAliasing!(shared(const(void delegate())))); static assert(!hasUnsharedAliasing!(shared(const(void delegate() const)))); static assert(!hasUnsharedAliasing!(shared(const(void delegate() immutable)))); static assert(!hasUnsharedAliasing!(shared(const(void delegate() shared)))); static assert(!hasUnsharedAliasing!(shared(const(void delegate() shared const)))); static assert(!hasUnsharedAliasing!(void function())); interface I {} static assert(hasUnsharedAliasing!I); static assert( hasUnsharedAliasing!(Rebindable!(const Object))); static assert(!hasUnsharedAliasing!(Rebindable!(immutable Object))); static assert(!hasUnsharedAliasing!(Rebindable!(shared Object))); static assert( hasUnsharedAliasing!(Rebindable!Object)); /* Issue 6979 */ static assert(!hasUnsharedAliasing!(int, shared(int)*)); static assert( hasUnsharedAliasing!(int, int*)); static assert( hasUnsharedAliasing!(int, const(int)[])); static assert( hasUnsharedAliasing!(int, shared(int)*, Rebindable!Object)); static assert(!hasUnsharedAliasing!(shared(int)*, Rebindable!(shared Object))); static assert(!hasUnsharedAliasing!()); struct S9 { void delegate() shared a; void delegate() immutable b; void delegate() shared const c; shared(void delegate()) d; shared(void delegate() shared) e; shared(void delegate() immutable) f; shared(void delegate() shared const) g; immutable(void delegate()) h; immutable(void delegate() shared) i; immutable(void delegate() immutable) j; immutable(void delegate() shared const) k; shared(const(void delegate())) l; shared(const(void delegate() shared)) m; shared(const(void delegate() immutable)) n; shared(const(void delegate() shared const)) o; } struct S10 { typeof(S9.tupleof) a; void delegate() p; } struct S11 { typeof(S9.tupleof) a; Object p; } struct S12 { typeof(S9.tupleof) a; int* p; } class S13 { typeof(S9.tupleof) a; } class S14 { typeof(S9.tupleof) a; void delegate() p; } class S15 { typeof(S9.tupleof) a; Object p; } class S16 { typeof(S9.tupleof) a; int* p; } static assert(!hasUnsharedAliasing!S9); static assert(!hasUnsharedAliasing!(immutable(S9))); static assert(!hasUnsharedAliasing!(shared(S9))); static assert( hasUnsharedAliasing!S10); static assert(!hasUnsharedAliasing!(immutable(S10))); static assert(!hasUnsharedAliasing!(shared(S10))); static assert( hasUnsharedAliasing!S11); static assert(!hasUnsharedAliasing!(immutable(S11))); static assert(!hasUnsharedAliasing!(shared(S11))); static assert( hasUnsharedAliasing!S12); static assert(!hasUnsharedAliasing!(immutable(S12))); static assert(!hasUnsharedAliasing!(shared(S12))); static assert( hasUnsharedAliasing!S13); static assert(!hasUnsharedAliasing!(immutable(S13))); static assert(!hasUnsharedAliasing!(shared(S13))); static assert( hasUnsharedAliasing!S14); static assert(!hasUnsharedAliasing!(immutable(S14))); static assert(!hasUnsharedAliasing!(shared(S14))); static assert( hasUnsharedAliasing!S15); static assert(!hasUnsharedAliasing!(immutable(S15))); static assert(!hasUnsharedAliasing!(shared(S15))); static assert( hasUnsharedAliasing!S16); static assert(!hasUnsharedAliasing!(immutable(S16))); static assert(!hasUnsharedAliasing!(shared(S16))); struct S17 {} class S18 {} interface S19 {} union S20 {} static assert(!hasUnsharedAliasing!S17); static assert( hasUnsharedAliasing!S18); static assert( hasUnsharedAliasing!S19); static assert(!hasUnsharedAliasing!S20); } /** True if $(D S) or any type embedded directly in the representation of $(D S) defines an elaborate copy constructor. Elaborate copy constructors are introduced by defining $(D this(this)) for a $(D struct). Classes and unions never have elaborate copy constructors. */ template hasElaborateCopyConstructor(S) { static if(isStaticArray!S && S.length) { enum bool hasElaborateCopyConstructor = hasElaborateCopyConstructor!(typeof(S.init[0])); } else static if(is(S == struct)) { enum hasElaborateCopyConstructor = hasMember!(S, "__postblit") || anySatisfy!(.hasElaborateCopyConstructor, FieldTypeTuple!S); } else { enum bool hasElaborateCopyConstructor = false; } } /// unittest { static assert(!hasElaborateCopyConstructor!int); static struct S1 { } static struct S2 { this(this) {} } static struct S3 { S2 field; } static struct S4 { S3[1] field; } static struct S5 { S3[] field; } static struct S6 { S3[0] field; } static struct S7 { @disable this(); S3 field; } static assert(!hasElaborateCopyConstructor!S1); static assert( hasElaborateCopyConstructor!S2); static assert( hasElaborateCopyConstructor!(immutable S2)); static assert( hasElaborateCopyConstructor!S3); static assert( hasElaborateCopyConstructor!(S3[1])); static assert(!hasElaborateCopyConstructor!(S3[0])); static assert( hasElaborateCopyConstructor!S4); static assert(!hasElaborateCopyConstructor!S5); static assert(!hasElaborateCopyConstructor!S6); static assert( hasElaborateCopyConstructor!S7); } /** True if $(D S) or any type directly embedded in the representation of $(D S) defines an elaborate assignment. Elaborate assignments are introduced by defining $(D opAssign(typeof(this))) or $(D opAssign(ref typeof(this))) for a $(D struct) or when there is a compiler-generated $(D opAssign). A type $(D S) gets compiler-generated $(D opAssign) in case it has an elaborate copy constructor or elaborate destructor. Classes and unions never have elaborate assignments. Note: Structs with (possibly nested) postblit operator(s) will have a hidden yet elaborate compiler generated assignment operator (unless explicitly disabled). */ template hasElaborateAssign(S) { static if(isStaticArray!S && S.length) { enum bool hasElaborateAssign = hasElaborateAssign!(typeof(S.init[0])); } else static if(is(S == struct)) { enum hasElaborateAssign = is(typeof(S.init.opAssign(rvalueOf!S))) || is(typeof(S.init.opAssign(lvalueOf!S))) || anySatisfy!(.hasElaborateAssign, FieldTypeTuple!S); } else { enum bool hasElaborateAssign = false; } } /// unittest { static assert(!hasElaborateAssign!int); static struct S { void opAssign(S) {} } static assert( hasElaborateAssign!S); static assert(!hasElaborateAssign!(const(S))); static struct S1 { void opAssign(ref S1) {} } static struct S2 { void opAssign(int) {} } static struct S3 { S s; } static assert( hasElaborateAssign!S1); static assert(!hasElaborateAssign!S2); static assert( hasElaborateAssign!S3); static assert( hasElaborateAssign!(S3[1])); static assert(!hasElaborateAssign!(S3[0])); } unittest { static struct S { void opAssign(S) {} } static struct S4 { void opAssign(U)(U u) {} @disable void opAssign(U)(ref U u); } static assert( hasElaborateAssign!S4); static struct S41 { void opAssign(U)(ref U u) {} @disable void opAssign(U)(U u); } static assert( hasElaborateAssign!S41); static struct S5 { @disable this(); this(int n){ s = S(); } S s; } static assert( hasElaborateAssign!S5); static struct S6 { this(this) {} } static struct S7 { this(this) {} @disable void opAssign(S7); } static struct S8 { this(this) {} @disable void opAssign(S8); void opAssign(int) {} } static struct S9 { this(this) {} void opAssign(int) {} } static struct S10 { ~this() { } } static assert( hasElaborateAssign!S6); static assert(!hasElaborateAssign!S7); static assert(!hasElaborateAssign!S8); static assert( hasElaborateAssign!S9); static assert( hasElaborateAssign!S10); static struct SS6 { S6 s; } static struct SS7 { S7 s; } static struct SS8 { S8 s; } static struct SS9 { S9 s; } static assert( hasElaborateAssign!SS6); static assert( hasElaborateAssign!SS7); static assert( hasElaborateAssign!SS8); static assert( hasElaborateAssign!SS9); } /** True if $(D S) or any type directly embedded in the representation of $(D S) defines an elaborate destructor. Elaborate destructors are introduced by defining $(D ~this()) for a $(D struct). Classes and unions never have elaborate destructors, even though classes may define $(D ~this()). */ template hasElaborateDestructor(S) { static if(isStaticArray!S && S.length) { enum bool hasElaborateDestructor = hasElaborateDestructor!(typeof(S.init[0])); } else static if(is(S == struct)) { enum hasElaborateDestructor = hasMember!(S, "__dtor") || anySatisfy!(.hasElaborateDestructor, FieldTypeTuple!S); } else { enum bool hasElaborateDestructor = false; } } /// unittest { static assert(!hasElaborateDestructor!int); static struct S1 { } static struct S2 { ~this() {} } static struct S3 { S2 field; } static struct S4 { S3[1] field; } static struct S5 { S3[] field; } static struct S6 { S3[0] field; } static struct S7 { @disable this(); S3 field; } static assert(!hasElaborateDestructor!S1); static assert( hasElaborateDestructor!S2); static assert( hasElaborateDestructor!(immutable S2)); static assert( hasElaborateDestructor!S3); static assert( hasElaborateDestructor!(S3[1])); static assert(!hasElaborateDestructor!(S3[0])); static assert( hasElaborateDestructor!S4); static assert(!hasElaborateDestructor!S5); static assert(!hasElaborateDestructor!S6); static assert( hasElaborateDestructor!S7); } alias Identity(alias A) = A; /** Yields $(D true) if and only if $(D T) is an aggregate that defines a symbol called $(D name). */ enum hasMember(T, string name) = __traits(hasMember, T, name); /// unittest { static assert(!hasMember!(int, "blah")); struct S1 { int blah; } struct S2 { int blah(){ return 0; } } class C1 { int blah; } class C2 { int blah(){ return 0; } } static assert(hasMember!(S1, "blah")); static assert(hasMember!(S2, "blah")); static assert(hasMember!(C1, "blah")); static assert(hasMember!(C2, "blah")); } unittest { // 8321 struct S { int x; void f(){} void t()(){} template T(){} } struct R1(T) { T t; alias t this; } struct R2(T) { T t; @property ref inout(T) payload() inout { return t; } alias t this; } static assert(hasMember!(S, "x")); static assert(hasMember!(S, "f")); static assert(hasMember!(S, "t")); static assert(hasMember!(S, "T")); static assert(hasMember!(R1!S, "x")); static assert(hasMember!(R1!S, "f")); static assert(hasMember!(R1!S, "t")); static assert(hasMember!(R1!S, "T")); static assert(hasMember!(R2!S, "x")); static assert(hasMember!(R2!S, "f")); static assert(hasMember!(R2!S, "t")); static assert(hasMember!(R2!S, "T")); } unittest { static struct S { void opDispatch(string n, A)(A dummy) {} } static assert(hasMember!(S, "foo")); } /** Retrieves the members of an enumerated type $(D enum E). Params: E = An enumerated type. $(D E) may have duplicated values. Returns: Static tuple composed of the members of the enumerated type $(D E). The members are arranged in the same order as declared in $(D E). Note: An enum can have multiple members which have the same value. If you want to use EnumMembers to e.g. generate switch cases at compile-time, you should use the $(XREF typetuple, NoDuplicates) template to avoid generating duplicate switch cases. Note: Returned values are strictly typed with $(D E). Thus, the following code does not work without the explicit cast: -------------------- enum E : int { a, b, c } int[] abc = cast(int[]) [ EnumMembers!E ]; -------------------- Cast is not necessary if the type of the variable is inferred. See the example below. Examples: Creating an array of enumerated values: -------------------- enum Sqrts : real { one = 1, two = 1.41421, three = 1.73205, } auto sqrts = [ EnumMembers!Sqrts ]; assert(sqrts == [ Sqrts.one, Sqrts.two, Sqrts.three ]); -------------------- A generic function $(D rank(v)) in the following example uses this template for finding a member $(D e) in an enumerated type $(D E). -------------------- // Returns i if e is the i-th enumerator of E. size_t rank(E)(E e) if (is(E == enum)) { foreach (i, member; EnumMembers!E) { if (e == member) return i; } assert(0, "Not an enum member"); } enum Mode { read = 1, write = 2, map = 4, } assert(rank(Mode.read ) == 0); assert(rank(Mode.write) == 1); assert(rank(Mode.map ) == 2); -------------------- */ template EnumMembers(E) if (is(E == enum)) { // Supply the specified identifier to an constant value. template WithIdentifier(string ident) { static if (ident == "Symbolize") { template Symbolize(alias value) { enum Symbolize = value; } } else { mixin("template Symbolize(alias "~ ident ~")" ~"{" ~"alias Symbolize = "~ ident ~";" ~"}"); } } template EnumSpecificMembers(names...) { static if (names.length > 0) { alias EnumSpecificMembers = TypeTuple!( WithIdentifier!(names[0]) .Symbolize!(__traits(getMember, E, names[0])), EnumSpecificMembers!(names[1 .. $]) ); } else { alias EnumSpecificMembers = TypeTuple!(); } } alias EnumMembers = EnumSpecificMembers!(__traits(allMembers, E)); } unittest { enum A { a } static assert([ EnumMembers!A ] == [ A.a ]); enum B { a, b, c, d, e } static assert([ EnumMembers!B ] == [ B.a, B.b, B.c, B.d, B.e ]); } unittest // typed enums { enum A : string { a = "alpha", b = "beta" } static assert([ EnumMembers!A ] == [ A.a, A.b ]); static struct S { int value; int opCmp(S rhs) const nothrow { return value - rhs.value; } } enum B : S { a = S(1), b = S(2), c = S(3) } static assert([ EnumMembers!B ] == [ B.a, B.b, B.c ]); } unittest // duplicated values { enum A { a = 0, b = 0, c = 1, d = 1, e } static assert([ EnumMembers!A ] == [ A.a, A.b, A.c, A.d, A.e ]); } unittest { enum E { member, a = 0, b = 0 } static assert(__traits(identifier, EnumMembers!E[0]) == "member"); static assert(__traits(identifier, EnumMembers!E[1]) == "a"); static assert(__traits(identifier, EnumMembers!E[2]) == "b"); } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// // Classes and Interfaces //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// /*** * Get a $(D_PARAM TypeTuple) of the base class and base interfaces of * this class or interface. $(D_PARAM BaseTypeTuple!Object) returns * the empty type tuple. */ template BaseTypeTuple(A) { static if (is(A P == super)) alias BaseTypeTuple = P; else static assert(0, "argument is not a class or interface"); } /// unittest { interface I1 { } interface I2 { } interface I12 : I1, I2 { } static assert(is(BaseTypeTuple!I12 == TypeTuple!(I1, I2))); interface I3 : I1 { } interface I123 : I1, I2, I3 { } static assert(is(BaseTypeTuple!I123 == TypeTuple!(I1, I2, I3))); } unittest { interface I1 { } interface I2 { } class A { } class C : A, I1, I2 { } alias TL = BaseTypeTuple!C; assert(TL.length == 3); assert(is (TL[0] == A)); assert(is (TL[1] == I1)); assert(is (TL[2] == I2)); assert(BaseTypeTuple!Object.length == 0); } /** * Get a $(D_PARAM TypeTuple) of $(I all) base classes of this class, * in decreasing order. Interfaces are not included. $(D_PARAM * BaseClassesTuple!Object) yields the empty type tuple. */ template BaseClassesTuple(T) if (is(T == class)) { static if (is(T == Object)) { alias BaseClassesTuple = TypeTuple!(); } else static if (is(BaseTypeTuple!T[0] == Object)) { alias BaseClassesTuple = TypeTuple!Object; } else { alias BaseClassesTuple = TypeTuple!(BaseTypeTuple!T[0], BaseClassesTuple!(BaseTypeTuple!T[0])); } } /// unittest { class C1 { } class C2 : C1 { } class C3 : C2 { } static assert(!BaseClassesTuple!Object.length); static assert(is(BaseClassesTuple!C1 == TypeTuple!(Object))); static assert(is(BaseClassesTuple!C2 == TypeTuple!(C1, Object))); static assert(is(BaseClassesTuple!C3 == TypeTuple!(C2, C1, Object))); } unittest { struct S { } static assert(!__traits(compiles, BaseClassesTuple!S)); interface I { } static assert(!__traits(compiles, BaseClassesTuple!I)); class C4 : I { } class C5 : C4, I { } static assert(is(BaseClassesTuple!C5 == TypeTuple!(C4, Object))); } /** * Get a $(D_PARAM TypeTuple) of $(I all) interfaces directly or * indirectly inherited by this class or interface. Interfaces do not * repeat if multiply implemented. $(D_PARAM InterfacesTuple!Object) * yields the empty type tuple. */ template InterfacesTuple(T) { template Flatten(H, T...) { static if (T.length) { alias Flatten = TypeTuple!(Flatten!H, Flatten!T); } else { static if (is(H == interface)) alias Flatten = TypeTuple!(H, InterfacesTuple!H); else alias Flatten = InterfacesTuple!H; } } static if (is(T S == super) && S.length) alias InterfacesTuple = NoDuplicates!(Flatten!S); else alias InterfacesTuple = TypeTuple!(); } unittest { // doc example interface I1 {} interface I2 {} class A : I1, I2 { } class B : A, I1 { } class C : B { } alias TL = InterfacesTuple!C; static assert(is(TL[0] == I1) && is(TL[1] == I2)); } unittest { interface Iaa {} interface Iab {} interface Iba {} interface Ibb {} interface Ia : Iaa, Iab {} interface Ib : Iba, Ibb {} interface I : Ia, Ib {} interface J {} class B2 : J {} class C2 : B2, Ia, Ib {} static assert(is(InterfacesTuple!I == TypeTuple!(Ia, Iaa, Iab, Ib, Iba, Ibb))); static assert(is(InterfacesTuple!C2 == TypeTuple!(J, Ia, Iaa, Iab, Ib, Iba, Ibb))); } /** * Get a $(D_PARAM TypeTuple) of $(I all) base classes of $(D_PARAM * T), in decreasing order, followed by $(D_PARAM T)'s * interfaces. $(D_PARAM TransitiveBaseTypeTuple!Object) yields the * empty type tuple. */ template TransitiveBaseTypeTuple(T) { static if (is(T == Object)) alias TransitiveBaseTypeTuple = TypeTuple!(); else alias TransitiveBaseTypeTuple = TypeTuple!(BaseClassesTuple!T, InterfacesTuple!T); } /// unittest { interface J1 {} interface J2 {} class B1 {} class B2 : B1, J1, J2 {} class B3 : B2, J1 {} alias TL = TransitiveBaseTypeTuple!B3; assert(TL.length == 5); assert(is (TL[0] == B2)); assert(is (TL[1] == B1)); assert(is (TL[2] == Object)); assert(is (TL[3] == J1)); assert(is (TL[4] == J2)); assert(TransitiveBaseTypeTuple!Object.length == 0); } /** Returns a tuple of non-static functions with the name $(D name) declared in the class or interface $(D C). Covariant duplicates are shrunk into the most derived one. */ template MemberFunctionsTuple(C, string name) if (is(C == class) || is(C == interface)) { static if (__traits(hasMember, C, name)) { /* * First, collect all overloads in the class hierarchy. */ template CollectOverloads(Node) { static if (__traits(hasMember, Node, name) && __traits(compiles, __traits(getMember, Node, name))) { // Get all overloads in sight (not hidden). alias inSight = TypeTuple!(__traits(getVirtualFunctions, Node, name)); // And collect all overloads in ancestor classes to reveal hidden // methods. The result may contain duplicates. template walkThru(Parents...) { static if (Parents.length > 0) alias walkThru = TypeTuple!( CollectOverloads!(Parents[0]), walkThru!(Parents[1 .. $]) ); else alias walkThru = TypeTuple!(); } static if (is(Node Parents == super)) alias CollectOverloads = TypeTuple!(inSight, walkThru!Parents); else alias CollectOverloads = TypeTuple!inSight; } else alias CollectOverloads = TypeTuple!(); // no overloads in this hierarchy } // duplicates in this tuple will be removed by shrink() alias overloads = CollectOverloads!C; // shrinkOne!args[0] = the most derived one in the covariant siblings of target // shrinkOne!args[1..$] = non-covariant others template shrinkOne(/+ alias target, rest... +/ args...) { alias target = args[0 .. 1]; // prevent property functions from being evaluated alias rest = args[1 .. $]; static if (rest.length > 0) { alias Target = FunctionTypeOf!target; alias Rest0 = FunctionTypeOf!(rest[0]); static if (isCovariantWith!(Target, Rest0)) // target overrides rest[0] -- erase rest[0]. alias shrinkOne = shrinkOne!(target, rest[1 .. $]); else static if (isCovariantWith!(Rest0, Target)) // rest[0] overrides target -- erase target. alias shrinkOne = shrinkOne!(rest[0], rest[1 .. $]); else // target and rest[0] are distinct. alias shrinkOne = TypeTuple!( shrinkOne!(target, rest[1 .. $]), rest[0] // keep ); } else alias shrinkOne = TypeTuple!target; // done } /* * Now shrink covariant overloads into one. */ template shrink(overloads...) { static if (overloads.length > 0) { alias temp = shrinkOne!overloads; alias shrink = TypeTuple!(temp[0], shrink!(temp[1 .. $])); } else alias shrink = TypeTuple!(); // done } // done. alias MemberFunctionsTuple = shrink!overloads; } else alias MemberFunctionsTuple = TypeTuple!(); } /// unittest { interface I { I foo(); } class B { real foo(real v) { return v; } } class C : B, I { override C foo() { return this; } // covariant overriding of I.foo() } alias foos = MemberFunctionsTuple!(C, "foo"); static assert(foos.length == 2); static assert(__traits(isSame, foos[0], C.foo)); static assert(__traits(isSame, foos[1], B.foo)); } unittest { interface I { I test(); } interface J : I { J test(); } interface K { K test(int); } class B : I, K { K test(int) { return this; } B test() { return this; } static void test(string) { } } class C : B, J { override C test() { return this; } } alias test =MemberFunctionsTuple!(C, "test"); static assert(test.length == 2); static assert(is(FunctionTypeOf!(test[0]) == FunctionTypeOf!(C.test))); static assert(is(FunctionTypeOf!(test[1]) == FunctionTypeOf!(K.test))); alias noexist = MemberFunctionsTuple!(C, "noexist"); static assert(noexist.length == 0); interface L { int prop() @property; } alias prop = MemberFunctionsTuple!(L, "prop"); static assert(prop.length == 1); interface Test_I { void foo(); void foo(int); void foo(int, int); } interface Test : Test_I {} alias Test_foo = MemberFunctionsTuple!(Test, "foo"); static assert(Test_foo.length == 3); static assert(is(typeof(&Test_foo[0]) == void function())); static assert(is(typeof(&Test_foo[2]) == void function(int))); static assert(is(typeof(&Test_foo[1]) == void function(int, int))); } /** Returns an alias to the template that $(D T) is an instance of. */ template TemplateOf(alias T : Base!Args, alias Base, Args...) { alias TemplateOf = Base; } /// ditto template TemplateOf(T : Base!Args, alias Base, Args...) { alias TemplateOf = Base; } /// unittest { struct Foo(T, U) {} static assert(__traits(isSame, TemplateOf!(Foo!(int, real)), Foo)); } unittest { template Foo1(A) {} template Foo2(A, B) {} template Foo3(alias A) {} template Foo4(string A) {} struct Foo5(A) {} struct Foo6(A, B) {} struct Foo7(alias A) {} template Foo8(A) { template Foo9(B) {} } template Foo10() {} static assert(__traits(isSame, TemplateOf!(Foo1!(int)), Foo1)); static assert(__traits(isSame, TemplateOf!(Foo2!(int, int)), Foo2)); static assert(__traits(isSame, TemplateOf!(Foo3!(123)), Foo3)); static assert(__traits(isSame, TemplateOf!(Foo4!("123")), Foo4)); static assert(__traits(isSame, TemplateOf!(Foo5!(int)), Foo5)); static assert(__traits(isSame, TemplateOf!(Foo6!(int, int)), Foo6)); static assert(__traits(isSame, TemplateOf!(Foo7!(123)), Foo7)); static assert(__traits(isSame, TemplateOf!(Foo8!(int).Foo9!(real)), Foo8!(int).Foo9)); static assert(__traits(isSame, TemplateOf!(Foo10!()), Foo10)); } /** Returns a $(D TypeTuple) of the template arguments used to instantiate $(D T). */ template TemplateArgsOf(alias T : Base!Args, alias Base, Args...) { alias TemplateArgsOf = Args; } /// ditto template TemplateArgsOf(T : Base!Args, alias Base, Args...) { alias TemplateArgsOf = Args; } /// unittest { struct Foo(T, U) {} static assert(is(TemplateArgsOf!(Foo!(int, real)) == TypeTuple!(int, real))); } unittest { template Foo1(A) {} template Foo2(A, B) {} template Foo3(alias A) {} template Foo4(string A) {} struct Foo5(A) {} struct Foo6(A, B) {} struct Foo7(alias A) {} template Foo8(A) { template Foo9(B) {} } template Foo10() {} enum x = 123; enum y = "123"; static assert(is(TemplateArgsOf!(Foo1!(int)) == TypeTuple!(int))); static assert(is(TemplateArgsOf!(Foo2!(int, int)) == TypeTuple!(int, int))); static assert(__traits(isSame, TemplateArgsOf!(Foo3!(x)), TypeTuple!(x))); static assert(TemplateArgsOf!(Foo4!(y)) == TypeTuple!(y)); static assert(is(TemplateArgsOf!(Foo5!(int)) == TypeTuple!(int))); static assert(is(TemplateArgsOf!(Foo6!(int, int)) == TypeTuple!(int, int))); static assert(__traits(isSame, TemplateArgsOf!(Foo7!(x)), TypeTuple!(x))); static assert(is(TemplateArgsOf!(Foo8!(int).Foo9!(real)) == TypeTuple!(real))); static assert(is(TemplateArgsOf!(Foo10!()) == TypeTuple!())); } private template maxAlignment(U...) if (isTypeTuple!U) { static if (U.length == 0) static assert(0); else static if (U.length == 1) enum maxAlignment = U[0].alignof; else { import std.algorithm : max; enum maxAlignment = max(staticMap!(.maxAlignment, U)); } } /** Returns class instance alignment. */ template classInstanceAlignment(T) if(is(T == class)) { alias classInstanceAlignment = maxAlignment!(void*, typeof(T.tupleof)); } /// unittest { class A { byte b; } class B { long l; } // As class instance always has a hidden pointer static assert(classInstanceAlignment!A == (void*).alignof); static assert(classInstanceAlignment!B == long.alignof); } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// // Type Conversion //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// /** Get the type that all types can be implicitly converted to. Useful e.g. in figuring out an array type from a bunch of initializing values. Returns $(D_PARAM void) if passed an empty list, or if the types have no common type. */ template CommonType(T...) { static if (!T.length) { alias CommonType = void; } else static if (T.length == 1) { static if(is(typeof(T[0]))) { alias CommonType = typeof(T[0]); } else { alias CommonType = T[0]; } } else static if (is(typeof(true ? T[0].init : T[1].init) U)) { alias CommonType = CommonType!(U, T[2 .. $]); } else alias CommonType = void; } /// unittest { alias X = CommonType!(int, long, short); assert(is(X == long)); alias Y = CommonType!(int, char[], short); assert(is(Y == void)); } unittest { static assert(is(CommonType!(3) == int)); static assert(is(CommonType!(double, 4, float) == double)); static assert(is(CommonType!(string, char[]) == const(char)[])); static assert(is(CommonType!(3, 3U) == uint)); } /** * Returns a tuple with all possible target types of an implicit * conversion of a value of type $(D_PARAM T). * * Important note: * * The possible targets are computed more conservatively than the D * 2.005 compiler does, eliminating all dangerous conversions. For * example, $(D_PARAM ImplicitConversionTargets!double) does not * include $(D_PARAM float). */ template ImplicitConversionTargets(T) { static if (is(T == bool)) alias ImplicitConversionTargets = TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong, CentTypeList, float, double, real, char, wchar, dchar); else static if (is(T == byte)) alias ImplicitConversionTargets = TypeTuple!(short, ushort, int, uint, long, ulong, CentTypeList, float, double, real, char, wchar, dchar); else static if (is(T == ubyte)) alias ImplicitConversionTargets = TypeTuple!(short, ushort, int, uint, long, ulong, CentTypeList, float, double, real, char, wchar, dchar); else static if (is(T == short)) alias ImplicitConversionTargets = TypeTuple!(int, uint, long, ulong, CentTypeList, float, double, real); else static if (is(T == ushort)) alias ImplicitConversionTargets = TypeTuple!(int, uint, long, ulong, CentTypeList, float, double, real); else static if (is(T == int)) alias ImplicitConversionTargets = TypeTuple!(long, ulong, CentTypeList, float, double, real); else static if (is(T == uint)) alias ImplicitConversionTargets = TypeTuple!(long, ulong, CentTypeList, float, double, real); else static if (is(T == long)) alias ImplicitConversionTargets = TypeTuple!(float, double, real); else static if (is(T == ulong)) alias ImplicitConversionTargets = TypeTuple!(float, double, real); else static if (is(cent) && is(T == cent)) alias ImplicitConversionTargets = TypeTuple!(float, double, real); else static if (is(ucent) && is(T == ucent)) alias ImplicitConversionTargets = TypeTuple!(float, double, real); else static if (is(T == float)) alias ImplicitConversionTargets = TypeTuple!(double, real); else static if (is(T == double)) alias ImplicitConversionTargets = TypeTuple!real; else static if (is(T == char)) alias ImplicitConversionTargets = TypeTuple!(wchar, dchar, byte, ubyte, short, ushort, int, uint, long, ulong, CentTypeList, float, double, real); else static if (is(T == wchar)) alias ImplicitConversionTargets = TypeTuple!(dchar, short, ushort, int, uint, long, ulong, CentTypeList, float, double, real); else static if (is(T == dchar)) alias ImplicitConversionTargets = TypeTuple!(int, uint, long, ulong, CentTypeList, float, double, real); else static if (is(T : typeof(null))) alias ImplicitConversionTargets = TypeTuple!(typeof(null)); else static if(is(T : Object)) alias ImplicitConversionTargets = TransitiveBaseTypeTuple!(T); else static if (isDynamicArray!T && !is(typeof(T.init[0]) == const)) alias ImplicitConversionTargets = TypeTuple!(const(Unqual!(typeof(T.init[0])))[]); else static if (is(T : void*)) alias ImplicitConversionTargets = TypeTuple!(void*); else alias ImplicitConversionTargets = TypeTuple!(); } unittest { static assert(is(ImplicitConversionTargets!(double)[0] == real)); static assert(is(ImplicitConversionTargets!(string)[0] == const(char)[])); } /** Is $(D From) implicitly convertible to $(D To)? */ template isImplicitlyConvertible(From, To) { enum bool isImplicitlyConvertible = is(typeof({ void fun(ref From v) { void gun(To) {} gun(v); } })); } unittest { static assert( isImplicitlyConvertible!(immutable(char), char)); static assert( isImplicitlyConvertible!(const(char), char)); static assert( isImplicitlyConvertible!(char, wchar)); static assert(!isImplicitlyConvertible!(wchar, char)); // bug6197 static assert(!isImplicitlyConvertible!(const(ushort), ubyte)); static assert(!isImplicitlyConvertible!(const(uint), ubyte)); static assert(!isImplicitlyConvertible!(const(ulong), ubyte)); // from std.conv.implicitlyConverts assert(!isImplicitlyConvertible!(const(char)[], string)); assert( isImplicitlyConvertible!(string, const(char)[])); } /** Returns $(D true) iff a value of type $(D Rhs) can be assigned to a variable of type $(D Lhs). $(D isAssignable) returns whether both an lvalue and rvalue can be assigned. If you omit $(D Rhs), $(D isAssignable) will check identity assignable of $(D Lhs). */ enum isAssignable(Lhs, Rhs = Lhs) = isRvalueAssignable!(Lhs, Rhs) && isLvalueAssignable!(Lhs, Rhs); /// unittest { static assert( isAssignable!(long, int)); static assert(!isAssignable!(int, long)); static assert( isAssignable!(const(char)[], string)); static assert(!isAssignable!(string, char[])); // int is assignable to int static assert( isAssignable!int); // immutable int is not assignable to immutable int static assert(!isAssignable!(immutable int)); } // ditto private enum isRvalueAssignable(Lhs, Rhs = Lhs) = __traits(compiles, lvalueOf!Lhs = rvalueOf!Rhs); // ditto private enum isLvalueAssignable(Lhs, Rhs = Lhs) = __traits(compiles, lvalueOf!Lhs = lvalueOf!Rhs); unittest { static assert(!isAssignable!(immutable int, int)); static assert( isAssignable!(int, immutable int)); static assert(!isAssignable!(inout int, int)); static assert( isAssignable!(int, inout int)); static assert(!isAssignable!(inout int)); static assert( isAssignable!(shared int, int)); static assert( isAssignable!(int, shared int)); static assert( isAssignable!(shared int)); static assert( isAssignable!(void[1], void[1])); struct S { @disable this(); this(int n){} } static assert( isAssignable!(S, S)); struct S2 { this(int n){} } static assert( isAssignable!(S2, S2)); static assert(!isAssignable!(S2, int)); struct S3 { @disable void opAssign(); } static assert( isAssignable!(S3, S3)); struct S3X { @disable void opAssign(S3X); } static assert(!isAssignable!(S3X, S3X)); struct S4 { void opAssign(int); } static assert( isAssignable!(S4, S4)); static assert( isAssignable!(S4, int)); static assert( isAssignable!(S4, immutable int)); struct S5 { @disable this(); @disable this(this); } struct S6 { void opAssign(in ref S5); } static assert(!isAssignable!(S6, S5)); static assert(!isRvalueAssignable!(S6, S5)); static assert( isLvalueAssignable!(S6, S5)); static assert( isLvalueAssignable!(S6, immutable S5)); } // Equivalent with TypeStruct::isAssignable in compiler code. package template isBlitAssignable(T) { static if (is(OriginalType!T U) && !is(T == U)) { enum isBlitAssignable = isBlitAssignable!U; } else static if (isStaticArray!T && is(T == E[n], E, size_t n)) // Workaround for issue 11499 : isStaticArray!T should not be necessary. { enum isBlitAssignable = isBlitAssignable!E; } else static if (is(T == struct) || is(T == union)) { enum isBlitAssignable = isMutable!T && { size_t offset = 0; bool assignable = true; foreach (i, F; FieldTypeTuple!T) { static if (i == 0) { } else if (T.tupleof[i].offsetof == offset) { if (assignable) continue; } else { if (!assignable) return false; } assignable = isBlitAssignable!(typeof(T.tupleof[i])); offset = T.tupleof[i].offsetof; } return assignable; }(); } else enum isBlitAssignable = isMutable!T; } unittest { static assert( isBlitAssignable!int); static assert(!isBlitAssignable!(const int)); class C{ const int i; } static assert( isBlitAssignable!C); struct S1{ int i; } struct S2{ const int i; } static assert( isBlitAssignable!S1); static assert(!isBlitAssignable!S2); struct S3X { union { int x; int y; } } struct S3Y { union { int x; const int y; } } struct S3Z { union { const int x; const int y; } } static assert( isBlitAssignable!(S3X)); static assert( isBlitAssignable!(S3Y)); static assert(!isBlitAssignable!(S3Z)); static assert(!isBlitAssignable!(const S3X)); static assert(!isBlitAssignable!(inout S3Y)); static assert(!isBlitAssignable!(immutable S3Z)); static assert( isBlitAssignable!(S3X[3])); static assert( isBlitAssignable!(S3Y[3])); static assert(!isBlitAssignable!(S3Z[3])); enum ES3X : S3X { a = S3X() } enum ES3Y : S3Y { a = S3Y() } enum ES3Z : S3Z { a = S3Z() } static assert( isBlitAssignable!(ES3X)); static assert( isBlitAssignable!(ES3Y)); static assert(!isBlitAssignable!(ES3Z)); static assert(!isBlitAssignable!(const ES3X)); static assert(!isBlitAssignable!(inout ES3Y)); static assert(!isBlitAssignable!(immutable ES3Z)); static assert( isBlitAssignable!(ES3X[3])); static assert( isBlitAssignable!(ES3Y[3])); static assert(!isBlitAssignable!(ES3Z[3])); union U1X { int x; int y; } union U1Y { int x; const int y; } union U1Z { const int x; const int y; } static assert( isBlitAssignable!(U1X)); static assert( isBlitAssignable!(U1Y)); static assert(!isBlitAssignable!(U1Z)); static assert(!isBlitAssignable!(const U1X)); static assert(!isBlitAssignable!(inout U1Y)); static assert(!isBlitAssignable!(immutable U1Z)); static assert( isBlitAssignable!(U1X[3])); static assert( isBlitAssignable!(U1Y[3])); static assert(!isBlitAssignable!(U1Z[3])); enum EU1X : U1X { a = U1X() } enum EU1Y : U1Y { a = U1Y() } enum EU1Z : U1Z { a = U1Z() } static assert( isBlitAssignable!(EU1X)); static assert( isBlitAssignable!(EU1Y)); static assert(!isBlitAssignable!(EU1Z)); static assert(!isBlitAssignable!(const EU1X)); static assert(!isBlitAssignable!(inout EU1Y)); static assert(!isBlitAssignable!(immutable EU1Z)); static assert( isBlitAssignable!(EU1X[3])); static assert( isBlitAssignable!(EU1Y[3])); static assert(!isBlitAssignable!(EU1Z[3])); struct SA { @property int[3] foo() { return [1,2,3]; } alias foo this; const int x; // SA is not blit assignable } static assert(!isStaticArray!SA); static assert(!isBlitAssignable!(SA[3])); } /* Works like $(D isImplicitlyConvertible), except this cares only about storage classes of the arguments. */ private template isStorageClassImplicitlyConvertible(From, To) { alias Pointify(T) = void*; enum isStorageClassImplicitlyConvertible = isImplicitlyConvertible!( ModifyTypePreservingTQ!(Pointify, From), ModifyTypePreservingTQ!(Pointify, To) ); } unittest { static assert( isStorageClassImplicitlyConvertible!( int, const int)); static assert( isStorageClassImplicitlyConvertible!(immutable int, const int)); static assert(!isStorageClassImplicitlyConvertible!(const int, int)); static assert(!isStorageClassImplicitlyConvertible!(const int, immutable int)); static assert(!isStorageClassImplicitlyConvertible!(int, shared int)); static assert(!isStorageClassImplicitlyConvertible!(shared int, int)); } /** Determines whether the function type $(D F) is covariant with $(D G), i.e., functions of the type $(D F) can override ones of the type $(D G). */ template isCovariantWith(F, G) if (is(F == function) && is(G == function)) { static if (is(F : G)) enum isCovariantWith = true; else { alias Upr = F; alias Lwr = G; /* * Check for calling convention: require exact match. */ template checkLinkage() { enum ok = functionLinkage!Upr == functionLinkage!Lwr; } /* * Check for variadic parameter: require exact match. */ template checkVariadicity() { enum ok = variadicFunctionStyle!Upr == variadicFunctionStyle!Lwr; } /* * Check for function storage class: * - overrider can have narrower storage class than base */ template checkSTC() { // Note the order of arguments. The convertion order Lwr -> Upr is // correct since Upr should be semantically 'narrower' than Lwr. enum ok = isStorageClassImplicitlyConvertible!(Lwr, Upr); } /* * Check for function attributes: * - require exact match for ref and @property * - overrider can add pure and nothrow, but can't remove them * - @safe and @trusted are covariant with each other, unremovable */ template checkAttributes() { alias FA = FunctionAttribute; enum uprAtts = functionAttributes!Upr; enum lwrAtts = functionAttributes!Lwr; // enum wantExact = FA.ref_ | FA.property; enum safety = FA.safe | FA.trusted; enum ok = ( (uprAtts & wantExact) == (lwrAtts & wantExact)) && ( (uprAtts & FA.pure_ ) >= (lwrAtts & FA.pure_ )) && ( (uprAtts & FA.nothrow_) >= (lwrAtts & FA.nothrow_)) && (!!(uprAtts & safety ) >= !!(lwrAtts & safety )) ; } /* * Check for return type: usual implicit convertion. */ template checkReturnType() { enum ok = is(ReturnType!Upr : ReturnType!Lwr); } /* * Check for parameters: * - require exact match for types (cf. bugzilla 3075) * - require exact match for in, out, ref and lazy * - overrider can add scope, but can't remove */ template checkParameters() { alias STC = ParameterStorageClass; alias UprParams = Parameters!Upr; alias LwrParams = Parameters!Lwr; alias UprPSTCs = ParameterStorageClassTuple!Upr; alias LwrPSTCs = ParameterStorageClassTuple!Lwr; // template checkNext(size_t i) { static if (i < UprParams.length) { enum uprStc = UprPSTCs[i]; enum lwrStc = LwrPSTCs[i]; // enum wantExact = STC.out_ | STC.ref_ | STC.lazy_ | STC.return_; enum ok = ((uprStc & wantExact ) == (lwrStc & wantExact )) && ((uprStc & STC.scope_) >= (lwrStc & STC.scope_)) && checkNext!(i + 1).ok; } else enum ok = true; // done } static if (UprParams.length == LwrParams.length) enum ok = is(UprParams == LwrParams) && checkNext!(0).ok; else enum ok = false; } /* run all the checks */ enum isCovariantWith = checkLinkage !().ok && checkVariadicity!().ok && checkSTC !().ok && checkAttributes !().ok && checkReturnType !().ok && checkParameters !().ok ; } } /// unittest { interface I { I clone(); } interface J { J clone(); } class C : I { override C clone() // covariant overriding of I.clone() { return new C; } } // C.clone() can override I.clone(), indeed. static assert(isCovariantWith!(typeof(C.clone), typeof(I.clone))); // C.clone() can't override J.clone(); the return type C is not implicitly // convertible to J. static assert(!isCovariantWith!(typeof(C.clone), typeof(J.clone))); } unittest { enum bool isCovariantWith(alias f, alias g) = .isCovariantWith!(typeof(f), typeof(g)); // covariant return type interface I {} interface J : I {} interface BaseA { const(I) test(int); } interface DerivA_1 : BaseA { override const(J) test(int); } interface DerivA_2 : BaseA { override J test(int); } static assert( isCovariantWith!(DerivA_1.test, BaseA.test)); static assert( isCovariantWith!(DerivA_2.test, BaseA.test)); static assert(!isCovariantWith!(BaseA.test, DerivA_1.test)); static assert(!isCovariantWith!(BaseA.test, DerivA_2.test)); static assert( isCovariantWith!(BaseA.test, BaseA.test)); static assert( isCovariantWith!(DerivA_1.test, DerivA_1.test)); static assert( isCovariantWith!(DerivA_2.test, DerivA_2.test)); // scope parameter interface BaseB { void test( int, int); } interface DerivB_1 : BaseB { override void test(scope int, int); } interface DerivB_2 : BaseB { override void test( int, scope int); } interface DerivB_3 : BaseB { override void test(scope int, scope int); } static assert( isCovariantWith!(DerivB_1.test, BaseB.test)); static assert( isCovariantWith!(DerivB_2.test, BaseB.test)); static assert( isCovariantWith!(DerivB_3.test, BaseB.test)); static assert(!isCovariantWith!(BaseB.test, DerivB_1.test)); static assert(!isCovariantWith!(BaseB.test, DerivB_2.test)); static assert(!isCovariantWith!(BaseB.test, DerivB_3.test)); // function storage class interface BaseC { void test() ; } interface DerivC_1 : BaseC { override void test() const; } static assert( isCovariantWith!(DerivC_1.test, BaseC.test)); static assert(!isCovariantWith!(BaseC.test, DerivC_1.test)); // increasing safety interface BaseE { void test() ; } interface DerivE_1 : BaseE { override void test() @safe ; } interface DerivE_2 : BaseE { override void test() @trusted; } static assert( isCovariantWith!(DerivE_1.test, BaseE.test)); static assert( isCovariantWith!(DerivE_2.test, BaseE.test)); static assert(!isCovariantWith!(BaseE.test, DerivE_1.test)); static assert(!isCovariantWith!(BaseE.test, DerivE_2.test)); // @safe and @trusted interface BaseF { void test1() @safe; void test2() @trusted; } interface DerivF : BaseF { override void test1() @trusted; override void test2() @safe; } static assert( isCovariantWith!(DerivF.test1, BaseF.test1)); static assert( isCovariantWith!(DerivF.test2, BaseF.test2)); } // Needed for rvalueOf/lvalueOf because "inout on return means // inout must be on a parameter as well" private struct __InoutWorkaroundStruct{} /** Creates an lvalue or rvalue of type $(D T) for $(D typeof(...)) and $(D __traits(compiles, ...)) purposes. No actual value is returned. Note: Trying to use returned value will result in a "Symbol Undefined" error at link time. Examples: --- // Note that `f` doesn't have to be implemented // as is isn't called. int f(int); bool f(ref int); static assert(is(typeof(f(rvalueOf!int)) == int)); static assert(is(typeof(f(lvalueOf!int)) == bool)); int i = rvalueOf!int; // error, no actual value is returned --- */ @property T rvalueOf(T)(inout __InoutWorkaroundStruct = __InoutWorkaroundStruct.init); /// ditto @property ref T lvalueOf(T)(inout __InoutWorkaroundStruct = __InoutWorkaroundStruct.init); // Note: unittest can't be used as an example here as function overloads // aren't allowed inside functions. unittest { void needLvalue(T)(ref T); static struct S { } int i; struct Nested { void f() { ++i; } } foreach(T; TypeTuple!(int, immutable int, inout int, string, S, Nested, Object)) { static assert(!__traits(compiles, needLvalue(rvalueOf!T))); static assert( __traits(compiles, needLvalue(lvalueOf!T))); static assert(is(typeof(rvalueOf!T) == T)); static assert(is(typeof(lvalueOf!T) == T)); } static assert(!__traits(compiles, rvalueOf!int = 1)); static assert( __traits(compiles, lvalueOf!byte = 127)); static assert(!__traits(compiles, lvalueOf!byte = 128)); } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// // SomethingTypeOf //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// private template AliasThisTypeOf(T) if (isAggregateType!T) { alias members = TypeTuple!(__traits(getAliasThis, T)); static if (members.length == 1) { alias AliasThisTypeOf = typeof(__traits(getMember, T.init, members[0])); } else static assert(0, T.stringof~" does not have alias this type"); } /* */ template BooleanTypeOf(T) { static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT)) alias X = BooleanTypeOf!AT; else alias X = OriginalType!T; static if (is(Unqual!X == bool)) { alias BooleanTypeOf = X; } else static assert(0, T.stringof~" is not boolean type"); } unittest { // unexpected failure, maybe dmd type-merging bug foreach (T; TypeTuple!bool) foreach (Q; TypeQualifierList) { static assert( is(Q!T == BooleanTypeOf!( Q!T ))); static assert( is(Q!T == BooleanTypeOf!( SubTypeOf!(Q!T) ))); } foreach (T; TypeTuple!(void, NumericTypeList, ImaginaryTypeList, ComplexTypeList, CharTypeList)) foreach (Q; TypeQualifierList) { static assert(!is(BooleanTypeOf!( Q!T )), Q!T.stringof); static assert(!is(BooleanTypeOf!( SubTypeOf!(Q!T) ))); } } unittest { struct B { bool val; alias val this; } struct S { B b; alias b this; } static assert(is(BooleanTypeOf!B == bool)); static assert(is(BooleanTypeOf!S == bool)); } /* */ template IntegralTypeOf(T) { static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT)) alias X = IntegralTypeOf!AT; else alias X = OriginalType!T; static if (staticIndexOf!(Unqual!X, IntegralTypeList) >= 0) { alias IntegralTypeOf = X; } else static assert(0, T.stringof~" is not an integral type"); } unittest { foreach (T; IntegralTypeList) foreach (Q; TypeQualifierList) { static assert( is(Q!T == IntegralTypeOf!( Q!T ))); static assert( is(Q!T == IntegralTypeOf!( SubTypeOf!(Q!T) ))); } foreach (T; TypeTuple!(void, bool, FloatingPointTypeList, ImaginaryTypeList, ComplexTypeList, CharTypeList)) foreach (Q; TypeQualifierList) { static assert(!is(IntegralTypeOf!( Q!T ))); static assert(!is(IntegralTypeOf!( SubTypeOf!(Q!T) ))); } } /* */ template FloatingPointTypeOf(T) { static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT)) alias X = FloatingPointTypeOf!AT; else alias X = OriginalType!T; static if (staticIndexOf!(Unqual!X, FloatingPointTypeList) >= 0) { alias FloatingPointTypeOf = X; } else static assert(0, T.stringof~" is not a floating point type"); } unittest { foreach (T; FloatingPointTypeList) foreach (Q; TypeQualifierList) { static assert( is(Q!T == FloatingPointTypeOf!( Q!T ))); static assert( is(Q!T == FloatingPointTypeOf!( SubTypeOf!(Q!T) ))); } foreach (T; TypeTuple!(void, bool, IntegralTypeList, ImaginaryTypeList, ComplexTypeList, CharTypeList)) foreach (Q; TypeQualifierList) { static assert(!is(FloatingPointTypeOf!( Q!T ))); static assert(!is(FloatingPointTypeOf!( SubTypeOf!(Q!T) ))); } } /* */ template NumericTypeOf(T) { static if (is(IntegralTypeOf!T X) || is(FloatingPointTypeOf!T X)) { alias NumericTypeOf = X; } else static assert(0, T.stringof~" is not a numeric type"); } unittest { foreach (T; NumericTypeList) foreach (Q; TypeQualifierList) { static assert( is(Q!T == NumericTypeOf!( Q!T ))); static assert( is(Q!T == NumericTypeOf!( SubTypeOf!(Q!T) ))); } foreach (T; TypeTuple!(void, bool, CharTypeList, ImaginaryTypeList, ComplexTypeList)) foreach (Q; TypeQualifierList) { static assert(!is(NumericTypeOf!( Q!T ))); static assert(!is(NumericTypeOf!( SubTypeOf!(Q!T) ))); } } /* */ template UnsignedTypeOf(T) { static if (is(IntegralTypeOf!T X) && staticIndexOf!(Unqual!X, UnsignedIntTypeList) >= 0) alias UnsignedTypeOf = X; else static assert(0, T.stringof~" is not an unsigned type."); } /* */ template SignedTypeOf(T) { static if (is(IntegralTypeOf!T X) && staticIndexOf!(Unqual!X, SignedIntTypeList) >= 0) alias SignedTypeOf = X; else static if (is(FloatingPointTypeOf!T X)) alias SignedTypeOf = X; else static assert(0, T.stringof~" is not an signed type."); } /* */ template CharTypeOf(T) { static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT)) alias X = CharTypeOf!AT; else alias X = OriginalType!T; static if (staticIndexOf!(Unqual!X, CharTypeList) >= 0) { alias CharTypeOf = X; } else static assert(0, T.stringof~" is not a character type"); } unittest { foreach (T; CharTypeList) foreach (Q; TypeQualifierList) { static assert( is(CharTypeOf!( Q!T ))); static assert( is(CharTypeOf!( SubTypeOf!(Q!T) ))); } foreach (T; TypeTuple!(void, bool, NumericTypeList, ImaginaryTypeList, ComplexTypeList)) foreach (Q; TypeQualifierList) { static assert(!is(CharTypeOf!( Q!T ))); static assert(!is(CharTypeOf!( SubTypeOf!(Q!T) ))); } foreach (T; TypeTuple!(string, wstring, dstring, char[4])) foreach (Q; TypeQualifierList) { static assert(!is(CharTypeOf!( Q!T ))); static assert(!is(CharTypeOf!( SubTypeOf!(Q!T) ))); } } /* */ template StaticArrayTypeOf(T) { static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT)) alias X = StaticArrayTypeOf!AT; else alias X = OriginalType!T; static if (is(X : E[n], E, size_t n)) alias StaticArrayTypeOf = X; else static assert(0, T.stringof~" is not a static array type"); } unittest { foreach (T; TypeTuple!(bool, NumericTypeList, ImaginaryTypeList, ComplexTypeList)) foreach (Q; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) { static assert(is( Q!( T[1] ) == StaticArrayTypeOf!( Q!( T[1] ) ) )); foreach (P; TypeQualifierList) { // SubTypeOf cannot have inout type static assert(is( Q!(P!(T[1])) == StaticArrayTypeOf!( Q!(SubTypeOf!(P!(T[1]))) ) )); } } foreach (T; TypeTuple!void) foreach (Q; TypeTuple!TypeQualifierList) { static assert(is( StaticArrayTypeOf!( Q!(void[1]) ) == Q!(void[1]) )); } } /* */ template DynamicArrayTypeOf(T) { static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT)) alias X = DynamicArrayTypeOf!AT; else alias X = OriginalType!T; static if (is(Unqual!X : E[], E) && !is(typeof({ enum n = X.length; }))) { alias DynamicArrayTypeOf = X; } else static assert(0, T.stringof~" is not a dynamic array"); } unittest { foreach (T; TypeTuple!(/*void, */bool, NumericTypeList, ImaginaryTypeList, ComplexTypeList)) foreach (Q; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) { static assert(is( Q!T[] == DynamicArrayTypeOf!( Q!T[] ) )); static assert(is( Q!(T[]) == DynamicArrayTypeOf!( Q!(T[]) ) )); foreach (P; TypeTuple!(MutableOf, ConstOf, ImmutableOf)) { static assert(is( Q!(P!T[]) == DynamicArrayTypeOf!( Q!(SubTypeOf!(P!T[])) ) )); static assert(is( Q!(P!(T[])) == DynamicArrayTypeOf!( Q!(SubTypeOf!(P!(T[]))) ) )); } } static assert(!is(DynamicArrayTypeOf!(int[3]))); static assert(!is(DynamicArrayTypeOf!(void[3]))); static assert(!is(DynamicArrayTypeOf!(typeof(null)))); } /* */ template ArrayTypeOf(T) { static if (is(StaticArrayTypeOf!T X) || is(DynamicArrayTypeOf!T X)) { alias ArrayTypeOf = X; } else static assert(0, T.stringof~" is not an array type"); } /* Always returns the Dynamic Array version. */ template StringTypeOf(T) { static if (is(T == typeof(null))) { // It is impossible to determine exact string type from typeof(null) - // it means that StringTypeOf!(typeof(null)) is undefined. // Then this behavior is convenient for template constraint. static assert(0, T.stringof~" is not a string type"); } else static if (is(T : const char[]) || is(T : const wchar[]) || is(T : const dchar[])) { static if (is(T : U[], U)) alias StringTypeOf = U[]; else static assert(0); } else static assert(0, T.stringof~" is not a string type"); } unittest { foreach (T; CharTypeList) foreach (Q; TypeTuple!(MutableOf, ConstOf, ImmutableOf, InoutOf)) { static assert(is(Q!T[] == StringTypeOf!( Q!T[] ))); static if (!__traits(isSame, Q, InoutOf)) { static assert(is(Q!T[] == StringTypeOf!( SubTypeOf!(Q!T[]) ))); alias Str = Q!T[]; class C(S) { S val; alias val this; } static assert(is(StringTypeOf!(C!Str) == Str)); } } foreach (T; CharTypeList) foreach (Q; TypeTuple!(SharedOf, SharedConstOf, SharedInoutOf)) { static assert(!is(StringTypeOf!( Q!T[] ))); } } unittest { static assert(is(StringTypeOf!(char[4]) == char[])); } /* */ template AssocArrayTypeOf(T) { static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT)) alias X = AssocArrayTypeOf!AT; else alias X = OriginalType!T; static if (is(Unqual!X : V[K], K, V)) { alias AssocArrayTypeOf = X; } else static assert(0, T.stringof~" is not an associative array type"); } unittest { foreach (T; TypeTuple!(int/*bool, CharTypeList, NumericTypeList, ImaginaryTypeList, ComplexTypeList*/)) foreach (P; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) foreach (Q; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) foreach (R; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) { static assert(is( P!(Q!T[R!T]) == AssocArrayTypeOf!( P!(Q!T[R!T]) ) )); } foreach (T; TypeTuple!(int/*bool, CharTypeList, NumericTypeList, ImaginaryTypeList, ComplexTypeList*/)) foreach (O; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) foreach (P; TypeTuple!TypeQualifierList) foreach (Q; TypeTuple!TypeQualifierList) foreach (R; TypeTuple!TypeQualifierList) { static assert(is( O!(P!(Q!T[R!T])) == AssocArrayTypeOf!( O!(SubTypeOf!(P!(Q!T[R!T]))) ) )); } } /* */ template BuiltinTypeOf(T) { static if (is(T : void)) alias BuiltinTypeOf = void; else static if (is(BooleanTypeOf!T X)) alias BuiltinTypeOf = X; else static if (is(IntegralTypeOf!T X)) alias BuiltinTypeOf = X; else static if (is(FloatingPointTypeOf!T X))alias BuiltinTypeOf = X; else static if (is(T : const(ireal))) alias BuiltinTypeOf = ireal; //TODO else static if (is(T : const(creal))) alias BuiltinTypeOf = creal; //TODO else static if (is(CharTypeOf!T X)) alias BuiltinTypeOf = X; else static if (is(ArrayTypeOf!T X)) alias BuiltinTypeOf = X; else static if (is(AssocArrayTypeOf!T X)) alias BuiltinTypeOf = X; else static assert(0); } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// // isSomething //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// /** * Detect whether $(D T) is a built-in boolean type. */ enum bool isBoolean(T) = is(BooleanTypeOf!T) && !isAggregateType!T; /// unittest { static assert( isBoolean!bool); enum EB : bool { a = true } static assert( isBoolean!EB); static assert(!isBoolean!(SubTypeOf!bool)); } /** * Detect whether $(D T) is a built-in integral type. Types $(D bool), * $(D char), $(D wchar), and $(D dchar) are not considered integral. */ enum bool isIntegral(T) = is(IntegralTypeOf!T) && !isAggregateType!T; unittest { foreach (T; IntegralTypeList) { foreach (Q; TypeQualifierList) { static assert( isIntegral!(Q!T)); static assert(!isIntegral!(SubTypeOf!(Q!T))); } } static assert(!isIntegral!float); enum EU : uint { a = 0, b = 1, c = 2 } // base type is unsigned enum EI : int { a = -1, b = 0, c = 1 } // base type is signed (bug 7909) static assert(isIntegral!EU && isUnsigned!EU && !isSigned!EU); static assert(isIntegral!EI && !isUnsigned!EI && isSigned!EI); } /** * Detect whether $(D T) is a built-in floating point type. */ enum bool isFloatingPoint(T) = is(FloatingPointTypeOf!T) && !isAggregateType!T; unittest { enum EF : real { a = 1.414, b = 1.732, c = 2.236 } foreach (T; TypeTuple!(FloatingPointTypeList, EF)) { foreach (Q; TypeQualifierList) { static assert( isFloatingPoint!(Q!T)); static assert(!isFloatingPoint!(SubTypeOf!(Q!T))); } } foreach (T; IntegralTypeList) { foreach (Q; TypeQualifierList) { static assert(!isFloatingPoint!(Q!T)); } } } /** Detect whether $(D T) is a built-in numeric type (integral or floating point). */ enum bool isNumeric(T) = is(NumericTypeOf!T) && !isAggregateType!T; unittest { foreach (T; TypeTuple!(NumericTypeList)) { foreach (Q; TypeQualifierList) { static assert( isNumeric!(Q!T)); static assert(!isNumeric!(SubTypeOf!(Q!T))); } } } /** Detect whether $(D T) is a scalar type (a built-in numeric, character or boolean type). */ enum bool isScalarType(T) = isNumeric!T || isSomeChar!T || isBoolean!T; /// unittest { static assert(!isScalarType!void); static assert( isScalarType!(immutable(int))); static assert( isScalarType!(shared(float))); static assert( isScalarType!(shared(const bool))); static assert( isScalarType!(const(dchar))); } /** Detect whether $(D T) is a basic type (scalar type or void). */ enum bool isBasicType(T) = isScalarType!T || is(T == void); /// unittest { static assert(isBasicType!void); static assert(isBasicType!(immutable(int))); static assert(isBasicType!(shared(float))); static assert(isBasicType!(shared(const bool))); static assert(isBasicType!(const(dchar))); } /** Detect whether $(D T) is a built-in unsigned numeric type. */ enum bool isUnsigned(T) = is(UnsignedTypeOf!T) && !isAggregateType!T; unittest { foreach (T; TypeTuple!(UnsignedIntTypeList)) { foreach (Q; TypeQualifierList) { static assert( isUnsigned!(Q!T)); static assert(!isUnsigned!(SubTypeOf!(Q!T))); } } } /** Detect whether $(D T) is a built-in signed numeric type. */ enum bool isSigned(T) = is(SignedTypeOf!T) && !isAggregateType!T; unittest { foreach (T; TypeTuple!(SignedIntTypeList)) { foreach (Q; TypeQualifierList) { static assert( isSigned!(Q!T)); static assert(!isSigned!(SubTypeOf!(Q!T))); } } } /** Detect whether $(D T) is one of the built-in character types. */ enum bool isSomeChar(T) = is(CharTypeOf!T) && !isAggregateType!T; /// unittest { static assert(!isSomeChar!int); static assert(!isSomeChar!byte); static assert(!isSomeChar!string); static assert(!isSomeChar!wstring); static assert(!isSomeChar!dstring); static assert(!isSomeChar!(char[4])); } unittest { enum EC : char { a = 'x', b = 'y' } foreach (T; TypeTuple!(CharTypeList, EC)) { foreach (Q; TypeQualifierList) { static assert( isSomeChar!( Q!T )); static assert(!isSomeChar!( SubTypeOf!(Q!T) )); } } } /** Detect whether $(D T) is one of the built-in string types. The built-in string types are $(D Char[]), where $(D Char) is any of $(D char), $(D wchar) or $(D dchar), with or without qualifiers. Static arrays of characters (like $(D char[80])) are not considered built-in string types. */ enum bool isSomeString(T) = is(StringTypeOf!T) && !isAggregateType!T && !isStaticArray!T; /// unittest { static assert(!isSomeString!int); static assert(!isSomeString!(int[])); static assert(!isSomeString!(byte[])); static assert(!isSomeString!(typeof(null))); static assert(!isSomeString!(char[4])); enum ES : string { a = "aaa", b = "bbb" } static assert( isSomeString!ES); } unittest { foreach (T; TypeTuple!(char[], dchar[], string, wstring, dstring)) { static assert( isSomeString!( T )); static assert(!isSomeString!(SubTypeOf!(T))); } } /** * Detect whether type $(D T) is a narrow string. * * All arrays that use char, wchar, and their qualified versions are narrow * strings. (Those include string and wstring). */ enum bool isNarrowString(T) = (is(T : const char[]) || is(T : const wchar[])) && !isAggregateType!T && !isStaticArray!T; unittest { foreach (T; TypeTuple!(char[], string, wstring)) { foreach (Q; TypeTuple!(MutableOf, ConstOf, ImmutableOf)/*TypeQualifierList*/) { static assert( isNarrowString!( Q!T )); static assert(!isNarrowString!( SubTypeOf!(Q!T) )); } } foreach (T; TypeTuple!(int, int[], byte[], dchar[], dstring, char[4])) { foreach (Q; TypeQualifierList) { static assert(!isNarrowString!( Q!T )); static assert(!isNarrowString!( SubTypeOf!(Q!T) )); } } } /** * Detect whether type $(D T) is a string that will be autodecoded. * * All arrays that use char, wchar, and their qualified versions are narrow * strings. (Those include string and wstring). * Aggregates that implicitly cast to narrow strings are included. * * Params: * T = type to be tested * * Returns: * true if T represents a string that is subject to autodecoding * * See Also: * $(LREF isNarrowString) */ enum bool isAutodecodableString(T) = (is(T : const char[]) || is(T : const wchar[])) && !isStaticArray!T; /// unittest { static struct Stringish { string s; alias s this; } assert(isAutodecodableString!wstring); assert(isAutodecodableString!Stringish); assert(!isAutodecodableString!dstring); } /** * Detect whether type $(D T) is a static array. */ enum bool isStaticArray(T) = is(StaticArrayTypeOf!T) && !isAggregateType!T; /// unittest { static assert(!isStaticArray!(const(int)[])); static assert(!isStaticArray!(immutable(int)[])); static assert(!isStaticArray!(const(int)[4][])); static assert(!isStaticArray!(int[])); static assert(!isStaticArray!(int[char])); static assert(!isStaticArray!(int[1][])); static assert(!isStaticArray!(int[int])); static assert(!isStaticArray!int); } unittest { foreach (T; TypeTuple!(int[51], int[][2], char[][int][11], immutable char[13u], const(real)[1], const(real)[1][1], void[0])) { foreach (Q; TypeQualifierList) { static assert( isStaticArray!( Q!T )); static assert(!isStaticArray!( SubTypeOf!(Q!T) )); } } //enum ESA : int[1] { a = [1], b = [2] } //static assert( isStaticArray!ESA); } /** * Detect whether type $(D T) is a dynamic array. */ enum bool isDynamicArray(T) = is(DynamicArrayTypeOf!T) && !isAggregateType!T; unittest { foreach (T; TypeTuple!(int[], char[], string, long[3][], double[string][])) { foreach (Q; TypeQualifierList) { static assert( isDynamicArray!( Q!T )); static assert(!isDynamicArray!( SubTypeOf!(Q!T) )); } } static assert(!isDynamicArray!(int[5])); static assert(!isDynamicArray!(typeof(null))); //enum EDA : int[] { a = [1], b = [2] } //static assert( isDynamicArray!EDA); } /** * Detect whether type $(D T) is an array (static or dynamic; for associative * arrays see $(LREF isAssociativeArray)). */ enum bool isArray(T) = isStaticArray!T || isDynamicArray!T; unittest { foreach (T; TypeTuple!(int[], int[5], void[])) { foreach (Q; TypeQualifierList) { static assert( isArray!(Q!T)); static assert(!isArray!(SubTypeOf!(Q!T))); } } static assert(!isArray!uint); static assert(!isArray!(uint[uint])); static assert(!isArray!(typeof(null))); } /** * Detect whether $(D T) is an associative array type */ enum bool isAssociativeArray(T) = is(AssocArrayTypeOf!T) && !isAggregateType!T; unittest { struct Foo { @property uint[] keys() { return null; } @property uint[] values() { return null; } } foreach (T; TypeTuple!(int[int], int[string], immutable(char[5])[int])) { foreach (Q; TypeQualifierList) { static assert( isAssociativeArray!(Q!T)); static assert(!isAssociativeArray!(SubTypeOf!(Q!T))); } } static assert(!isAssociativeArray!Foo); static assert(!isAssociativeArray!int); static assert(!isAssociativeArray!(int[])); static assert(!isAssociativeArray!(typeof(null))); //enum EAA : int[int] { a = [1:1], b = [2:2] } //static assert( isAssociativeArray!EAA); } /** * Detect whether type $(D T) is a builtin type. */ enum bool isBuiltinType(T) = is(BuiltinTypeOf!T) && !isAggregateType!T; /// unittest { class C; union U; struct S; interface I; static assert( isBuiltinType!void); static assert( isBuiltinType!string); static assert( isBuiltinType!(int[])); static assert( isBuiltinType!(C[string])); static assert(!isBuiltinType!C); static assert(!isBuiltinType!U); static assert(!isBuiltinType!S); static assert(!isBuiltinType!I); static assert(!isBuiltinType!(void delegate(int))); } /** * Detect whether type $(D T) is a SIMD vector type. */ enum bool isSIMDVector(T) = is(T : __vector(V[N]), V, size_t N); unittest { static if (is(__vector(float[4]))) { alias SimdVec = __vector(float[4]); static assert(isSIMDVector!(__vector(float[4]))); static assert(isSIMDVector!SimdVec); } static assert(!isSIMDVector!uint); static assert(!isSIMDVector!(float[4])); } /** * Detect whether type $(D T) is a pointer. */ enum bool isPointer(T) = is(T == U*, U) && !isAggregateType!T; unittest { foreach (T; TypeTuple!(int*, void*, char[]*)) { foreach (Q; TypeQualifierList) { static assert( isPointer!(Q!T)); static assert(!isPointer!(SubTypeOf!(Q!T))); } } static assert(!isPointer!uint); static assert(!isPointer!(uint[uint])); static assert(!isPointer!(char[])); static assert(!isPointer!(typeof(null))); } /** Returns the target type of a pointer. */ alias PointerTarget(T : T*) = T; /** $(RED Deprecated. Please use $(LREF PointerTarget) instead. This will be removed in June 2015.) */ deprecated("Please use PointerTarget instead.") alias pointerTarget = PointerTarget; unittest { static assert( is(PointerTarget!(int*) == int)); static assert( is(PointerTarget!(long*) == long)); static assert(!is(PointerTarget!int)); } /** * Detect whether type $(D T) is an aggregate type. */ enum bool isAggregateType(T) = is(T == struct) || is(T == union) || is(T == class) || is(T == interface); /// unittest { class C; union U; struct S; interface I; static assert( isAggregateType!C); static assert( isAggregateType!U); static assert( isAggregateType!S); static assert( isAggregateType!I); static assert(!isAggregateType!void); static assert(!isAggregateType!string); static assert(!isAggregateType!(int[])); static assert(!isAggregateType!(C[string])); static assert(!isAggregateType!(void delegate(int))); } /** * Returns $(D true) if T can be iterated over using a $(D foreach) loop with * a single loop variable of automatically inferred type, regardless of how * the $(D foreach) loop is implemented. This includes ranges, structs/classes * that define $(D opApply) with a single loop variable, and builtin dynamic, * static and associative arrays. */ enum bool isIterable(T) = is(typeof({ foreach(elem; T.init) {} })); /// unittest { struct OpApply { int opApply(int delegate(ref uint) dg) { assert(0); } } struct Range { @property uint front() { assert(0); } void popFront() { assert(0); } enum bool empty = false; } static assert( isIterable!(uint[])); static assert( isIterable!OpApply); static assert( isIterable!(uint[string])); static assert( isIterable!Range); static assert(!isIterable!uint); } /** * Returns true if T is not const or immutable. Note that isMutable is true for * string, or immutable(char)[], because the 'head' is mutable. */ enum bool isMutable(T) = !is(T == const) && !is(T == immutable) && !is(T == inout); /// unittest { static assert( isMutable!int); static assert( isMutable!string); static assert( isMutable!(shared int)); static assert( isMutable!(shared const(int)[])); static assert(!isMutable!(const int)); static assert(!isMutable!(inout int)); static assert(!isMutable!(shared(const int))); static assert(!isMutable!(shared(inout int))); static assert(!isMutable!(immutable string)); } /** * Returns true if T is an instance of the template S. */ enum bool isInstanceOf(alias S, T) = is(T == S!Args, Args...); /// unittest { static struct Foo(T...) { } static struct Bar(T...) { } static struct Doo(T) { } static struct ABC(int x) { } static assert(isInstanceOf!(Foo, Foo!int)); static assert(!isInstanceOf!(Foo, Bar!int)); static assert(!isInstanceOf!(Foo, int)); static assert(isInstanceOf!(Doo, Doo!int)); static assert(isInstanceOf!(ABC, ABC!1)); static assert(!__traits(compiles, isInstanceOf!(Foo, Foo))); } /** * Check whether the tuple T is an expression tuple. * An expression tuple only contains expressions. * * See_Also: $(LREF isTypeTuple). */ template isExpressions(T ...) { static if (T.length >= 2) enum bool isExpressions = isExpressions!(T[0 .. $/2]) && isExpressions!(T[$/2 .. $]); else static if (T.length == 1) enum bool isExpressions = !is(T[0]) && __traits(compiles, { auto ex = T[0]; }); else enum bool isExpressions = true; // default } /// unittest { static assert(isExpressions!(1, 2.0, "a")); static assert(!isExpressions!(int, double, string)); static assert(!isExpressions!(int, 2.0, "a")); } /** * Alternate name for $(LREF isExpressions), kept for legacy compatibility. */ alias isExpressionTuple = isExpressions; unittest { void foo(); static int bar() { return 42; } enum aa = [ 1: -1 ]; alias myint = int; static assert( isExpressionTuple!(42)); static assert( isExpressionTuple!aa); static assert( isExpressionTuple!("cattywampus", 2.7, aa)); static assert( isExpressionTuple!(bar())); static assert(!isExpressionTuple!isExpressionTuple); static assert(!isExpressionTuple!foo); static assert(!isExpressionTuple!( (a) { } )); static assert(!isExpressionTuple!int); static assert(!isExpressionTuple!myint); } /** * Check whether the tuple $(D T) is a type tuple. * A type tuple only contains types. * * See_Also: $(LREF isExpressions). */ template isTypeTuple(T...) { static if (T.length >= 2) enum bool isTypeTuple = isTypeTuple!(T[0 .. $/2]) && isTypeTuple!(T[$/2 .. $]); else static if (T.length == 1) enum bool isTypeTuple = is(T[0]); else enum bool isTypeTuple = true; // default } /// unittest { static assert(isTypeTuple!(int, float, string)); static assert(!isTypeTuple!(1, 2.0, "a")); static assert(!isTypeTuple!(1, double, string)); } unittest { class C {} void func(int) {} auto c = new C; enum CONST = 42; static assert( isTypeTuple!int); static assert( isTypeTuple!string); static assert( isTypeTuple!C); static assert( isTypeTuple!(typeof(func))); static assert( isTypeTuple!(int, char, double)); static assert(!isTypeTuple!c); static assert(!isTypeTuple!isTypeTuple); static assert(!isTypeTuple!CONST); } /** Detect whether symbol or type $(D T) is a function pointer. */ template isFunctionPointer(T...) if (T.length == 1) { static if (is(T[0] U) || is(typeof(T[0]) U)) { static if (is(U F : F*) && is(F == function)) enum bool isFunctionPointer = true; else enum bool isFunctionPointer = false; } else enum bool isFunctionPointer = false; } /// unittest { static void foo() {} void bar() {} auto fpfoo = &foo; static assert( isFunctionPointer!fpfoo); static assert( isFunctionPointer!(void function())); auto dgbar = &bar; static assert(!isFunctionPointer!dgbar); static assert(!isFunctionPointer!(void delegate())); static assert(!isFunctionPointer!foo); static assert(!isFunctionPointer!bar); static assert( isFunctionPointer!((int a) {})); } /** Detect whether symbol or type $(D T) is a delegate. */ template isDelegate(T...) if (T.length == 1) { static if (is(typeof(& T[0]) U : U*) && is(typeof(& T[0]) U == delegate)) { // T is a (nested) function symbol. enum bool isDelegate = true; } else static if (is(T[0] W) || is(typeof(T[0]) W)) { // T is an expression or a type. Take the type of it and examine. enum bool isDelegate = is(W == delegate); } else enum bool isDelegate = false; } /// unittest { static void sfunc() { } int x; void func() { x++; } int delegate() dg; assert(isDelegate!dg); assert(isDelegate!(int delegate())); assert(isDelegate!(typeof(&func))); int function() fp; assert(!isDelegate!fp); assert(!isDelegate!(int function())); assert(!isDelegate!(typeof(&sfunc))); } /** Detect whether symbol or type $(D T) is a function, a function pointer or a delegate. */ template isSomeFunction(T...) if (T.length == 1) { static if (is(typeof(& T[0]) U : U*) && is(U == function) || is(typeof(& T[0]) U == delegate)) { // T is a (nested) function symbol. enum bool isSomeFunction = true; } else static if (is(T[0] W) || is(typeof(T[0]) W)) { // T is an expression or a type. Take the type of it and examine. static if (is(W F : F*) && is(F == function)) enum bool isSomeFunction = true; // function pointer else enum bool isSomeFunction = is(W == function) || is(W == delegate); } else enum bool isSomeFunction = false; } unittest { static real func(ref int) { return 0; } static void prop() @property { } void nestedFunc() { } void nestedProp() @property { } class C { real method(ref int) { return 0; } real prop() @property { return 0; } } auto c = new C; auto fp = &func; auto dg = &c.method; real val; static assert( isSomeFunction!func); static assert( isSomeFunction!prop); static assert( isSomeFunction!nestedFunc); static assert( isSomeFunction!nestedProp); static assert( isSomeFunction!(C.method)); static assert( isSomeFunction!(C.prop)); static assert( isSomeFunction!(c.prop)); static assert( isSomeFunction!(c.prop)); static assert( isSomeFunction!fp); static assert( isSomeFunction!dg); static assert( isSomeFunction!(typeof(func))); static assert( isSomeFunction!(real function(ref int))); static assert( isSomeFunction!(real delegate(ref int))); static assert( isSomeFunction!((int a) { return a; })); static assert(!isSomeFunction!int); static assert(!isSomeFunction!val); static assert(!isSomeFunction!isSomeFunction); } /** Detect whether $(D T) is a callable object, which can be called with the function call operator $(D $(LPAREN)...$(RPAREN)). */ template isCallable(T...) if (T.length == 1) { static if (is(typeof(& T[0].opCall) == delegate)) // T is a object which has a member function opCall(). enum bool isCallable = true; else static if (is(typeof(& T[0].opCall) V : V*) && is(V == function)) // T is a type which has a static member function opCall(). enum bool isCallable = true; else enum bool isCallable = isSomeFunction!T; } /// unittest { interface I { real value() @property; } struct S { static int opCall(int) { return 0; } } class C { int opCall(int) { return 0; } } auto c = new C; static assert( isCallable!c); static assert( isCallable!S); static assert( isCallable!(c.opCall)); static assert( isCallable!(I.value)); static assert( isCallable!((int a) { return a; })); static assert(!isCallable!I); } /** * Detect whether $(D T) is a an abstract function. */ template isAbstractFunction(T...) if (T.length == 1) { enum bool isAbstractFunction = __traits(isAbstractFunction, T[0]); } unittest { struct S { void foo() { } } class C { void foo() { } } class AC { abstract void foo(); } static assert(!isAbstractFunction!(S.foo)); static assert(!isAbstractFunction!(C.foo)); static assert( isAbstractFunction!(AC.foo)); } /** * Detect whether $(D T) is a a final function. */ template isFinalFunction(T...) if (T.length == 1) { enum bool isFinalFunction = __traits(isFinalFunction, T[0]); } /// unittest { struct S { void bar() { } } final class FC { void foo(); } class C { void bar() { } final void foo(); } static assert(!isFinalFunction!(S.bar)); static assert( isFinalFunction!(FC.foo)); static assert(!isFinalFunction!(C.bar)); static assert( isFinalFunction!(C.foo)); } /** Determines whether function $(D f) requires a context pointer. */ template isNestedFunction(alias f) { enum isNestedFunction = __traits(isNested, f); } unittest { static void f() { } void g() { } static assert(!isNestedFunction!f); static assert( isNestedFunction!g); } /** * Detect whether $(D T) is a an abstract class. */ template isAbstractClass(T...) if (T.length == 1) { enum bool isAbstractClass = __traits(isAbstractClass, T[0]); } /// unittest { struct S { } class C { } abstract class AC { } static assert(!isAbstractClass!S); static assert(!isAbstractClass!C); static assert( isAbstractClass!AC); } /** * Detect whether $(D T) is a a final class. */ template isFinalClass(T...) if (T.length == 1) { enum bool isFinalClass = __traits(isFinalClass, T[0]); } /// unittest { class C { } abstract class AC { } final class FC1 : C { } final class FC2 { } static assert(!isFinalClass!C); static assert(!isFinalClass!AC); static assert( isFinalClass!FC1); static assert( isFinalClass!FC2); } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// // General Types //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// /** Removes all qualifiers, if any, from type $(D T). */ template Unqual(T) { version (none) // Error: recursive alias declaration @@@BUG1308@@@ { static if (is(T U == const U)) alias Unqual = Unqual!U; else static if (is(T U == immutable U)) alias Unqual = Unqual!U; else static if (is(T U == inout U)) alias Unqual = Unqual!U; else static if (is(T U == shared U)) alias Unqual = Unqual!U; else alias Unqual = T; } else // workaround { static if (is(T U == immutable U)) alias Unqual = U; else static if (is(T U == shared inout const U)) alias Unqual = U; else static if (is(T U == shared inout U)) alias Unqual = U; else static if (is(T U == shared const U)) alias Unqual = U; else static if (is(T U == shared U)) alias Unqual = U; else static if (is(T U == inout const U)) alias Unqual = U; else static if (is(T U == inout U)) alias Unqual = U; else static if (is(T U == const U)) alias Unqual = U; else alias Unqual = T; } } /// unittest { static assert(is(Unqual!int == int)); static assert(is(Unqual!(const int) == int)); static assert(is(Unqual!(immutable int) == int)); static assert(is(Unqual!(shared int) == int)); static assert(is(Unqual!(shared(const int)) == int)); } unittest { static assert(is(Unqual!( int) == int)); static assert(is(Unqual!( const int) == int)); static assert(is(Unqual!( inout int) == int)); static assert(is(Unqual!( inout const int) == int)); static assert(is(Unqual!(shared int) == int)); static assert(is(Unqual!(shared const int) == int)); static assert(is(Unqual!(shared inout int) == int)); static assert(is(Unqual!(shared inout const int) == int)); static assert(is(Unqual!( immutable int) == int)); alias ImmIntArr = immutable(int[]); static assert(is(Unqual!ImmIntArr == immutable(int)[])); } // [For internal use] package template ModifyTypePreservingTQ(alias Modifier, T) { static if (is(T U == immutable U)) alias ModifyTypePreservingTQ = immutable Modifier!U; else static if (is(T U == shared inout const U)) alias ModifyTypePreservingTQ = shared inout const Modifier!U; else static if (is(T U == shared inout U)) alias ModifyTypePreservingTQ = shared inout Modifier!U; else static if (is(T U == shared const U)) alias ModifyTypePreservingTQ = shared const Modifier!U; else static if (is(T U == shared U)) alias ModifyTypePreservingTQ = shared Modifier!U; else static if (is(T U == inout const U)) alias ModifyTypePreservingTQ = inout const Modifier!U; else static if (is(T U == inout U)) alias ModifyTypePreservingTQ = inout Modifier!U; else static if (is(T U == const U)) alias ModifyTypePreservingTQ = const Modifier!U; else alias ModifyTypePreservingTQ = Modifier!T; } unittest { alias Intify(T) = int; static assert(is(ModifyTypePreservingTQ!(Intify, real) == int)); static assert(is(ModifyTypePreservingTQ!(Intify, const real) == const int)); static assert(is(ModifyTypePreservingTQ!(Intify, inout real) == inout int)); static assert(is(ModifyTypePreservingTQ!(Intify, inout const real) == inout const int)); static assert(is(ModifyTypePreservingTQ!(Intify, shared real) == shared int)); static assert(is(ModifyTypePreservingTQ!(Intify, shared const real) == shared const int)); static assert(is(ModifyTypePreservingTQ!(Intify, shared inout real) == shared inout int)); static assert(is(ModifyTypePreservingTQ!(Intify, shared inout const real) == shared inout const int)); static assert(is(ModifyTypePreservingTQ!(Intify, immutable real) == immutable int)); } /** * Copies type qualifiers from $(D FromType) to $(D ToType). * * Supported type qualifiers: * $(UL * $(LI $(D const)) * $(LI $(D inout)) * $(LI $(D immutable)) * $(LI $(D shared)) * ) * Examples: * --- * static assert(is(CopyTypeQualifiers!(inout const real, int) == inout const int)); * --- */ template CopyTypeQualifiers(FromType, ToType) { alias T(U) = ToType; alias CopyTypeQualifiers = ModifyTypePreservingTQ!(T, FromType); } unittest { static assert(is(CopyTypeQualifiers!( real, int) == int)); static assert(is(CopyTypeQualifiers!( const real, int) == const int)); static assert(is(CopyTypeQualifiers!( inout real, int) == inout int)); static assert(is(CopyTypeQualifiers!( inout const real, int) == inout const int)); static assert(is(CopyTypeQualifiers!(shared real, int) == shared int)); static assert(is(CopyTypeQualifiers!(shared const real, int) == shared const int)); static assert(is(CopyTypeQualifiers!(shared inout real, int) == shared inout int)); static assert(is(CopyTypeQualifiers!(shared inout const real, int) == shared inout const int)); static assert(is(CopyTypeQualifiers!( immutable real, int) == immutable int)); } /** Returns the type of `Target` with the "constness" of `Source`. A type's $(BOLD constness) refers to whether it is `const`, `immutable`, or `inout`. If `source` has no constness, the returned type will be the same as `Target`. */ template CopyConstness(FromType, ToType) { alias Unshared(T) = T; alias Unshared(T: shared U, U) = U; alias CopyConstness = Unshared!(CopyTypeQualifiers!(FromType, ToType)); } /// unittest { const(int) i; CopyConstness!(typeof(i), float) f; assert( is(typeof(f) == const float)); CopyConstness!(char, uint) u; assert( is(typeof(u) == uint)); //The 'shared' qualifier will not be copied assert(!is(CopyConstness!(shared bool, int) == shared int)); //But the constness will be assert( is(CopyConstness!(shared const real, double) == const double)); //Careful, const(int)[] is a mutable array of const(int) alias MutT = CopyConstness!(const(int)[], int); assert(!is(MutT == const(int))); //Okay, const(int[]) applies to array and contained ints alias CstT = CopyConstness!(const(int[]), int); assert( is(CstT == const(int))); } unittest { struct Test { void method1() {} void method2() const {} void method3() immutable {} } assert(is(CopyConstness!(typeof(Test.method1), real) == real)); assert(is(CopyConstness!(typeof(Test.method2), byte) == const(byte))); assert(is(CopyConstness!(typeof(Test.method3), string) == immutable(string))); } unittest { assert(is(CopyConstness!(inout(int)[], int[]) == int[])); assert(is(CopyConstness!(inout(int[]), int[]) == inout(int[]))); } unittest { static assert(is(CopyConstness!( int, real) == real)); static assert(is(CopyConstness!(const int, real) == const real)); static assert(is(CopyConstness!(inout int, real) == inout real)); static assert(is(CopyConstness!(inout const int, real) == inout const real)); static assert(is(CopyConstness!(shared int, real) == real)); static assert(is(CopyConstness!(shared const int, real) == const real)); static assert(is(CopyConstness!(shared inout int, real) == inout real)); static assert(is(CopyConstness!(shared inout const int, real) == inout const real)); static assert(is(CopyConstness!(immutable int, real) == immutable real)); } /** Returns the inferred type of the loop variable when a variable of type T is iterated over using a $(D foreach) loop with a single loop variable and automatically inferred return type. Note that this may not be the same as $(D std.range.ElementType!Range) in the case of narrow strings, or if T has both opApply and a range interface. */ template ForeachType(T) { alias ForeachType = ReturnType!(typeof( (inout int x = 0) { foreach(elem; T.init) { return elem; } assert(0); })); } /// unittest { static assert(is(ForeachType!(uint[]) == uint)); static assert(is(ForeachType!string == immutable(char))); static assert(is(ForeachType!(string[string]) == string)); static assert(is(ForeachType!(inout(int)[]) == inout(int))); } /** * Strips off all $(D enum)s from type $(D T). */ template OriginalType(T) { template Impl(T) { static if (is(T U == enum)) alias Impl = OriginalType!U; else alias Impl = T; } alias OriginalType = ModifyTypePreservingTQ!(Impl, T); } /// unittest { enum E : real { a } enum F : E { a = E.a } alias G = const(F); static assert(is(OriginalType!E == real)); static assert(is(OriginalType!F == real)); static assert(is(OriginalType!G == const real)); } /** * Get the Key type of an Associative Array. */ alias KeyType(V : V[K], K) = K; /// unittest { import std.traits; alias Hash = int[string]; static assert(is(KeyType!Hash == string)); static assert(is(ValueType!Hash == int)); KeyType!Hash str = "a"; // str is declared as string ValueType!Hash num = 1; // num is declared as int } /** * Get the Value type of an Associative Array. */ alias ValueType(V : V[K], K) = V; /// unittest { import std.traits; alias Hash = int[string]; static assert(is(KeyType!Hash == string)); static assert(is(ValueType!Hash == int)); KeyType!Hash str = "a"; // str is declared as string ValueType!Hash num = 1; // num is declared as int } /** * Returns the corresponding unsigned type for T. T must be a numeric * integral type, otherwise a compile-time error occurs. */ template Unsigned(T) { template Impl(T) { static if (is(T : __vector(V[N]), V, size_t N)) alias Impl = __vector(Impl!V[N]); else static if (isUnsigned!T) alias Impl = T; else static if (isSigned!T && !isFloatingPoint!T) { static if (is(T == byte )) alias Impl = ubyte; static if (is(T == short)) alias Impl = ushort; static if (is(T == int )) alias Impl = uint; static if (is(T == long )) alias Impl = ulong; static if (is(ucent) && is(T == cent )) alias Impl = ucent; } else static assert(false, "Type " ~ T.stringof ~ " does not have an Unsigned counterpart"); } alias Unsigned = ModifyTypePreservingTQ!(Impl, OriginalType!T); } unittest { alias U1 = Unsigned!int; alias U2 = Unsigned!(const(int)); alias U3 = Unsigned!(immutable(int)); static assert(is(U1 == uint)); static assert(is(U2 == const(uint))); static assert(is(U3 == immutable(uint))); static if (is(__vector(int[4])) && is(__vector(uint[4]))) { alias UV1 = Unsigned!(__vector(int[4])); alias UV2 = Unsigned!(const(__vector(int[4]))); static assert(is(UV1 == __vector(uint[4]))); static assert(is(UV2 == const(__vector(uint[4])))); } //struct S {} //alias U2 = Unsigned!S; //alias U3 = Unsigned!double; static if (is(ucent)) { alias U4 = Unsigned!cent; alias U5 = Unsigned!(const(cent)); alias U6 = Unsigned!(immutable(cent)); static assert(is(U4 == ucent)); static assert(is(U5 == const(ucent))); static assert(is(U6 == immutable(ucent))); } } /** Returns the largest type, i.e. T such that T.sizeof is the largest. If more than one type is of the same size, the leftmost argument of these in will be returned. */ template Largest(T...) if(T.length >= 1) { static if (T.length == 1) { alias Largest = T[0]; } else static if (T.length == 2) { static if(T[0].sizeof >= T[1].sizeof) { alias Largest = T[0]; } else { alias Largest = T[1]; } } else { alias Largest = Largest!(Largest!(T[0 .. $/2]), Largest!(T[$/2 .. $])); } } /// unittest { static assert(is(Largest!(uint, ubyte, ushort, real) == real)); static assert(is(Largest!(ulong, double) == ulong)); static assert(is(Largest!(double, ulong) == double)); static assert(is(Largest!(uint, byte, double, short) == double)); static if (is(ucent)) static assert(is(Largest!(uint, ubyte, ucent, ushort) == ucent)); } /** Returns the corresponding signed type for T. T must be a numeric integral type, otherwise a compile-time error occurs. */ template Signed(T) { template Impl(T) { static if (is(T : __vector(V[N]), V, size_t N)) alias Impl = __vector(Impl!V[N]); else static if (isSigned!T) alias Impl = T; else static if (isUnsigned!T) { static if (is(T == ubyte )) alias Impl = byte; static if (is(T == ushort)) alias Impl = short; static if (is(T == uint )) alias Impl = int; static if (is(T == ulong )) alias Impl = long; static if (is(ucent) && is(T == ucent )) alias Impl = cent; } else static assert(false, "Type " ~ T.stringof ~ " does not have an Signed counterpart"); } alias Signed = ModifyTypePreservingTQ!(Impl, OriginalType!T); } /// unittest { alias S1 = Signed!uint; static assert(is(S1 == int)); alias S2 = Signed!(const(uint)); static assert(is(S2 == const(int))); alias S3 = Signed!(immutable(uint)); static assert(is(S3 == immutable(int))); static if (is(ucent)) { alias S4 = Signed!ucent; static assert(is(S4 == cent)); } } unittest { static assert(is(Signed!float == float)); static if (is(__vector(int[4])) && is(__vector(uint[4]))) { alias SV1 = Signed!(__vector(uint[4])); alias SV2 = Signed!(const(__vector(uint[4]))); static assert(is(SV1 == __vector(int[4]))); static assert(is(SV2 == const(__vector(int[4])))); } } /** Returns the most negative value of the numeric type T. */ template mostNegative(T) if(isNumeric!T || isSomeChar!T || isBoolean!T) { static if (is(typeof(T.min_normal))) enum mostNegative = -T.max; else static if (T.min == 0) enum byte mostNegative = 0; else enum mostNegative = T.min; } /// unittest { static assert(mostNegative!float == -float.max); static assert(mostNegative!double == -double.max); static assert(mostNegative!real == -real.max); static assert(mostNegative!bool == false); } /// unittest { foreach(T; TypeTuple!(bool, byte, short, int, long)) static assert(mostNegative!T == T.min); foreach(T; TypeTuple!(ubyte, ushort, uint, ulong, char, wchar, dchar)) static assert(mostNegative!T == 0); } //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// // Misc. //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// /** Returns the mangled name of symbol or type $(D sth). $(D mangledName) is the same as builtin $(D .mangleof) property, except that the correct names of property functions are obtained. -------------------- module test; import std.traits : mangledName; class C { int value() @property; } pragma(msg, C.value.mangleof); // prints "i" pragma(msg, mangledName!(C.value)); // prints "_D4test1C5valueMFNdZi" -------------------- */ template mangledName(sth...) if (sth.length == 1) { static if (is(typeof(sth[0]) X) && is(X == void)) { // sth[0] is a template symbol enum string mangledName = removeDummyEnvelope(Dummy!sth.Hook.mangleof); } else { enum string mangledName = sth[0].mangleof; } } private template Dummy(T...) { struct Hook {} } private string removeDummyEnvelope(string s) { // remove --> S3std6traits ... Z4Hook s = s[12 .. $ - 6]; // remove --> DIGIT+ __T5Dummy foreach (i, c; s) { if (c < '0' || '9' < c) { s = s[i .. $]; break; } } s = s[9 .. $]; // __T5Dummy // remove --> T | V | S immutable kind = s[0]; s = s[1 .. $]; if (kind == 'S') // it's a symbol { /* * The mangled symbol name is packed in LName --> Number Name. Here * we are chopping off the useless preceding Number, which is the * length of Name in decimal notation. * * NOTE: n = m + Log(m) + 1; n = LName.length, m = Name.length. */ immutable n = s.length; size_t m_upb = 10; foreach (k; 1 .. 5) // k = Log(m_upb) { if (n < m_upb + k + 1) { // Now m_upb/10 <= m < m_upb; hence k = Log(m) + 1. s = s[k .. $]; break; } m_upb *= 10; } } return s; } unittest { class C { int value() @property { return 0; } } static assert(mangledName!int == int.mangleof); static assert(mangledName!C == C.mangleof); static assert(mangledName!(C.value)[$ - 12 .. $] == "5valueMFNdZi"); static assert(mangledName!mangledName == "3std6traits11mangledName"); static assert(mangledName!removeDummyEnvelope == "_D3std6traits19removeDummyEnvelopeFAyaZAya"); int x; static if (is(typeof({ return x; }) : int delegate() pure)) // issue 9148 static assert(mangledName!((int a) { return a+x; }) == "DFNaNbNiNfiZi"); // pure nothrow @safe @nogc else static assert(mangledName!((int a) { return a+x; }) == "DFNbNiNfiZi"); // nothrow @safe @nnogc } unittest { // Test for bug 5718 import std.demangle; int foo; auto foo_demangled = demangle(mangledName!foo); assert(foo_demangled[0 .. 4] == "int " && foo_demangled[$-3 .. $] == "foo"); void bar(){} auto bar_demangled = demangle(mangledName!bar); assert(bar_demangled[0 .. 5] == "void " && bar_demangled[$-5 .. $] == "bar()"); } // XXX Select & select should go to another module. (functional or algorithm?) /** Aliases itself to $(D T[0]) if the boolean $(D condition) is $(D true) and to $(D T[1]) otherwise. */ template Select(bool condition, T...) if (T.length == 2) { alias Select = T[!condition]; } /// unittest { // can select types static assert(is(Select!(true, int, long) == int)); static assert(is(Select!(false, int, long) == long)); // can select symbols int a = 1; int b = 2; alias selA = Select!(true, a, b); alias selB = Select!(false, a, b); assert(selA == 1); assert(selB == 2); } /** If $(D cond) is $(D true), returns $(D a) without evaluating $(D b). Otherwise, returns $(D b) without evaluating $(D a). */ A select(bool cond : true, A, B)(A a, lazy B b) { return a; } /// Ditto B select(bool cond : false, A, B)(lazy A a, B b) { return b; } unittest { real pleasecallme() { return 0; } int dontcallme() { assert(0); } auto a = select!true(pleasecallme(), dontcallme()); auto b = select!false(dontcallme(), pleasecallme()); static assert(is(typeof(a) == real)); static assert(is(typeof(b) == real)); } /** * Determine if a symbol has a given $(LINK2 ../attribute.html#uda, user-defined attribute). */ template hasUDA(alias symbol, alias attribute) { import std.typetuple : staticIndexOf; static if (is(attribute == struct) || is(attribute == class)) { template GetTypeOrExp(alias S) { static if (is(typeof(S))) alias GetTypeOrExp = typeof(S); else alias GetTypeOrExp = S; } enum bool hasUDA = staticIndexOf!(attribute, staticMap!(GetTypeOrExp, __traits(getAttributes, symbol))) != -1; } else enum bool hasUDA = staticIndexOf!(attribute, __traits(getAttributes, symbol)) != -1; } /// unittest { enum E; struct S; struct Named { string name; } @("alpha") int a; static assert(hasUDA!(a, "alpha")); static assert(!hasUDA!(a, S)); static assert(!hasUDA!(a, E)); @(E) int b; static assert(!hasUDA!(b, "alpha")); static assert(!hasUDA!(b, S)); static assert(hasUDA!(b, E)); @E int c; static assert(!hasUDA!(c, "alpha")); static assert(!hasUDA!(c, S)); static assert(hasUDA!(c, E)); @(S, E) int d; static assert(!hasUDA!(d, "alpha")); static assert(hasUDA!(d, S)); static assert(hasUDA!(d, E)); @S int e; static assert(!hasUDA!(e, "alpha")); static assert(hasUDA!(e, S)); static assert(!hasUDA!(e, E)); @(S, E, "alpha") int f; static assert(hasUDA!(f, "alpha")); static assert(hasUDA!(f, S)); static assert(hasUDA!(f, E)); @(100) int g; static assert(hasUDA!(g, 100)); @Named("abc") int h; static assert(hasUDA!(h, Named)); } /** * Gets the $(LINK2 ../attribute.html#uda, user-defined attributes) of the given * type from the given symbol. */ template getUDAs(alias symbol, alias attribute) { import std.typetuple : Filter; enum isDesiredUDA(alias S) = is(typeof(S) == attribute); alias getUDAs = Filter!(isDesiredUDA, __traits(getAttributes, symbol)); } /// unittest { struct Attr { string name; int value; } @Attr("Answer", 42) int a; static assert(getUDAs!(a, Attr)[0].name == "Answer"); static assert(getUDAs!(a, Attr)[0].value == 42); @(Attr("Answer", 42), "string", 9999) int b; static assert(getUDAs!(b, Attr)[0].name == "Answer"); static assert(getUDAs!(b, Attr)[0].value == 42); @Attr("Answer", 42) @Attr("Pi", 3) int c; static assert(getUDAs!(c, Attr)[0].name == "Answer"); static assert(getUDAs!(c, Attr)[0].value == 42); static assert(getUDAs!(c, Attr)[1].name == "Pi"); static assert(getUDAs!(c, Attr)[1].value == 3); } /** * Gets all symbols within `symbol` that have the given user-defined attribute. * This is not recursive; it will not search for symbols within symbols such as * nested structs or unions. */ template getSymbolsByUDA(alias symbol, alias attribute) { import std.typetuple : Filter, staticMap, TypeTuple; static enum hasSpecificUDA(alias S) = hasUDA!(S, attribute); alias StringToSymbol(alias Name) = Identity!(__traits(getMember, symbol, Name)); alias getSymbolsByUDA = Filter!(hasSpecificUDA, TypeTuple!(symbol, staticMap!(StringToSymbol, __traits(allMembers, symbol)))); } /// unittest { enum Attr; static struct A { @Attr int a; int b; @Attr void doStuff() {} void doOtherStuff() {} static struct Inner { // Not found by getSymbolsByUDA @Attr int c; } } // Finds both variables and functions with the attribute, but // doesn't include the variables and functions without it. static assert(getSymbolsByUDA!(A, Attr).length == 2); // Can access attributes on the symbols returned by getSymbolsByUDA. static assert(hasUDA!(getSymbolsByUDA!(A, Attr)[0], Attr)); static assert(hasUDA!(getSymbolsByUDA!(A, Attr)[1], Attr)); static struct UDA { string name; } static struct B { @UDA("X") int x; @UDA("Y") int y; @(100) int z; } // Finds both UDA attributes. static assert(getSymbolsByUDA!(B, UDA).length == 2); // Finds one `100` attribute. static assert(getSymbolsByUDA!(B, 100).length == 1); // Can get the value of the UDA from the return value static assert(getUDAs!(getSymbolsByUDA!(B, UDA)[0], UDA)[0].name == "X"); @UDA("A") static struct C { @UDA("B") int d; } // Also checks the symbol itself static assert(getSymbolsByUDA!(C, UDA).length == 2); static assert(getSymbolsByUDA!(C, UDA)[0].stringof == "C"); static assert(getSymbolsByUDA!(C, UDA)[1].stringof == "d"); }
D
/Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Console.build/Console/Console+Options.swift.o : /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Swift3.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/String+ANSI.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal+Command.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Runnable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/ConsoleStyle.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Value.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ask.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ephemeral.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleProtocol.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/FileHandle+Stream.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Pipe+Stream.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Stream.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/String+Trim.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Confirm.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Option.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Run.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Group.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Bar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/LoadingBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/ProgressBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Clear/ConsoleClear.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Center.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Color/ConsoleColor.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleError.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Options.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Argument.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command+Print.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Print.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /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/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Bits.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/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CSQLite.build/module.modulemap /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/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Console.build/Console+Options~partial.swiftmodule : /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Swift3.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/String+ANSI.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal+Command.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Runnable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/ConsoleStyle.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Value.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ask.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ephemeral.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleProtocol.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/FileHandle+Stream.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Pipe+Stream.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Stream.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/String+Trim.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Confirm.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Option.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Run.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Group.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Bar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/LoadingBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/ProgressBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Clear/ConsoleClear.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Center.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Color/ConsoleColor.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleError.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Options.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Argument.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command+Print.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Print.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /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/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Bits.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/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CSQLite.build/module.modulemap /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/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Console.build/Console+Options~partial.swiftdoc : /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Swift3.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/String+ANSI.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/Bool+Polymorphic.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal+Command.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Runnable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/Console+ConsoleStyle.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Style/ConsoleStyle.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Value.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ask.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleStyle+Terminal.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/ConsoleColor+Terminal.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Terminal/Terminal.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Ephemeral.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleProtocol.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/FileHandle+Stream.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Pipe+Stream.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Stream/Stream.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Utilities/String+Trim.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Confirm.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Option.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Run.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Group.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Bar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/Console+LoadingBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Loading/LoadingBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/Console+ProgressBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Bar/Progress/ProgressBar.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Clear/ConsoleClear.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Center.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Color/ConsoleColor.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/ConsoleError.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Options.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Argument.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Command/Command+Print.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/console.git--2431895819212044213/Sources/Console/Console/Console+Print.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /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/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Bits.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/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CSQLite.build/module.modulemap /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
<!DOCTYPE html> <html> <!-- Mirrored from www.cognitiveclouds.com/img/c/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/safari-pinned-tab.svg by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 04 Aug 2017 17:01:12 GMT --> <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack --> <head> <!-- Meta, title, CSS, favicons, etc. --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="author" content=""> <meta name="keywords" content="design driven development"/> <meta name="description" content="At CognitiveClouds we build world class applications for mobile, web and cloud. We collaborate with well known brands and promising startups architecting, developing, designing and shipping smart software products" /> <meta name="google-site-verification" content="JdlkgSU9kQfKat08YgfmdLFMOyYpA2ROG9rt9FCglGM" /> <!--facebook--> <meta property="og:url" content="../../../../../../../../../../../../../../../../../../../../../../../index.html" /> <meta property="og:type" content="article" /> <meta property="og:title" content="We Create Transformative Software Products." /> <meta property="og:description" content="Startups and enterprises partner with us to research, design and develop elegant digital products for consumers, businesses and industries." /> <meta property="og:image" content="https://storage.googleapis.com/ccwebsite-assets/img/about-us/aboutus.jpg" /> <title>Page not found</title> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="/js/html5shiv-8b3747c5.js"></script> <script src="/js/respond/respond.min-88c91176.js"></script> <![endif]--> <!-- Main CSS --> <link href="../../../../../../../../../../../../../../../../../../../../../../../css/main-b0cae359.css" rel="stylesheet"> <link href="../../../../../../../../../../../../../../../../../../../../../../../css/nprogress.css" rel="stylesheet"> <link href="../../../../../../../../../../../../../../../../../../../../../../../css/workshop.css" rel="stylesheet"> <link href="../../../../../../../../../../../../../../../../../../../../../../../css/rangepicker.css" rel="stylesheet"> <link href="../../../../../../../../../../../../../../../../../../../../../../../css/resources.css" rel="stylesheet"> <link rel="apple-touch-icon" sizes="57x57" href="apple-touch-icon-57x57-11"> <link rel="apple-touch-icon" sizes="60x60" href="apple-touch-icon-60x60-11"> <link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-72x72-11"> <link rel="apple-touch-icon" sizes="76x76" href="apple-touch-icon-76x76-11"> <link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon-114x11-11"> <link rel="apple-touch-icon" sizes="120x120" href="apple-touch-icon-120x12-11"> <link rel="apple-touch-icon" sizes="144x144" href="apple-touch-icon-144x14-11"> <link rel="icon" type="image/png" href="../../../../../../../../../../../../../../../../../../../../../../../favicons/favicon-32x32.png" sizes="32x32"> <link rel="icon" type="image/png" href="../../../../../../../../../../../../../../../../../../../../../../../favicons/favicon-96x96.png" sizes="96x96"> <link rel="icon" type="image/png" href="../../../../../../../../../../../../../../../../../../../../../../../favicons/favicon-16x16.png" sizes="16x16"> <link rel="manifest" href="../favico/manifest.976.delaye"> <link rel="mask-icon" href="safari-pinned-tab.977.d" color="#5bbad5"> <meta name="msapplication-TileColor" content="#da532c"> <meta name="msapplication-TileImage" content="../../../../../../../../../../../../../../../../../../../../../../../mstile-144x144.html"> <meta name="theme-color" content="#ffffff"> </head> <body> <!-- Page hiding snippet (recommended) --> <style>.async-hide { opacity: 0 !important} </style> <script> (function(a,s,y,n,c,h,i,d,e){s.className+=' '+y; h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')}; (a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c); })(window,document.documentElement,'async-hide','dataLayer',4000,{'GTM-5F86N3V':true}); </script> <!--Ends Page hiding snippet --> <!--Google Analytics Tracking code--> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-37831194-1', 'auto'); ga('require', 'GTM-5F86N3V'); ga('send', 'pageview'); </script> <!--End Google Analytics Tracking code--> <!-- Google Tag Manager --> <noscript><iframe src="http://www.googletagmanager.com/ns.html?id=GTM-KPF6BB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'http://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-KPF6BB');</script> <!-- End Google Tag Manager --> <div id="page-wrap" class=""> <nav class="navbar navbar-fixed-top navbar-static"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand text-hide" href="../../../../../../../../../../../../../../../../../../../../../../../index.html"></a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="navbar-collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="../../../../../../../../../../../../../../../../../../../../../../../custom-software-development-company.html" class="">About</a> <li><a href="../../../../../../../../../../../../../../../../../../../../../../../custom-software-development-services.html" class="">Services</a> <!-- <li><a href="services">Services</a> --> <li><a href="../../../../../../../../../../../../../../../../../../../../../../../software-product-development-portfolio.html" class="">Portfolio</a></li> <!--<li><a href="/resources" class="">Resources</a></li>--> <li><a href="../../../../../../../../../../../../../../../../../../../../../../../insights/index.html" class="">Insights</a></li> <li><a href="../../../../../../../../../../../../../../../../../../../../../../../jobs.html" class="">We're Hiring</a></li> <li><a href="../../../../../../../../../../../../../../../../../../../../../../../contact.html" class="">Contact</a></li> <li> <div class="scrollTop"> <a type="submit" class="btn-green" href="#page-content">Free consultation</a> </div> </li> </ul> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav> <!--content starts here--> <div id="page-content" class="home page-not-found"> <section> <div> <h1>Oops!</h1> <h5>We can't seem to find the page you're looking for.</h5> <p>Error code: 404</p> </div> </section> </div><!--/home--> <style> .page-not-found p{} .page-not-found { text-align: center; padding-left: 20px; padding-right: 20px; color: #567387; background: #fff; font-family: "Graphik-Regular", "Helvetica", Arial, sans-serif; } .page-not-found h5{ line-height: 87px; color: #567387; font-family: "Graphik-Regular", "Helvetica", Arial, sans-serif; font-size: 30px; max-width: 1000px; margin: 0 auto; } .page-not-found h1{ font-family: "FoundersGrotesk-Bold", serif; font-size: 87px; color: #567387; } .page-not-found p{ font-size: 20px; color: #567387; } #page-wrap{ min-height: 0% !important; } @media(max-width: 767px){ .page-not-found h1{ font-size: 40px; } .page-not-found h5 { line-height: 30px; font-size: 20px; } } </style> <!--content end--> </div> <footer> <div class="container"> <div class="row"> <div class="col-lg-4"> <div class="email contact_us"> <h3>Contact</h3> <h4>For new business:</h4> <a href="../../../../../../../../../../../../../../../../../../../../../../../contact.html" class="btn btn-primary">Contact Us</a> <h4>For new career opportunities: </h4> <a href="../../../../../../../../../../../../../../../../../../../../../../../jobs.html">jobs@cognitiveclouds.com</a> </div> </div> <div class="col-lg-8"> <div class="contact-information"> <div id="aclock-usa"> <div class="division"> <div class="div"></div> <div class="div"></div> <div class="mask"></div> <div class="div"></div> <div class="mask"></div> <div id="period-usa"></div> </div> <div id="hour-hand-usa" class="hours arrow"></div> <div id="minute-hand-usa" class="minutes arrow"></div> <div class="point"></div> <div id="second-hand-usa" class="second-hand arrow" ></div> </div> <div class="address"> <h3>United States</h3> <span>5433 Ontario Common </span> <span>Fremont CA 94555</span> <span>USA </span> <a href="tel:+1.415.234.3611" class="tel">+1.415.234.3611</a> </div> </div> <div class="contact-information"> <div id="aclock-sp"> <div class="division"> <div class="div"></div> <div class="div"></div> <div class="mask"></div> <div class="div"></div> <div class="mask"></div> <div id="period-sp"></div> </div> <div id="hour-hand-sp" class="hours arrow"></div> <div id="minute-hand-sp" class="minutes arrow"></div> <div class="point"></div> <div id="second-hand-sp" class="second-hand arrow" ></div> </div> <div class="address"> <h3>Singapore</h3> <span>20 Cecil street #14-01 </span> <span>Equity plaza</span> <span>Singapore - 049705</span> <a href="tel:+65.31587850" class="tel">+65.31587850</a> </div> </div> <div class="contact-information"> <div id="aclock"> <div class="division"> <div class="div"></div> <div class="div"></div> <div class="mask"></div> <div class="div"></div> <div class="mask"></div> <div id="period"></div> </div> <div id="hourhand" class="hours arrow"></div> <div id="minutehand" class="minutes arrow"></div> <div class="point"></div> <div id="secondhand" class="second-hand arrow" ></div> </div> <div class="address"> <h3>India</h3> <span>#2 4th Cross KSRTC Layout</span> <span>Chikkalsandra </span> <span>Bangalore - 560061 </span> <a href="tel:+91.80.41707002" class="tel">+91.80.41707002</a> </div> </div> </div> </div> </div> <div class="container copyright-content"> <div class="row"> <div class="col-span-4"> <img src="../../../../../../../../../../../../../../../../../../../../../../h/logo.png" alt="Cognitive Clouds Logo"> <p>since 2012.</p> <p> &copy; 2017 CognitiveClouds</p> </div> <div class="col-span-8"> <ul class="list-inline"> <li> <a href="https://twitter.com/cognitiveclouds" class="social-twitter" target="_blank"> <svg width="36px" height="36px" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <!-- Generator: Sketch 3.3.3 (12072) - http://www.bohemiancoding.com/sketch --> <title>social-twitter</title><desc>Created with Sketch.</desc><defs></defs> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="social-twitter" sketch:type="MSArtboardGroup" fill="#0093FF"> <path d="M27.9554745,11.8870673 C27.2212409,12.207139 26.4322628,12.4235336 25.6040146,12.5207534 C26.4493431,12.0227444 27.0985401,11.2340807 27.4041606,10.2943139 C26.6131387,10.7555157 25.7369343,11.0904395 24.8043796,11.2708879 C24.0575182,10.4887534 22.9935036,10 21.8159854,10 C19.5548905,10 17.7218248,11.8019013 17.7218248,14.0242511 C17.7218248,14.3397309 17.7580292,14.6468161 17.8278102,14.941417 C14.4252555,14.7735964 11.4084672,13.1714439 9.38919708,10.7366457 C9.03678832,11.3310135 8.8349635,12.0223139 8.8349635,12.7598206 C8.8349635,14.1559821 9.55773723,15.3877668 10.6562774,16.1094888 C9.98510949,16.0886099 9.35386861,15.9075157 8.80182482,15.6060987 C8.80153285,15.6229596 8.80153285,15.6397489 8.80153285,15.6566816 C8.80153285,17.6066009 10.2127007,19.2330762 12.0856934,19.6027982 C11.7421168,19.6947085 11.380438,19.7439283 11.0070073,19.7439283 C10.7432117,19.7439283 10.4867153,19.7186726 10.2367883,19.6717489 C10.7577372,21.2705291 12.269708,22.4340807 14.0612409,22.466583 C12.660073,23.5459013 10.8947445,24.1892735 8.97664234,24.1892735 C8.64620438,24.1892735 8.32029197,24.1701883 8,24.1330224 C9.81182482,25.2748341 11.9638686,25.9410942 14.2759124,25.9410942 C21.8064964,25.9410942 25.9243796,19.8089327 25.9243796,14.4909058 C25.9243796,14.3164843 25.920438,14.1429238 25.9125547,13.970296 C26.7124088,13.4029058 27.4065693,12.6940987 27.9554745,11.8870673" id="Imported-Layers" sketch:type="MSShapeGroup"></path> </g> </g> </svg> </a> </li> <li> <!-- <a href="https://www.facebook.com/sharer/sharer.php?u=cognitiveclouds.com" class="social-facebook" target="_blank"> --> <a href="https://www.facebook.com/CognitiveClouds-558720034161747/" class="social-facebook" target="_blank"> <svg width="36px" height="36px" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <!-- Generator: Sketch 3.3.3 (12072) - http://www.bohemiancoding.com/sketch --> <title>social-facebook</title><desc>Created with Sketch.</desc><defs></defs> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="social-facebook" sketch:type="MSArtboardGroup" fill="#0093FF"> <path d="M19.7763361,26.9688458 L19.7763361,19.2285286 L22.4001765,19.2285286 L22.793,16.2119648 L19.7763361,16.2119648 L19.7763361,14.2860969 C19.7763361,13.4126564 20.0213025,12.8175066 21.2861429,12.8175066 L22.8992605,12.8167577 L22.8992605,10.1188502 C22.6201849,10.0820793 21.6626303,10 20.5485966,10 C18.2228151,10 16.6304958,11.4057577 16.6304958,13.9873612 L16.6304958,16.2119648 L14,16.2119648 L14,19.2285286 L16.6304958,19.2285286 L16.6304958,26.9688458 L19.7763361,26.9688458" id="Imported-Layers" sketch:type="MSShapeGroup"></path> </g> </g> </svg> </a> </li> <li> <a href="https://www.linkedin.com/company/cognitiveclouds" class="social-ln" target="_blank"> <svg width="36px" height="36px" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <!-- Generator: Sketch 3.3.3 (12072) - http://www.bohemiancoding.com/sketch --> <title>social-linkedin</title><desc>Created with Sketch.</desc><defs></defs> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="social-linkedin" sketch:type="MSArtboardGroup" fill="#0093FF"> <g id="Imported-Layers" sketch:type="MSLayerGroup" transform="translate(9.000000, 9.000000)"> <path d="M16.5888,0.000124137931 L1.35508966,0.000124137931 C0.627144828,0.000124137931 0.0356275862,0.577117241 0.0356275862,1.28817931 L0.0356275862,16.5861931 C0.0356275862,17.2981241 0.627144828,17.8759862 1.35508966,17.8759862 L16.5888,17.8759862 C17.3179862,17.8759862 17.9119862,17.2981241 17.9119862,16.5861931 L17.9119862,1.28817931 C17.9119862,0.577117241 17.3179862,0.000124137931 16.5888,0.000124137931 Z M2.68609655,6.70171034 L5.33755862,6.70171034 L5.33755862,15.2327172 L2.68609655,15.2327172 L2.68609655,6.70171034 Z M4.01238621,2.46115862 C4.86,2.46115862 5.54884138,3.15012414 5.54884138,3.99798621 C5.54884138,4.84671724 4.86,5.53555862 4.01238621,5.53555862 C3.16266207,5.53555862 2.47481379,4.84671724 2.47481379,3.99798621 C2.47481379,3.15012414 3.16266207,2.46115862 4.01238621,2.46115862 Z M7.00063448,6.70171034 L9.5436,6.70171034 L9.5436,7.86748966 L9.57910345,7.86748966 C9.93314483,7.19677241 10.7978897,6.48968276 12.0878069,6.48968276 C14.7726621,6.48968276 15.2683448,8.25666207 15.2683448,10.5534621 L15.2683448,15.2327172 L12.6187448,15.2327172 L12.6187448,11.0840276 C12.6187448,10.0947724 12.6006207,8.82223448 11.2410621,8.82223448 C9.86151724,8.82223448 9.64961379,9.89987586 9.64961379,11.0125241 L9.64961379,15.2327172 L7.00063448,15.2327172 L7.00063448,6.70171034 Z" id="Fill-1" sketch:type="MSShapeGroup"></path> </g> </g> </g> </svg> </a> </li> </ul> <div class="privacyPolicy"> <a href="../../../../../../../../../../../../../../../../../../../../../../../privacy.html">Privacy Policy</a> </div> </div> </div> </div> </footer> <script src="../../../../../../../../../../../../../../../../../../../../../../../js/jQuery-1.11.3.js"></script> <script src="../../../../../../../../../../../../../../../../../../../../../../../js/bootstrap.js"></script> <script src="../../../../../../../../../../../../../../../../../../../../../../../js/moment.js"></script> <script src="../../../../../../../../../../../../../../../../../../../../../../../js/custom.js"></script> <script src="../../../../../../../../../../../../../../../../../../../../../../../js/rangepicker.js"></script> <script src="../../../../../../../../../../../../../../../../../../../../../../../js/nprogress.js"></script> <script src="https://js.stripe.com/v3/"></script> <!-- <script src="/js/one.min.js"></script>--> <!--intercom js--> <script> window.intercomSettings = { app_id: "x3h0no0f" }; </script> <script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/x3h0no0f';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script> <!--ends intercom js--> </body> <!-- Mirrored from www.cognitiveclouds.com/img/c/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/favicons/safari-pinned-tab.svg by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 04 Aug 2017 17:01:12 GMT --> </html>
D
import std.process, std.format, std.stdio, std.file; void main() { string build_dub = "dub build --build=release"; string[string] commands = [ "amv" : build_dub, "cxz" : build_dub, "doco" : build_dub, "dww" : build_dub, "hexr" : build_dub, "streamFilter" : build_dub, "xxz" : build_dub, "ctwi" : build_dub, "ctl" : build_dub, "dbk" : build_dub, "sizer": build_dub, ]; import core.thread; auto tg = new ThreadGroup(); foreach (name; commands.keys) { string build_cmd = "cd %s; %s".format(name, commands[name]); tg.create(((string name, string build_cmd) => () { writeln("[BUILD] ", name, " [CMD: ", build_cmd, "]"); executeShell(build_cmd); writeln("[BUILD] ", name, " [FINISHED]"); })(name, build_cmd)); } }
D
/home/sky/Workshop/solana-app/target/release/build/syn-21506e0b7e0f02a6/build_script_build-21506e0b7e0f02a6: /home/sky/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.80/build.rs /home/sky/Workshop/solana-app/target/release/build/syn-21506e0b7e0f02a6/build_script_build-21506e0b7e0f02a6.d: /home/sky/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.80/build.rs /home/sky/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.80/build.rs:
D