code
stringlengths 3
10M
| language
stringclasses 31
values |
|---|---|
/Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/PieChartDataSet.o : /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Legend.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerImage.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Range.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/AxisBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ComponentBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Fill.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Platform.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Description.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/IMarker.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Transformer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Renderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/Animator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Filters/DataApproximator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/XAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/YAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartUtils.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Highlight.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/LineChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/RadarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Supporting\ Files/Charts.h /Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap
/Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/PieChartDataSet~partial.swiftmodule : /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Legend.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerImage.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Range.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/AxisBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ComponentBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Fill.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Platform.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Description.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/IMarker.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Transformer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Renderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/Animator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Filters/DataApproximator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/XAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/YAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartUtils.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Highlight.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/LineChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/RadarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Supporting\ Files/Charts.h /Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap
/Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/PieChartDataSet~partial.swiftdoc : /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Legend.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerImage.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Range.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/AxisBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/ComponentBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Fill.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Platform.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/Description.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/IMarker.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/Transformer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Renderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Animation/Animator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Filters/DataApproximator.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/XAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/YAxis.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/ChartUtils.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Highlight/Highlight.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/MarkerView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/PieChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/LineChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/BarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/RadarChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/hannh/Documents/MyGitHub/ChartsTest2/Charts/Source/Supporting\ Files/Charts.h /Users/hannh/Documents/MyGitHub/ChartsTest2/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap
|
D
|
// https://dpaste.dzfl.pl/7a77355acaec
// https://freedesktop.org/wiki/Specifications/XDND/
// https://docs.microsoft.com/en-us/windows/win32/dataxchg/html-clipboard-format
// https://www.x.org/releases/X11R7.7/doc/libXext/dbelib.html
// https://www.x.org/releases/X11R7.6/doc/libXext/synclib.html
// on Mac with X11: -L-L/usr/X11/lib
/+
* I might need to set modal hints too _NET_WM_STATE_MODAL and make sure that TRANSIENT_FOR legit works
Progress bar in taskbar
- i can probably just set a property on the window...
it sets that prop to an integer 0 .. 100. Taskbar
deletes it or window deletes it when it is handled.
- prolly display it as a nice little line at the bottom.
from gtk:
#define PROGRESS_HINT "_NET_WM_XAPP_PROGRESS"
#define PROGRESS_PULSE_HINT "_NET_WM_XAPP_PROGRESS_PULSE"
>+ if (cardinal > 0)
>+ {
>+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
>+ xid,
>+ gdk_x11_get_xatom_by_name_for_display (display, atom_name),
>+ XA_CARDINAL, 32,
>+ PropModeReplace,
>+ (guchar *) &cardinal, 1);
>+ }
>+ else
>+ {
>+ XDeleteProperty (GDK_DISPLAY_XDISPLAY (display),
>+ xid,
>+ gdk_x11_get_xatom_by_name_for_display (display, atom_name));
>+ }
from Windows:
see: https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-itaskbarlist3
interface
CoCreateInstance( CLSID_TaskbarList, nullptr, CLSCTX_ALL, __uuidof(ITaskbarList3), (LPVOID*)&m_pTL3 );
auto msg = RegisterWindowMessage(TEXT(“TaskbarButtonCreated”));
listen for msg, return TRUE
interface->SetProgressState(hwnd, TBPF_NORMAL);
interface->SetProgressValue(hwnd, 40, 100);
My new notification system.
- use a unix socket? or a x property? or a udp port?
- could of course also get on the dbus train but ugh.
- it could also reply with the info as a string for easy remote examination.
+/
/*
Event Loop would be nices:
* add on idle - runs when nothing else happens
* which can specify how long to yield for
* send messages without a recipient window
* setTimeout
* setInterval
*/
/*
Classic games I want to add:
* my tetris clone
* pac man
*/
/*
Text layout needs a lot of work. Plain drawText is useful but too
limited. It will need some kind of text context thing which it will
update and you can pass it on and get more details out of it.
It will need a bounding box, a current cursor location that is updated
as drawing continues, and various changable facts (which can also be
changed on the painter i guess) like font, color, size, background,
etc.
We can also fetch the caret location from it somehow.
Should prolly be an overload of drawText
blink taskbar / demand attention cross platform. FlashWindow and demandAttention
WS_EX_NOACTIVATE
WS_CHILD - owner and owned vs parent and child. Does X have something similar?
full screen windows. Can just set the atom on X. Windows will be harder.
moving windows. resizing windows.
hide cursor, capture cursor, change cursor.
REMEMBER: simpledisplay does NOT have to do everything! It just needs to make
sure the pieces are there to do its job easily and make other jobs possible.
*/
/++
simpledisplay.d (often abbreviated to "sdpy") provides basic cross-platform GUI-related functionality,
including creating windows, drawing on them, working with the clipboard,
timers, OpenGL, and more. However, it does NOT provide high level GUI
widgets. See my minigui.d, an extension to this module, for that
functionality.
simpledisplay provides cross-platform wrapping for Windows and Linux
(and perhaps other OSes that use X11), but also does not prevent you
from using the underlying facilities if you need them. It has a goal
of working efficiently over a remote X link (at least as far as Xlib
reasonably allows.)
simpledisplay depends on [arsd.color|color.d], which should be available from the
same place where you got this file. Other than that, however, it has
very few dependencies and ones that don't come with the OS and/or the
compiler are all opt-in.
simpledisplay.d's home base is on my arsd repo on Github. The file is:
https://github.com/adamdruppe/arsd/blob/master/simpledisplay.d
simpledisplay is basically stable. I plan to refactor the internals,
and may add new features and fix bugs, but It do not expect to
significantly change the API. It has been stable a few years already now.
Installation_instructions:
`simpledisplay.d` does not have any dependencies outside the
operating system and `color.d`, so it should just work most the
time, but there are a few caveats on some systems:
On Win32, you can pass `-L/subsystem:windows` if you don't want a
console to be automatically allocated.
Please note when compiling on Win64, you need to explicitly list
`-Lgdi32.lib -Luser32.lib` on the build command. If you want the Windows
subsystem too, use `-L/subsystem:windows -L/entry:mainCRTStartup`.
If using ldc instead of dmd, use `-L/entry:wmainCRTStartup` instead of `mainCRTStartup`;
note the "w".
I provided a `mixin EnableWindowsSubsystem;` helper to do those linker flags for you,
but you still need to use dmd -m32mscoff or -m64 (which dub does by default too fyi).
See [EnableWindowsSubsystem] for more information.
On Mac, when compiling with X11, you need XQuartz and -L-L/usr/X11R6/lib passed to dmd. If using the Cocoa implementation on Mac, you need to pass `-L-framework -LCocoa` to dmd. For OpenGL, add `-L-framework -LOpenGL` to the build command.
On Ubuntu, you might need to install X11 development libraries to
successfully link.
$(CONSOLE
$ sudo apt-get install libglc-dev
$ sudo apt-get install libx11-dev
)
Jump_list:
Don't worry, you don't have to read this whole documentation file!
Check out the [#event-example] and [#Pong-example] to get started quickly.
The main classes you may want to create are [SimpleWindow], [Timer],
[Image], and [Sprite].
The main functions you'll want are [setClipboardText] and [getClipboardText].
There are also platform-specific functions available such as [XDisplayConnection]
and [GetAtom] for X11, among others.
See the examples and topics list below to learn more.
$(WARNING
There should only be one GUI thread per application,
and all windows should be created in it and your
event loop should run there.
To do otherwise is undefined behavior and has no
cross platform guarantees.
)
$(H2 About this documentation)
The goal here is to give some complete programs as overview examples first, then a look at each major feature with working examples first, then, finally, the inline class and method list will follow.
Scan for headers for a topic - $(B they will visually stand out) - you're interested in to get started quickly and feel free to copy and paste any example as a starting point for your program. I encourage you to learn the library by experimenting with the examples!
All examples are provided with no copyright restrictions whatsoever. You do not need to credit me or carry any kind of notice with the source if you copy and paste from them.
To get started, download `simpledisplay.d` and `color.d` to a working directory. Copy an example info a file called `example.d` and compile using the command given at the top of each example.
If you need help, email me: destructionator@gmail.com or IRC us, #d on Freenode (I am destructionator or adam_d_ruppe there). If you learn something that isn't documented, I appreciate pull requests on github to this file.
At points, I will talk about implementation details in the documentation. These are sometimes
subject to change, but nevertheless useful to understand what is really going on. You can learn
more about some of the referenced things by searching the web for info about using them from C.
You can always look at the source of simpledisplay.d too for the most authoritative source on
its specific implementation. If you disagree with how I did something, please contact me so we
can discuss it!
$(H2 Using with fibers)
simpledisplay can be used with [core.thread.Fiber], but be warned many of the functions can use a significant amount of stack space. I recommend at least 64 KB stack for each fiber (just set through the second argument to Fiber's constructor).
$(H2 Topics)
$(H3 $(ID topic-windows) Windows)
The [SimpleWindow] class is simpledisplay's flagship feature. It represents a single
window on the user's screen.
You may create multiple windows, if the underlying platform supports it. You may check
`static if(multipleWindowsSupported)` at compile time, or catch exceptions thrown by
SimpleWindow's constructor at runtime to handle those cases.
A single running event loop will handle as many windows as needed.
$(H3 $(ID topic-event-loops) Event loops)
The simpledisplay event loop is designed to handle common cases easily while being extensible for more advanced cases, or replaceable by other libraries.
The most common scenario is creating a window, then calling [SimpleWindow.eventLoop|window.eventLoop] when setup is complete. You can pass several handlers to the `eventLoop` method right there:
---
// dmd example.d simpledisplay.d color.d
import arsd.simpledisplay;
void main() {
auto window = new SimpleWindow(200, 200);
window.eventLoop(0,
delegate (dchar) { /* got a character key press */ }
);
}
---
$(TIP If you get a compile error saying "I can't use this event handler", the most common thing in my experience is passing a function instead of a delegate. The simple solution is to use the `delegate` keyword, like I did in the example above.)
On Linux, the event loop is implemented with the `epoll` system call for efficiency an extensibility to other files. On Windows, it runs a traditional `GetMessage` + `DispatchMessage` loop, with a call to `SleepEx` in each iteration to allow the thread to enter an alertable wait state regularly, primarily so Overlapped I/O callbacks will get a chance to run.
On Linux, simpledisplay also supports my (deprecated) [arsd.eventloop] module. Compile your program, including the eventloop.d file, with the `-version=with_eventloop` switch.
It should be possible to integrate simpledisplay with vibe.d as well, though I haven't tried.
You can also run the event loop independently of a window, with [EventLoop.run|EventLoop.get.run], though since it will automatically terminate when there are no open windows, you will want to have one anyway.
$(H3 $(ID topic-notification-areas) Notification area (aka systray) icons)
Notification area icons are currently implemented on X11 and Windows. On X11, it defaults to using `libnotify` to show bubbles, if available, and will do a custom bubble window if not. You can `version=without_libnotify` to avoid this run-time dependency, if you like.
See the [NotificationAreaIcon] class.
$(H3 $(ID topic-input-handling) Input handling)
There are event handlers for low-level keyboard and mouse events, and higher level handlers for character events.
See [SimpleWindow.handleCharEvent], [SimpleWindow.handleKeyEvent], [SimpleWindow.handleMouseEvent].
$(H3 $(ID topic-2d-drawing) 2d Drawing)
To draw on your window, use the [SimpleWindow.draw] method. It returns a [ScreenPainter] structure with drawing methods.
Important: `ScreenPainter` double-buffers and will not actually update the window until its destructor is run. Always ensure the painter instance goes out-of-scope before proceeding. You can do this by calling it inside an event handler, a timer callback, or an small scope inside main. For example:
---
// dmd example.d simpledisplay.d color.d
import arsd.simpledisplay;
void main() {
auto window = new SimpleWindow(200, 200);
{ // introduce sub-scope
auto painter = window.draw(); // begin drawing
/* draw here */
painter.outlineColor = Color.red;
painter.fillColor = Color.black;
painter.drawRectangle(Point(0, 0), 200, 200);
} // end scope, calling `painter`'s destructor, drawing to the screen.
window.eventLoop(0); // handle events
}
---
Painting is done based on two color properties, a pen and a brush.
At this time, the 2d drawing does not support alpha blending, except for the [Sprite] class. If you need that, use a 2d OpenGL context instead.
FIXME Add example of 2d opengl drawing here.
$(H3 $(ID topic-3d-drawing) 3d Drawing (or 2d with OpenGL))
simpledisplay can create OpenGL contexts on your window. It works quite differently than 2d drawing.
Note that it is still possible to draw 2d on top of an OpenGL window, using the `draw` method, though I don't recommend it.
To start, you create a [SimpleWindow] with OpenGL enabled by passing the argument [OpenGlOptions.yes] to the constructor.
Next, you set [SimpleWindow.redrawOpenGlScene|window.redrawOpenGlScene] to a delegate which draws your frame.
To force a redraw of the scene, call [SimpleWindow.redrawOpenGlSceneNow|window.redrawOpenGlSceneNow()] or to queue a redraw after processing the next batch of pending events, use [SimpleWindow.redrawOpenGlSceneSoon|window.redrawOpenGlSceneSoon].
simpledisplay supports both old-style `glBegin` and newer-style shader-based code all through its built-in bindings. See the next section of the docs to see a shader-based program.
This example program will draw a rectangle on your window using old-style OpenGL with a pulsating color:
---
import arsd.simpledisplay;
void main() {
auto window = new SimpleWindow(800, 600, "opengl 1", OpenGlOptions.yes, Resizability.allowResizing);
float otherColor = 0.0;
float colorDelta = 0.05;
window.redrawOpenGlScene = delegate() {
glLoadIdentity();
glBegin(GL_QUADS);
glColor3f(1.0, otherColor, 0);
glVertex3f(-0.8, -0.8, 0);
glColor3f(1.0, otherColor, 1.0);
glVertex3f(0.8, -0.8, 0);
glColor3f(0, 1.0, otherColor);
glVertex3f(0.8, 0.8, 0);
glColor3f(otherColor, 0, 1.0);
glVertex3f(-0.8, 0.8, 0);
glEnd();
};
window.eventLoop(50, () {
otherColor += colorDelta;
if(otherColor > 1.0) {
otherColor = 1.0;
colorDelta = -0.05;
}
if(otherColor < 0) {
otherColor = 0;
colorDelta = 0.05;
}
// at the end of the timer, we have to request a redraw
// or we won't see the changes.
window.redrawOpenGlSceneSoon();
});
}
---
My [arsd.game] module has some helpers for using old-style opengl to make 2D windows too. See: [arsd.game.create2dWindow].
$(H3 $(ID topic-modern-opengl) Modern OpenGL)
simpledisplay's opengl support, by default, is for "legacy" opengl. To use "modern" functions, you must opt-into them with a little more setup. But the library provides helpers for this too.
This example program shows how you can set up a shader to draw a rectangle:
---
module opengl3test;
import arsd.simpledisplay;
// based on https://learnopengl.com/Getting-started/Hello-Triangle
void main() {
// First thing we do, before creating the window, is declare what version we want.
setOpenGLContextVersion(3, 3);
// turning off legacy compat is required to use version 3.3 and newer
openGLContextCompatible = false;
uint VAO;
OpenGlShader shader;
// then we can create the window.
auto window = new SimpleWindow(800, 600, "opengl 3", OpenGlOptions.yes, Resizability.allowResizing);
// additional setup needs to be done when it is visible, simpledisplay offers a property
// for exactly that:
window.visibleForTheFirstTime = delegate() {
// now with the window loaded, we can start loading the modern opengl functions.
// you MUST set the context first.
window.setAsCurrentOpenGlContext;
// then load the remainder of the library
gl3.loadDynamicLibrary();
// now you can create the shaders, etc.
shader = new OpenGlShader(
OpenGlShader.Source(GL_VERTEX_SHADER, `
#version 330 core
layout (location = 0) in vec3 aPos;
void main() {
gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);
}
`),
OpenGlShader.Source(GL_FRAGMENT_SHADER, `
#version 330 core
out vec4 FragColor;
uniform vec4 mycolor;
void main() {
FragColor = mycolor;
}
`),
);
// and do whatever other setup you want.
float[] vertices = [
0.5f, 0.5f, 0.0f, // top right
0.5f, -0.5f, 0.0f, // bottom right
-0.5f, -0.5f, 0.0f, // bottom left
-0.5f, 0.5f, 0.0f // top left
];
uint[] indices = [ // note that we start from 0!
0, 1, 3, // first Triangle
1, 2, 3 // second Triangle
];
uint VBO, EBO;
glGenVertexArrays(1, &VAO);
// bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).
glBindVertexArray(VAO);
glGenBuffers(1, &VBO);
glGenBuffers(1, &EBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferDataSlice(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
glBufferDataSlice(GL_ELEMENT_ARRAY_BUFFER, indices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * float.sizeof, null);
glEnableVertexAttribArray(0);
// the library will set the initial viewport and trigger our first draw,
// so these next two lines are NOT needed. they are just here as comments
// to show what would happen next.
// glViewport(0, 0, window.width, window.height);
// window.redrawOpenGlSceneNow();
};
// this delegate is called any time the window needs to be redrawn or if you call `window.redrawOpenGlSceneNow;`
// it is our render method.
window.redrawOpenGlScene = delegate() {
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(shader.shaderProgram);
// the shader helper class has methods to set uniforms too
shader.uniforms.mycolor.opAssign(1.0, 1.0, 0, 1.0);
glBindVertexArray(VAO);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, null);
};
window.eventLoop(0);
}
---
This program only draws the image once because that's all that is necessary, since it is static. If you want to do animation, you might set a pulse timer (which would be a fixed max fps, not necessarily consistent) or use a render loop in a separate thread.
$(H3 $(ID topic-images) Displaying images)
You can also load PNG images using [arsd.png].
---
// dmd example.d simpledisplay.d color.d png.d
import arsd.simpledisplay;
import arsd.png;
void main() {
auto image = Image.fromMemoryImage(readPng("image.png"));
displayImage(image);
}
---
Compile with `dmd example.d simpledisplay.d png.d`.
If you find an image file which is a valid png that [arsd.png] fails to load, please let me know. In the mean time of fixing the bug, you can probably convert the file into an easier-to-load format. Be sure to turn OFF png interlacing, as that isn't supported. Other things to try would be making the image smaller, or trying 24 bit truecolor mode with an alpha channel.
$(H3 $(ID topic-sprites) Sprites)
The [Sprite] class is used to make images on the display server for fast blitting to screen. This is especially important to use to support fast drawing of repeated images on a remote X11 link.
[Sprite] is also the only facility that currently supports alpha blending without using OpenGL .
$(H3 $(ID topic-clipboard) Clipboard)
The free functions [getClipboardText] and [setClipboardText] consist of simpledisplay's cross-platform clipboard support at this time.
It also has helpers for handling X-specific events.
$(H3 $(ID topic-dnd) Drag and Drop)
See [enableDragAndDrop] and [draggable].
$(H3 $(ID topic-timers) Timers)
There are two timers in simpledisplay: one is the pulse timeout you can set on the call to `window.eventLoop`, and the other is a customizable class, [Timer].
The pulse timeout is used by setting a non-zero interval as the first argument to `eventLoop` function and adding a zero-argument delegate to handle the pulse.
---
import arsd.simpledisplay;
void main() {
auto window = new SimpleWindow(400, 400);
// every 100 ms, it will draw a random line
// on the window.
window.eventLoop(100, {
auto painter = window.draw();
import std.random;
// random color
painter.outlineColor = Color(uniform(0, 256), uniform(0, 256), uniform(0, 256));
// random line
painter.drawLine(
Point(uniform(0, window.width), uniform(0, window.height)),
Point(uniform(0, window.width), uniform(0, window.height)));
});
}
---
The `Timer` class works similarly, but is created separately from the event loop. (It still fires through the event loop, though.) You may make as many instances of `Timer` as you wish.
The pulse timer and instances of the [Timer] class may be combined at will.
---
import arsd.simpledisplay;
void main() {
auto window = new SimpleWindow(400, 400);
auto timer = new Timer(1000, delegate {
auto painter = window.draw();
painter.clear();
});
window.eventLoop(0);
}
---
Timers are currently only implemented on Windows, using `SetTimer` and Linux, using `timerfd_create`. These deliver timeout messages through your application event loop.
$(H3 $(ID topic-os-helpers) OS-specific helpers)
simpledisplay carries a lot of code to help implement itself without extra dependencies, and much of this code is available for you too, so you may extend the functionality yourself.
See also: `xwindows.d` from my github.
$(H3 $(ID topic-os-extension) Extending with OS-specific functionality)
`handleNativeEvent` and `handleNativeGlobalEvent`.
$(H3 $(ID topic-integration) Integration with other libraries)
Integration with a third-party event loop is possible.
On Linux, you might want to support both terminal input and GUI input. You can do this by using simpledisplay together with eventloop.d and terminal.d.
$(H3 $(ID topic-guis) GUI widgets)
simpledisplay does not provide GUI widgets such as text areas, buttons, checkboxes, etc. It only gives basic windows, the ability to draw on it, receive input from it, and access native information for extension. You may write your own gui widgets with these, but you don't have to because I already did for you!
Download `minigui.d` from my github repository and add it to your project. minigui builds these things on top of simpledisplay and offers its own Window class (and subclasses) to use that wrap SimpleWindow, adding a new event and drawing model that is hookable by subwidgets, represented by their own classes.
Migrating to minigui from simpledisplay is often easy though, because they both use the same ScreenPainter API, and the same simpledisplay events are available, if you want them. (Though you may like using the minigui model, especially if you are familiar with writing web apps in the browser with Javascript.)
minigui still needs a lot of work to be finished at this time, but it already offers a number of useful classes.
$(H2 Platform-specific tips and tricks)
Windows_tips:
You can add icons or manifest files to your exe using a resource file.
To create a Windows .ico file, use the gimp or something. I'll write a helper
program later.
Create `yourapp.rc`:
```rc
1 ICON filename.ico
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "YourApp.exe.manifest"
```
And `yourapp.exe.manifest`:
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="CompanyName.ProductName.YourApplication"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- old style -->
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> <!-- new style -->
<!-- Un-comment the line below to enable GDI-scaling in this project. This will enable text -->
<!-- to render crisply in DPI-unaware contexts -->
<!--<gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling>-->
</windowsSettings>
</application>
</assembly>
```
You can also just distribute yourapp.exe.manifest as a separate file alongside yourapp.exe, or link it in to the exe with linker command lines `/manifest:embed` and `/manifestinput:yourfile.exe.manifest`.
Doing this lets you opt into various new things since Windows XP.
See: https://docs.microsoft.com/en-us/windows/win32/SbsCs/application-manifests
$(H2 Tips)
$(H3 Name conflicts)
simpledisplay has a lot of symbols and more are liable to be added without notice, since it contains its own bindings as needed to accomplish its goals. Some of these may conflict with other bindings you use. If so, you can use a static import in D, possibly combined with a selective import:
---
static import sdpy = arsd.simpledisplay;
import arsd.simpledisplay : SimpleWindow;
void main() {
auto window = new SimpleWindow();
sdpy.EventLoop.get.run();
}
---
$(H2 $(ID developer-notes) Developer notes)
I don't have a Mac, so that code isn't maintained. I would like to have a Cocoa
implementation though.
The NativeSimpleWindowImplementation and NativeScreenPainterImplementation both
suck. If I was rewriting it, I wouldn't do it that way again.
This file must not have any more required dependencies. If you need bindings, add
them right to this file. Once it gets into druntime and is there for a while, remove
bindings from here to avoid conflicts (or put them in an appropriate version block
so it continues to just work on old dmd), but wait a couple releases before making the
transition so this module remains usable with older versions of dmd.
You may have optional dependencies if needed by putting them in version blocks or
template functions. You may also extend the module with other modules with UFCS without
actually editing this - that is nice to do if you can.
Try to make functions work the same way across operating systems. I typically make
it thinly wrap Windows, then emulate that on Linux.
A goal of this is to keep a gui hello world to less than 250 KB. This means avoiding
Phobos! So try to avoid it.
See more comments throughout the source.
I realize this file is fairly large, but over half that is just bindings at the bottom
or documentation at the top. Some of the classes are a bit big too, but hopefully easy
to understand. I suggest you jump around the source by looking for a particular
declaration you're interested in, like `class SimpleWindow` using your editor's search
function, then look at one piece at a time.
Authors: Adam D. Ruppe with the help of others. If you need help, please email me with
destructionator@gmail.com or find me on IRC. Our channel is #d on Freenode and you can
ping me, adam_d_ruppe, and I'll usually see it if I'm around.
I live in the eastern United States, so I will most likely not be around at night in
that US east timezone.
License: Copyright Adam D. Ruppe, 2011-2021. Released under the Boost Software License.
Building documentation: use my adrdox generator, `dub run adrdox`.
Examples:
$(DIV $(ID Event-example))
$(H3 $(ID event-example) Event example)
This program creates a window and draws events inside them as they
happen, scrolling the text in the window as needed. Run this program
and experiment to get a feel for where basic input events take place
in the library.
---
// dmd example.d simpledisplay.d color.d
import arsd.simpledisplay;
import std.conv;
void main() {
auto window = new SimpleWindow(Size(500, 500), "Event example - simpledisplay.d");
int y = 0;
void addLine(string text) {
auto painter = window.draw();
if(y + painter.fontHeight >= window.height) {
painter.scrollArea(Point(0, 0), window.width, window.height, 0, painter.fontHeight);
y -= painter.fontHeight;
}
painter.outlineColor = Color.red;
painter.fillColor = Color.black;
painter.drawRectangle(Point(0, y), window.width, painter.fontHeight);
painter.outlineColor = Color.white;
painter.drawText(Point(10, y), text);
y += painter.fontHeight;
}
window.eventLoop(1000,
() {
addLine("Timer went off!");
},
(KeyEvent event) {
addLine(to!string(event));
},
(MouseEvent event) {
addLine(to!string(event));
},
(dchar ch) {
addLine(to!string(ch));
}
);
}
---
If you are interested in more game writing with D, check out my gamehelpers.d which builds upon simpledisplay, and its other stand-alone support modules, simpleaudio.d and joystick.d, too.
$(COMMENT
This program displays a pie chart. Clicking on a color will increase its share of the pie.
---
---
)
+/
module arsd.simpledisplay;
// FIXME: tetris demo
// FIXME: space invaders demo
// FIXME: asteroids demo
/++ $(ID Pong-example)
$(H3 Pong)
This program creates a little Pong-like game. Player one is controlled
with the keyboard. Player two is controlled with the mouse. It demos
the pulse timer, event handling, and some basic drawing.
+/
version(demos)
unittest {
// dmd example.d simpledisplay.d color.d
import arsd.simpledisplay;
enum paddleMovementSpeed = 8;
enum paddleHeight = 48;
void main() {
auto window = new SimpleWindow(600, 400, "Pong game!");
int playerOnePosition, playerTwoPosition;
int playerOneMovement, playerTwoMovement;
int playerOneScore, playerTwoScore;
int ballX, ballY;
int ballDx, ballDy;
void serve() {
import std.random;
ballX = window.width / 2;
ballY = window.height / 2;
ballDx = uniform(-4, 4) * 3;
ballDy = uniform(-4, 4) * 3;
if(ballDx == 0)
ballDx = uniform(0, 2) == 0 ? 3 : -3;
}
serve();
window.eventLoop(50, // set a 50 ms timer pulls
// This runs once per timer pulse
delegate () {
auto painter = window.draw();
painter.clear();
// Update everyone's motion
playerOnePosition += playerOneMovement;
playerTwoPosition += playerTwoMovement;
ballX += ballDx;
ballY += ballDy;
// Bounce off the top and bottom edges of the window
if(ballY + 7 >= window.height)
ballDy = -ballDy;
if(ballY - 8 <= 0)
ballDy = -ballDy;
// Bounce off the paddle, if it is in position
if(ballX - 8 <= 16) {
if(ballY + 7 > playerOnePosition && ballY - 8 < playerOnePosition + paddleHeight) {
ballDx = -ballDx + 1; // add some speed to keep it interesting
ballDy += playerOneMovement; // and y movement based on your controls too
ballX = 24; // move it past the paddle so it doesn't wiggle inside
} else {
// Missed it
playerTwoScore ++;
serve();
}
}
if(ballX + 7 >= window.width - 16) { // do the same thing but for player 1
if(ballY + 7 > playerTwoPosition && ballY - 8 < playerTwoPosition + paddleHeight) {
ballDx = -ballDx - 1;
ballDy += playerTwoMovement;
ballX = window.width - 24;
} else {
// Missed it
playerOneScore ++;
serve();
}
}
// Draw the paddles
painter.outlineColor = Color.black;
painter.drawLine(Point(16, playerOnePosition), Point(16, playerOnePosition + paddleHeight));
painter.drawLine(Point(window.width - 16, playerTwoPosition), Point(window.width - 16, playerTwoPosition + paddleHeight));
// Draw the ball
painter.fillColor = Color.red;
painter.outlineColor = Color.yellow;
painter.drawEllipse(Point(ballX - 8, ballY - 8), Point(ballX + 7, ballY + 7));
// Draw the score
painter.outlineColor = Color.blue;
import std.conv;
painter.drawText(Point(64, 4), to!string(playerOneScore));
painter.drawText(Point(window.width - 64, 4), to!string(playerTwoScore));
},
delegate (KeyEvent event) {
// Player 1's controls are the arrow keys on the keyboard
if(event.key == Key.Down)
playerOneMovement = event.pressed ? paddleMovementSpeed : 0;
if(event.key == Key.Up)
playerOneMovement = event.pressed ? -paddleMovementSpeed : 0;
},
delegate (MouseEvent event) {
// Player 2's controls are mouse movement while the left button is held down
if(event.type == MouseEventType.motion && (event.modifierState & ModifierState.leftButtonDown)) {
if(event.dy > 0)
playerTwoMovement = paddleMovementSpeed;
else if(event.dy < 0)
playerTwoMovement = -paddleMovementSpeed;
} else {
playerTwoMovement = 0;
}
}
);
}
}
/++ $(H3 $(ID example-minesweeper) Minesweeper)
This minesweeper demo shows how we can implement another classic
game with simpledisplay and shows some mouse input and basic output
code.
+/
version(demos)
unittest {
import arsd.simpledisplay;
enum GameSquare {
mine = 0,
clear,
m1, m2, m3, m4, m5, m6, m7, m8
}
enum UserSquare {
unknown,
revealed,
flagged,
questioned
}
enum GameState {
inProgress,
lose,
win
}
GameSquare[] board;
UserSquare[] userState;
GameState gameState;
int boardWidth;
int boardHeight;
bool isMine(int x, int y) {
if(x < 0 || y < 0 || x >= boardWidth || y >= boardHeight)
return false;
return board[y * boardWidth + x] == GameSquare.mine;
}
GameState reveal(int x, int y) {
if(board[y * boardWidth + x] == GameSquare.clear) {
floodFill(userState, boardWidth, boardHeight,
UserSquare.unknown, UserSquare.revealed,
x, y,
(x, y) {
if(board[y * boardWidth + x] == GameSquare.clear)
return true;
else {
userState[y * boardWidth + x] = UserSquare.revealed;
return false;
}
});
} else {
userState[y * boardWidth + x] = UserSquare.revealed;
if(isMine(x, y))
return GameState.lose;
}
foreach(state; userState) {
if(state == UserSquare.unknown || state == UserSquare.questioned)
return GameState.inProgress;
}
return GameState.win;
}
void initializeBoard(int width, int height, int numberOfMines) {
boardWidth = width;
boardHeight = height;
board.length = width * height;
userState.length = width * height;
userState[] = UserSquare.unknown;
import std.algorithm, std.random, std.range;
board[] = GameSquare.clear;
foreach(minePosition; randomSample(iota(0, board.length), numberOfMines))
board[minePosition] = GameSquare.mine;
int x;
int y;
foreach(idx, ref square; board) {
if(square == GameSquare.clear) {
int danger = 0;
danger += isMine(x-1, y-1)?1:0;
danger += isMine(x-1, y)?1:0;
danger += isMine(x-1, y+1)?1:0;
danger += isMine(x, y-1)?1:0;
danger += isMine(x, y+1)?1:0;
danger += isMine(x+1, y-1)?1:0;
danger += isMine(x+1, y)?1:0;
danger += isMine(x+1, y+1)?1:0;
square = cast(GameSquare) (danger + 1);
}
x++;
if(x == width) {
x = 0;
y++;
}
}
}
void redraw(SimpleWindow window) {
import std.conv;
auto painter = window.draw();
painter.clear();
final switch(gameState) with(GameState) {
case inProgress:
break;
case win:
painter.fillColor = Color.green;
painter.drawRectangle(Point(0, 0), window.width, window.height);
return;
case lose:
painter.fillColor = Color.red;
painter.drawRectangle(Point(0, 0), window.width, window.height);
return;
}
int x = 0;
int y = 0;
foreach(idx, square; board) {
auto state = userState[idx];
final switch(state) with(UserSquare) {
case unknown:
painter.outlineColor = Color.black;
painter.fillColor = Color(128,128,128);
painter.drawRectangle(
Point(x * 20, y * 20),
20, 20
);
break;
case revealed:
if(square == GameSquare.clear) {
painter.outlineColor = Color.white;
painter.fillColor = Color.white;
painter.drawRectangle(
Point(x * 20, y * 20),
20, 20
);
} else {
painter.outlineColor = Color.black;
painter.fillColor = Color.white;
painter.drawText(
Point(x * 20, y * 20),
to!string(square)[1..2],
Point(x * 20 + 20, y * 20 + 20),
TextAlignment.Center | TextAlignment.VerticalCenter);
}
break;
case flagged:
painter.outlineColor = Color.black;
painter.fillColor = Color.red;
painter.drawRectangle(
Point(x * 20, y * 20),
20, 20
);
break;
case questioned:
painter.outlineColor = Color.black;
painter.fillColor = Color.yellow;
painter.drawRectangle(
Point(x * 20, y * 20),
20, 20
);
break;
}
x++;
if(x == boardWidth) {
x = 0;
y++;
}
}
}
void main() {
auto window = new SimpleWindow(200, 200);
initializeBoard(10, 10, 10);
redraw(window);
window.eventLoop(0,
delegate (MouseEvent me) {
if(me.type != MouseEventType.buttonPressed)
return;
auto x = me.x / 20;
auto y = me.y / 20;
if(x >= 0 && x < boardWidth && y >= 0 && y < boardHeight) {
if(me.button == MouseButton.left) {
gameState = reveal(x, y);
} else {
userState[y*boardWidth+x] = UserSquare.flagged;
}
redraw(window);
}
}
);
}
}
/*
version(OSX) {
version=without_opengl;
version=allow_unimplemented_features;
version=OSXCocoa;
pragma(linkerDirective, "-framework Cocoa");
}
*/
version(without_opengl) {
enum SdpyIsUsingIVGLBinds = false;
} else /*version(Posix)*/ {
static if (__traits(compiles, (){import iv.glbinds;})) {
enum SdpyIsUsingIVGLBinds = true;
public import iv.glbinds;
//pragma(msg, "SDPY: using iv.glbinds");
} else {
enum SdpyIsUsingIVGLBinds = false;
}
//} else {
// enum SdpyIsUsingIVGLBinds = false;
}
version(Windows) {
//import core.sys.windows.windows;
import core.sys.windows.winnls;
import core.sys.windows.windef;
import core.sys.windows.basetyps;
import core.sys.windows.winbase;
import core.sys.windows.winuser;
import core.sys.windows.shellapi;
import core.sys.windows.wingdi;
static import gdi = core.sys.windows.wingdi; // so i
pragma(lib, "gdi32");
pragma(lib, "user32");
// for AlphaBlend... a breaking change....
version(CRuntime_DigitalMars) { } else
pragma(lib, "msimg32");
} else version (linux) {
//k8: this is hack for rdmd. sorry.
static import core.sys.linux.epoll;
static import core.sys.linux.timerfd;
}
// FIXME: icons on Windows don't look quite right, I think the transparency mask is off.
// http://wiki.dlang.org/Simpledisplay.d
// see : http://www.sbin.org/doc/Xlib/chapt_09.html section on Keyboard Preferences re: scroll lock led
// Cool stuff: I want right alt and scroll lock to do different stuff for personal use. maybe even right ctrl
// but can i control the scroll lock led
// Note: if you are using Image on X, you might want to do:
/*
static if(UsingSimpledisplayX11) {
if(!Image.impl.xshmAvailable) {
// the images will use the slower XPutImage, you might
// want to consider an alternative method to get better speed
}
}
If the shared memory extension is available though, simpledisplay uses it
for a significant speed boost whenever you draw large Images.
*/
// CHANGE FROM LAST VERSION: the window background is no longer fixed, so you might want to fill the screen with a particular color before drawing.
// WARNING: if you are using with_eventloop, don't forget to call XFlush(XDisplayConnection.get()); before calling loop()!
/*
Biggest FIXME:
make sure the key event numbers match between X and Windows OR provide symbolic constants on each system
clean up opengl contexts when their windows close
fix resizing the bitmaps/pixmaps
*/
// BTW on Windows:
// -L/SUBSYSTEM:WINDOWS:5.0
// to dmd will make a nice windows binary w/o a console if you want that.
/*
Stuff to add:
use multibyte functions everywhere we can
OpenGL windows
more event stuff
extremely basic windows w/ no decoration for tooltips, splash screens, etc.
resizeEvent
and make the windows non-resizable by default,
or perhaps stretched (if I can find something in X like StretchBlt)
take a screenshot function!
Pens and brushes?
Maybe a global event loop?
Mouse deltas
Key items
*/
/*
From MSDN:
You can also use the GET_X_LPARAM or GET_Y_LPARAM macro to extract the x- or y-coordinate.
Important Do not use the LOWORD or HIWORD macros to extract the x- and y- coordinates of the cursor position because these macros return incorrect results on systems with multiple monitors. Systems with multiple monitors can have negative x- and y- coordinates, and LOWORD and HIWORD treat the coordinates as unsigned quantities.
*/
version(linux) {
version = X11;
version(without_libnotify) {
// we cool
}
else
version = libnotify;
}
version(libnotify) {
pragma(lib, "dl");
import core.sys.posix.dlfcn;
void delegate()[int] libnotify_action_delegates;
int libnotify_action_delegates_count;
extern(C) static void libnotify_action_callback_sdpy(void* notification, char* action, void* user_data) {
auto idx = cast(int) user_data;
if(auto dgptr = idx in libnotify_action_delegates) {
(*dgptr)();
libnotify_action_delegates.remove(idx);
}
}
struct C_DynamicLibrary {
void* handle;
this(string name) {
handle = dlopen((name ~ "\0").ptr, RTLD_NOW);
if(handle is null)
throw new Exception("dlopen");
}
void close() {
dlclose(handle);
}
~this() {
// close
}
// FIXME: this looks up by name every time....
template call(string func, Ret, Args...) {
extern(C) Ret function(Args) fptr;
typeof(fptr) call() {
fptr = cast(typeof(fptr)) dlsym(handle, func);
return fptr;
}
}
}
C_DynamicLibrary* libnotify;
}
version(OSX) {
version(OSXCocoa) {}
else { version = X11; }
}
//version = OSXCocoa; // this was written by KennyTM
version(FreeBSD)
version = X11;
version(Solaris)
version = X11;
version(X11) {
version(without_xft) {}
else version=with_xft;
}
void featureNotImplemented()() {
version(allow_unimplemented_features)
throw new NotYetImplementedException();
else
static assert(0);
}
// these are so the static asserts don't trigger unless you want to
// add support to it for an OS
version(Windows)
version = with_timer;
version(linux)
version = with_timer;
version(with_timer)
enum bool SimpledisplayTimerAvailable = true;
else
enum bool SimpledisplayTimerAvailable = false;
/// If you have to get down and dirty with implementation details, this helps figure out if Windows is available you can `static if(UsingSimpledisplayWindows) ...` more reliably than `version()` because `version` is module-local.
version(Windows)
enum bool UsingSimpledisplayWindows = true;
else
enum bool UsingSimpledisplayWindows = false;
/// If you have to get down and dirty with implementation details, this helps figure out if X is available you can `static if(UsingSimpledisplayX11) ...` more reliably than `version()` because `version` is module-local.
version(X11)
enum bool UsingSimpledisplayX11 = true;
else
enum bool UsingSimpledisplayX11 = false;
/// If you have to get down and dirty with implementation details, this helps figure out if Cocoa is available you can `static if(UsingSimpledisplayCocoa) ...` more reliably than `version()` because `version` is module-local.
version(OSXCocoa)
enum bool UsingSimpledisplayCocoa = true;
else
enum bool UsingSimpledisplayCocoa = false;
/// Does this platform support multiple windows? If not, trying to create another will cause it to throw an exception.
version(Windows)
enum multipleWindowsSupported = true;
else version(X11)
enum multipleWindowsSupported = true;
else version(OSXCocoa)
enum multipleWindowsSupported = true;
else
static assert(0);
version(without_opengl)
enum bool OpenGlEnabled = false;
else
enum bool OpenGlEnabled = true;
/++
Adds the necessary pragmas to your application to use the Windows gui subsystem.
If you mix this in above your `main` function, you no longer need to use the linker
flags explicitly. It does the necessary version blocks for various compilers and runtimes.
It does nothing if not compiling for Windows, so you need not version it out yourself.
Please note that Windows gui subsystem applications must NOT use std.stdio's stdout and
stderr writeln. It will fail and throw an exception.
This will NOT work with plain `dmd` on Windows; you must use `dmd -m32mscoff` or `dmd -m64`.
History:
Added November 24, 2021 (dub v10.4)
+/
mixin template EnableWindowsSubsystem() {
version(Windows)
version(CRuntime_Microsoft) {
pragma(linkerDirective, "/subsystem:windows");
version(LDC)
pragma(linkerDirective, "/entry:wmainCRTStartup");
else
pragma(linkerDirective, "/entry:mainCRTStartup");
}
}
/++
After selecting a type from [WindowTypes], you may further customize
its behavior by setting one or more of these flags.
The different window types have different meanings of `normal`. If the
window type already is a good match for what you want to do, you should
just use [WindowFlags.normal], the default, which will do the right thing
for your users.
The window flags will not always be honored by the operating system
and window managers; they are hints, not commands.
+/
enum WindowFlags : int {
normal = 0, ///
skipTaskbar = 1, ///
alwaysOnTop = 2, ///
alwaysOnBottom = 4, ///
cannotBeActivated = 8, ///
alwaysRequestMouseMotionEvents = 16, /// By default, simpledisplay will attempt to optimize mouse motion event reporting when it detects a remote connection, causing them to only be issued if input is grabbed (see: [SimpleWindow.grabInput]). This means doing hover effects and mouse game control on a remote X connection may not work right. Include this flag to override this optimization and always request the motion events. However btw, if you are doing mouse game control, you probably want to grab input anyway, and hover events are usually expendable! So think before you use this flag.
extraComposite = 32, /// On windows this will make this a layered windows (not supported for child windows before windows 8) to support transparency and improve animation performance.
/++
Sets the window as a short-lived child of its parent, but unlike an ordinary child,
it is still a top-level window. This should NOT be set separately for most window types.
A transient window will not keep the application open if its main window closes.
$(PITFALL This may not be correctly implemented and its behavior is subject to change.)
From the ICCM:
$(BLOCKQUOTE
It is important not to confuse WM_TRANSIENT_FOR with override-redirect. WM_TRANSIENT_FOR should be used in those cases where the pointer is not grabbed while the window is mapped (in other words, if other windows are allowed to be active while the transient is up). If other windows must be prevented from processing input (for example, when implementing pop-up menus), use override-redirect and grab the pointer while the window is mapped.
$(CITE https://tronche.com/gui/x/icccm/sec-4.html)
)
So if you are using a window type that already describes this like [WindowTypes.dropdownMenu] etc., you should not use this flag.
History:
Added February 23, 2021 but not yet stabilized.
+/
transient = 64,
dontAutoShow = 0x1000_0000, /// Don't automatically show window after creation; you will have to call `show()` manually.
}
/++
When creating a window, you can pass a type to SimpleWindow's constructor,
then further customize the window by changing `WindowFlags`.
You should mostly only need [normal], [undecorated], and [eventOnly] for normal
use. The others are there to build a foundation for a higher level GUI toolkit,
but are themselves not as high level as you might think from their names.
This list is based on the EMWH spec for X11.
http://standards.freedesktop.org/wm-spec/1.4/ar01s05.html#idm139704063786896
+/
enum WindowTypes : int {
/// An ordinary application window.
normal,
/// A generic window without a title bar or border. You can draw on the entire area of the screen it takes up and use it as you wish. Remember that users don't really expect these though, so don't use it where a window of any other type is appropriate.
undecorated,
/// A window that doesn't actually display on screen. You can use it for cases where you need a dummy window handle to communicate with or something.
eventOnly,
/// A drop down menu, such as from a menu bar
dropdownMenu,
/// A popup menu, such as from a right click
popupMenu,
/// A popup bubble notification
notification,
/*
menu, /// a tearable menu bar
splashScreen, /// a loading splash screen for your application
tooltip, /// A tiny window showing temporary help text or something.
comboBoxDropdown,
dialog,
toolbar
*/
/// a child nested inside the parent. You must pass a parent window to the ctor
nestedChild,
}
private __gshared ushort sdpyOpenGLContextVersion = 0; // default: use legacy call
private __gshared bool sdpyOpenGLContextCompatible = true; // default: allow "deprecated" features
private __gshared char* sdpyWindowClassStr = null;
private __gshared bool sdpyOpenGLContextAllowFallback = false;
/**
Set OpenGL context version to use. This has no effect on non-OpenGL windows.
You may want to change context version if you want to use advanced shaders or
other modern OpenGL techinques. This setting doesn't affect already created
windows. You may use version 2.1 as your default, which should be supported
by any box since 2006, so seems to be a reasonable choice.
Note that by default version is set to `0`, which forces SimpleDisplay to use
old context creation code without any version specified. This is the safest
way to init OpenGL, but it may not give you access to advanced features.
See available OpenGL versions here: https://en.wikipedia.org/wiki/OpenGL
*/
void setOpenGLContextVersion() (ubyte hi, ubyte lo) { sdpyOpenGLContextVersion = cast(ushort)(hi<<8|lo); }
/**
Set OpenGL context mode. Modern (3.0+) OpenGL versions deprecated old fixed
pipeline functions, and without "compatible" mode you won't be able to use
your old non-shader-based code with such contexts. By default SimpleDisplay
creates compatible context, so you can gradually upgrade your OpenGL code if
you want to (or leave it as is, as it should "just work").
*/
@property void openGLContextCompatible() (bool v) { sdpyOpenGLContextCompatible = v; }
/**
Set to `true` to allow creating OpenGL context with lower version than requested
instead of throwing. If fallback was activated (or legacy OpenGL was requested),
`openGLContextFallbackActivated()` will return `true`.
*/
@property void openGLContextAllowFallback() (bool v) { sdpyOpenGLContextAllowFallback = v; }
/**
After creating OpenGL window, you can check this to see if you got only "legacy" OpenGL context.
*/
@property bool openGLContextFallbackActivated() () { return (sdpyOpenGLContextVersion == 0); }
/**
Set window class name for all following `new SimpleWindow()` calls.
WARNING! For Windows, you should set your class name before creating any
window, and NEVER change it after that!
*/
void sdpyWindowClass (const(char)[] v) {
import core.stdc.stdlib : realloc;
if (v.length == 0) v = "SimpleDisplayWindow";
sdpyWindowClassStr = cast(char*)realloc(sdpyWindowClassStr, v.length+1);
if (sdpyWindowClassStr is null) return; // oops
sdpyWindowClassStr[0..v.length+1] = 0;
sdpyWindowClassStr[0..v.length] = v[];
}
/**
Get current window class name.
*/
string sdpyWindowClass () {
if (sdpyWindowClassStr is null) return null;
foreach (immutable idx; 0..size_t.max-1) {
if (sdpyWindowClassStr[idx] == 0) return sdpyWindowClassStr[0..idx].idup;
}
return null;
}
/++
Returns the DPI of the default monitor. [0] is width, [1] is height (they are usually the same though). You may wish to round the numbers off.
If you want per-monitor dpi values, check [SimpleWindow.actualDpi], but you can fall back to this if it returns 0.
+/
float[2] getDpi() {
float[2] dpi;
version(Windows) {
HDC screen = GetDC(null);
dpi[0] = GetDeviceCaps(screen, LOGPIXELSX);
dpi[1] = GetDeviceCaps(screen, LOGPIXELSY);
} else version(X11) {
auto display = XDisplayConnection.get;
auto screen = DefaultScreen(display);
void fallback() {
// 25.4 millimeters in an inch...
dpi[0] = cast(float) DisplayWidth(display, screen) / DisplayWidthMM(display, screen) * 25.4;
dpi[1] = cast(float) DisplayHeight(display, screen) / DisplayHeightMM(display, screen) * 25.4;
}
char* resourceString = XResourceManagerString(display);
XrmInitialize();
if (resourceString) {
auto db = XrmGetStringDatabase(resourceString);
XrmValue value;
char* type;
if (XrmGetResource(db, "Xft.dpi", "String", &type, &value) == true) {
if (value.addr) {
import core.stdc.stdlib;
dpi[0] = atof(cast(char*) value.addr);
dpi[1] = dpi[0];
} else {
fallback();
}
} else {
fallback();
}
} else {
fallback();
}
}
return dpi;
}
/++
Implementation used by [SimpleWindow.takeScreenshot].
Params:
handle = the native window handle. If `NativeWindowHandle.init`, it will attempt to get the whole screen.
width = the width of the image you wish to capture. If 0, it will attempt to capture the full width of the target.
height = the height of the image you wish to capture. If 0, it will attempt to capture the full height of the target.
x = the x-offset of the image to capture, from the left.
y = the y-offset of the image to capture, from the top.
History:
Added on March 14, 2021
Documented public on September 23, 2021 with full support for null params (dub 10.3)
+/
TrueColorImage trueColorImageFromNativeHandle(NativeWindowHandle handle, int width = 0, int height = 0, int x = 0, int y = 0) {
TrueColorImage got;
version(X11) {
auto display = XDisplayConnection.get;
if(handle == 0)
handle = RootWindow(display, DefaultScreen(display));
if(width == 0 || height == 0) {
Window root;
int xpos, ypos;
uint widthret, heightret, borderret, depthret;
XGetGeometry(display, handle, &root, &xpos, &ypos, &widthret, &heightret, &borderret, &depthret);
if(width == 0)
width = widthret;
if(height == 0)
height = heightret;
}
auto image = XGetImage(display, handle, x, y, width, height, (cast(c_ulong) ~0) /*AllPlanes*/, ImageFormat.ZPixmap);
// https://github.com/adamdruppe/arsd/issues/98
auto i = new Image(image);
got = i.toTrueColorImage();
XDestroyImage(image);
} else version(Windows) {
auto hdc = GetDC(handle);
scope(exit) ReleaseDC(handle, hdc);
if(width == 0 || height == 0) {
BITMAP bmHeader;
auto bm = GetCurrentObject(hdc, OBJ_BITMAP);
GetObject(bm, BITMAP.sizeof, &bmHeader);
if(width == 0)
width = bmHeader.bmWidth;
if(height == 0)
height = bmHeader.bmHeight;
}
auto i = new Image(width, height);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = SelectObject(hdcMem, i.handle);
BitBlt(hdcMem, x, y, width, height, hdc, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
got = i.toTrueColorImage();
} else featureNotImplemented();
return got;
}
version(Windows) extern(Windows) private alias SetProcessDpiAwarenessContext_t = BOOL function(HANDLE);
version(Windows) extern(Windows) private __gshared UINT function(HWND) GetDpiForWindow;
version(Windows) extern(Windows) private __gshared BOOL function(UINT, UINT, PVOID, UINT, UINT) SystemParametersInfoForDpi;
version(Windows)
shared static this() {
auto lib = LoadLibrary("User32.dll");
if(lib is null)
return;
//scope(exit)
//FreeLibrary(lib);
SetProcessDpiAwarenessContext_t SetProcessDpiAwarenessContext = cast(SetProcessDpiAwarenessContext_t) GetProcAddress(lib, "SetProcessDpiAwarenessContext");
if(SetProcessDpiAwarenessContext is null)
return;
enum DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = cast(HANDLE) -4;
if(!SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)) {
//writeln(GetLastError());
}
GetDpiForWindow = cast(typeof(GetDpiForWindow)) GetProcAddress(lib, "GetDpiForWindow");
SystemParametersInfoForDpi = cast(typeof(SystemParametersInfoForDpi)) GetProcAddress(lib, "SystemParametersInfoForDpi");
}
/++
Blocking mode for event loop calls associated with a window instance.
History:
Added December 8, 2021 (dub v10.5). Prior to that, all calls to
`window.eventLoop` were the same as calls to `EventLoop.get.run`; that
is, all would block until the application quit.
That behavior can still be achieved here with `untilApplicationQuits`,
or explicitly calling the top-level `EventLoop.get.run` function.
+/
enum BlockingMode {
/++
The event loop call will block until the whole application is ready
to quit if it is the only one running, but if it is nested inside
another one, it will only block until the window you're calling it on
closes.
+/
automatic = 0x00,
/++
The event loop call will only return when the whole application
is ready to quit. This usually means all windows have been closed.
This is appropriate for your main application event loop.
+/
untilApplicationQuits = 0x01,
/++
The event loop will return when the window you're calling it on
closes. If there are other windows still open, they may be destroyed
unless you have another event loop running later.
This might be appropriate for a modal dialog box loop. Remember that
other windows are still processing input though, so you can end up
with a lengthy call stack if this happens in a loop, similar to a
recursive function (well, it literally is a recursive function, just
not an obvious looking one).
+/
untilWindowCloses = 0x02,
/++
If an event loop is already running, this call will immediately
return, allowing the existing loop to handle it. If not, this call
will block until the condition you bitwise-or into the flag.
The default is to block until the application quits, same as with
the `automatic` setting (since if it were nested, which triggers until
window closes in automatic, this flag would instead not block at all),
but if you used `BlockingMode.onlyIfNotNested | BlockingMode.untilWindowCloses`,
it will only nest until the window closes. You might want that if you are
going to open two windows simultaneously and want closing just one of them
to trigger the event loop return.
+/
onlyIfNotNested = 0x10,
}
/++
The flagship window class.
SimpleWindow tries to make ordinary windows very easy to create and use without locking you
out of more advanced or complex features of the underlying windowing system.
For many applications, you can simply call `new SimpleWindow(some_width, some_height, "some title")`
and get a suitable window to work with.
From there, you can opt into additional features, like custom resizability and OpenGL support
with the next two constructor arguments. Or, if you need even more, you can set a window type
and customization flags with the final two constructor arguments.
If none of that works for you, you can also create a window using native function calls, then
wrap the window in a SimpleWindow instance by calling `new SimpleWindow(native_handle)`. Remember,
though, if you do this, managing the window is still your own responsibility! Notably, you
will need to destroy it yourself.
+/
class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
/++
Copies the window's current state into a [TrueColorImage].
Be warned: this can be a very slow operation
History:
Actually implemented on March 14, 2021
+/
TrueColorImage takeScreenshot() {
version(Windows)
return trueColorImageFromNativeHandle(impl.hwnd, width, height);
else version(OSXCocoa)
throw new NotYetImplementedException();
else
return trueColorImageFromNativeHandle(impl.window, width, height);
}
/++
Returns the actual physical DPI for the window on its current display monitor. If the window
straddles monitors, it will return the value of one or the other in a platform-defined manner.
Please note this function may return zero if it doesn't know the answer!
On Windows, it returns the dpi per monitor if the operating system supports it (Windows 10),
or a system dpi value if not, which will live-update if the OS supports it (Windows 8 and up).
On X, it reads the xrandr extension to determine monitor positions and sizes. On some systems,
this is not provided, meaning it will return 0. Otherwise, it will determine which monitor the
window primarily resides on by checking the center point of the window against the monitor map.
Returns:
0 if unknown. Otherwise, a rounded value of dots per inch reported by the monitor. It
assumes the X and Y dpi are the same.
History:
Added November 26, 2021 (dub v10.4)
Bugs:
Probably plenty. I haven't done a lot of tests on this. I know it doesn't
See_Also:
[getDpi] gives the value provided for the default monitor. Not necessarily the same
as this since the window many be on a different monitor, but it is a reasonable fallback
to use if `actualDpi` returns 0.
[onDpiChanged] is changed when `actualDpi` has changed.
+/
int actualDpi() {
if(!actualDpiLoadAttempted) {
// FIXME: do the actual monitor we are on
// and on X this is a good chance to load the monitor map.
version(Windows) {
if(GetDpiForWindow)
actualDpi_ = GetDpiForWindow(impl.hwnd);
} else version(X11) {
if(!xRandrInfoLoadAttemped) {
xRandrInfoLoadAttemped = true;
if(!XRandrLibrary.attempted) {
XRandrLibrary.loadDynamicLibrary();
}
if(XRandrLibrary.loadSuccessful) {
auto display = XDisplayConnection.get;
int scratch;
int major, minor;
if(!XRRQueryExtension(display, &xrrEventBase, &scratch))
goto fallback;
XRRQueryVersion(display, &major, &minor);
if(major <= 1 && minor < 5)
goto fallback;
int count;
XRRMonitorInfo *monitors = XRRGetMonitors(display, RootWindow(display, DefaultScreen(display)), true, &count);
if(monitors is null)
goto fallback;
scope(exit) XRRFreeMonitors(monitors);
MonitorInfo.info = MonitorInfo.info[0 .. 0];
MonitorInfo.info.assumeSafeAppend();
foreach(monitor; monitors[0 .. count]) {
if(monitor.mwidth == 0 || monitor.mheight == 0)
// unknown physical size, just guess 96 to avoid divide by zero
MonitorInfo.info ~= MonitorInfo(
Rectangle(Point(monitor.x, monitor.y), Size(monitor.width, monitor.height)),
Size(monitor.mwidth, monitor.mheight),
96
);
else
// and actual thing
MonitorInfo.info ~= MonitorInfo(
Rectangle(Point(monitor.x, monitor.y), Size(monitor.width, monitor.height)),
Size(monitor.mwidth, monitor.mheight),
minInternal(
// millimeter to int then rounding up.
cast(int)(monitor.width * 25.4 / monitor.mwidth + 0.5),
cast(int)(monitor.height * 25.4 / monitor.mheight + 0.5)
)
);
}
//import std.stdio; writeln("Here", MonitorInfo.info);
}
}
if(XRandrLibrary.loadSuccessful) {
updateActualDpi(true);
//import std.stdio; writeln("updated");
if(!requestedInput) {
// this is what requests live updates should the configuration change
// each time you select input, it sends an initial event, so very important
// to not get into a loop of selecting input, getting event, updating data,
// and reselecting input...
requestedInput = true;
XRRSelectInput(display, impl.window, RRScreenChangeNotifyMask);
//import std.stdio; writeln("requested input");
}
} else {
fallback:
// make sure we disable events that aren't coming
xrrEventBase = -1;
// best guess...
actualDpi_ = cast(int) getDpi()[0];
}
}
actualDpiLoadAttempted = true;
}
return actualDpi_;
}
private int actualDpi_;
private bool actualDpiLoadAttempted;
version(X11) private {
bool requestedInput;
static bool xRandrInfoLoadAttemped;
struct MonitorInfo {
Rectangle position;
Size size;
int dpi;
static MonitorInfo[] info;
}
int screenPositionX;
int screenPositionY;
void updateActualDpi(bool loadingNow = false) {
if(!loadingNow && !actualDpiLoadAttempted)
actualDpi(); // just to make it do the load
foreach(idx, m; MonitorInfo.info) {
if(m.position.contains(Point(screenPositionX + this.width / 2, screenPositionY + this.height / 2))) {
bool changed = actualDpi_ && actualDpi_ != m.dpi;
actualDpi_ = m.dpi;
//import std.stdio; writeln("monitor ", idx);
if(changed && onDpiChanged)
onDpiChanged();
break;
}
}
}
}
/++
Sent when the window is moved to a new DPI context, for example, when it is dragged between monitors
or if the window is moved to a new remote connection or a monitor is hot-swapped.
History:
Added November 26, 2021 (dub v10.4)
See_Also:
[actualDpi]
+/
void delegate() onDpiChanged;
version(X11) {
void recreateAfterDisconnect() {
if(!stateDiscarded) return;
if(_parent !is null && _parent.stateDiscarded)
_parent.recreateAfterDisconnect();
bool wasHidden = hidden;
activeScreenPainter = null; // should already be done but just to confirm
actualDpi_ = 0;
actualDpiLoadAttempted = false;
xRandrInfoLoadAttemped = false;
impl.createWindow(_width, _height, _title, openglMode, _parent);
if(auto dh = dropHandler) {
dropHandler = null;
enableDragAndDrop(this, dh);
}
if(recreateAdditionalConnectionState)
recreateAdditionalConnectionState();
hidden = wasHidden;
stateDiscarded = false;
}
bool stateDiscarded;
void discardConnectionState() {
if(XDisplayConnection.display)
impl.dispose(); // if display is already null, it is hopeless to try to destroy stuff on it anyway
if(discardAdditionalConnectionState)
discardAdditionalConnectionState();
stateDiscarded = true;
}
void delegate() discardAdditionalConnectionState;
void delegate() recreateAdditionalConnectionState;
}
private DropHandler dropHandler;
SimpleWindow _parent;
bool beingOpenKeepsAppOpen = true;
/++
This creates a window with the given options. The window will be visible and able to receive input as soon as you start your event loop. You may draw on it immediately after creating the window, without needing to wait for the event loop to start if you want.
The constructor tries to have sane default arguments, so for many cases, you only need to provide a few of them.
Params:
width = the width of the window's client area, in pixels
height = the height of the window's client area, in pixels
title = the title of the window (seen in the title bar, taskbar, etc.). You can change it after construction with the [SimpleWindow.title] property.
opengl = [OpenGlOptions] are yes and no. If yes, it creates an OpenGL context on the window.
resizable = [Resizability] has three options:
$(P `allowResizing`, which allows the window to be resized by the user. The `windowResized` delegate will be called when the size is changed.)
$(P `fixedSize` will not allow the user to resize the window.)
$(P `automaticallyScaleIfPossible` will allow the user to resize, but will still present the original size to the API user. The contents you draw will be scaled to the size the user chose. If this scaling is not efficient, the window will be fixed size. The `windowResized` event handler will never be called. This is the default.)
windowType = The type of window you want to make.
customizationFlags = A way to make a window without a border, always on top, skip taskbar, and more. Do not use this if one of the pre-defined [WindowTypes], given in the `windowType` argument, is a good match for what you need.
parent = the parent window, if applicable. This makes the child window nested inside the parent unless you set [WindowFlags.transient], which makes it a top-level window merely owned by the "parent".
+/
this(int width = 640, int height = 480, string title = null, OpenGlOptions opengl = OpenGlOptions.no, Resizability resizable = Resizability.automaticallyScaleIfPossible, WindowTypes windowType = WindowTypes.normal, int customizationFlags = WindowFlags.normal, SimpleWindow parent = null) {
claimGuiThread();
version(sdpy_thread_checks) assert(thisIsGuiThread);
this._width = width;
this._height = height;
this.openglMode = opengl;
this.resizability = resizable;
this.windowType = windowType;
this.customizationFlags = customizationFlags;
this._title = (title is null ? "D Application" : title);
this._parent = parent;
impl.createWindow(width, height, this._title, opengl, parent);
if(windowType == WindowTypes.dropdownMenu || windowType == WindowTypes.popupMenu || windowType == WindowTypes.nestedChild || (customizationFlags & WindowFlags.transient))
beingOpenKeepsAppOpen = false;
}
/// ditto
this(int width, int height, string title, Resizability resizable, OpenGlOptions opengl = OpenGlOptions.no, WindowTypes windowType = WindowTypes.normal, int customizationFlags = WindowFlags.normal, SimpleWindow parent = null) {
this(width, height, title, opengl, resizable, windowType, customizationFlags, parent);
}
/// Same as above, except using the `Size` struct instead of separate width and height.
this(Size size, string title = null, OpenGlOptions opengl = OpenGlOptions.no, Resizability resizable = Resizability.automaticallyScaleIfPossible) {
this(size.width, size.height, title, opengl, resizable);
}
/// ditto
this(Size size, string title, Resizability resizable, OpenGlOptions opengl = OpenGlOptions.no) {
this(size, title, opengl, resizable);
}
/++
Creates a window based on the given [Image]. It's client area
width and height is equal to the image. (A window's client area
is the drawable space inside; it excludes the title bar, etc.)
Windows based on images will not be resizable and do not use OpenGL.
It will draw the image in upon creation, but this will be overwritten
upon any draws, including the initial window visible event.
You probably do not want to use this and it may be removed from
the library eventually, or I might change it to be a "permanent"
background image; one that is automatically drawn on it before any
other drawing event. idk.
+/
this(Image image, string title = null) {
this(image.width, image.height, title);
this.image = image;
}
/++
Wraps a native window handle with very little additional processing - notably no destruction
this is incomplete so don't use it for much right now. The purpose of this is to make native
windows created through the low level API (so you can use platform-specific options and
other details SimpleWindow does not expose) available to the event loop wrappers.
+/
this(NativeWindowHandle nativeWindow) {
version(Windows)
impl.hwnd = nativeWindow;
else version(X11) {
impl.window = nativeWindow;
if(nativeWindow)
display = XDisplayConnection.get(); // get initial display to not segfault
} else version(OSXCocoa)
throw new NotYetImplementedException();
else featureNotImplemented();
// FIXME: set the size correctly
_width = 1;
_height = 1;
if(nativeWindow)
nativeMapping[nativeWindow] = this;
beingOpenKeepsAppOpen = false;
if(nativeWindow)
CapableOfHandlingNativeEvent.nativeHandleMapping[nativeWindow] = this;
_suppressDestruction = true; // so it doesn't try to close
}
/// Experimental, do not use yet
/++
Grabs exclusive input from the user until you release it with
[releaseInputGrab].
Note: it is extremely rude to do this without good reason.
Reasons may include doing some kind of mouse drag operation
or popping up a temporary menu that should get events and will
be dismissed at ease by the user clicking away.
Params:
keyboard = do you want to grab keyboard input?
mouse = grab mouse input?
confine = confine the mouse cursor to inside this window?
History:
Prior to March 11, 2021, grabbing the keyboard would always also
set the X input focus. Now, it only focuses if it is a non-transient
window and otherwise manages the input direction internally.
This means spurious focus/blur events will no longer be sent and the
application will not steal focus from other applications (which the
window manager may have rejected anyway).
+/
void grabInput(bool keyboard = true, bool mouse = true, bool confine = false) {
static if(UsingSimpledisplayX11) {
XSync(XDisplayConnection.get, 0);
if(keyboard) {
if(isTransient && _parent) {
/*
FIXME:
setting the keyboard focus is not actually that helpful, what I more likely want
is the events from the parent window to be sent over here if we're transient.
*/
_parent.inputProxy = this;
} else {
XSetInputFocus(XDisplayConnection.get, this.impl.window, RevertToParent, CurrentTime);
}
}
if(mouse) {
if(auto res = XGrabPointer(XDisplayConnection.get, this.impl.window, false /* owner_events */,
EventMask.PointerMotionMask // FIXME: not efficient
| EventMask.ButtonPressMask
| EventMask.ButtonReleaseMask
/* event mask */, GrabMode.GrabModeAsync, GrabMode.GrabModeAsync, confine ? this.impl.window : None, None, CurrentTime)
)
{
XSync(XDisplayConnection.get, 0);
import core.stdc.stdio;
printf("Grab input failed %d\n", res);
//throw new Exception("Grab input failed");
} else {
// cool
}
}
} else version(Windows) {
// FIXME: keyboard?
SetCapture(impl.hwnd);
if(confine) {
RECT rcClip;
//RECT rcOldClip;
//GetClipCursor(&rcOldClip);
GetWindowRect(hwnd, &rcClip);
ClipCursor(&rcClip);
}
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
/++
Returns the native window.
History:
Added November 5, 2021 (dub v10.4). Prior to that, you'd have
to access it through the `impl` member (which is semi-supported
but platform specific and here it is simple enough to offer an accessor).
Bugs:
Not implemented outside Windows or X11.
+/
NativeWindowHandle nativeWindowHandle() {
version(X11)
return impl.window;
else version(Windows)
return impl.hwnd;
else
throw new NotYetImplementedException();
}
private bool isTransient() {
with(WindowTypes)
final switch(windowType) {
case normal, undecorated, eventOnly:
case nestedChild:
return (customizationFlags & WindowFlags.transient) ? true : false;
case dropdownMenu, popupMenu, notification:
return true;
}
}
private SimpleWindow inputProxy;
/++
Releases the grab acquired by [grabInput].
+/
void releaseInputGrab() {
static if(UsingSimpledisplayX11) {
XUngrabPointer(XDisplayConnection.get, CurrentTime);
if(_parent)
_parent.inputProxy = null;
} else version(Windows) {
ReleaseCapture();
ClipCursor(null);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
/++
Sets the input focus to this window.
You shouldn't call this very often - please let the user control the input focus.
+/
void focus() {
static if(UsingSimpledisplayX11) {
XSetInputFocus(XDisplayConnection.get, this.impl.window, RevertToParent, CurrentTime);
} else version(Windows) {
SetFocus(this.impl.hwnd);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
/++
Requests attention from the user for this window.
The typical result of this function is to change the color
of the taskbar icon, though it may be tweaked on specific
platforms.
It is meant to unobtrusively tell the user that something
relevant to them happened in the background and they should
check the window when they get a chance. Upon receiving the
keyboard focus, the window will automatically return to its
natural state.
If the window already has the keyboard focus, this function
may do nothing, because the user is presumed to already be
giving the window attention.
Implementation_note:
`requestAttention` uses the _NET_WM_STATE_DEMANDS_ATTENTION
atom on X11 and the FlashWindow function on Windows.
+/
void requestAttention() {
if(_focused)
return;
version(Windows) {
FLASHWINFO info;
info.cbSize = info.sizeof;
info.hwnd = impl.hwnd;
info.dwFlags = FLASHW_TRAY;
info.uCount = 1;
FlashWindowEx(&info);
} else version(X11) {
demandingAttention = true;
demandAttention(this, true);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
private bool _focused;
version(X11) private bool demandingAttention;
/// This will be called when WM wants to close your window (i.e. user clicked "close" icon, for example).
/// You'll have to call `close()` manually if you set this delegate.
void delegate () closeQuery;
/// This will be called when window visibility was changed.
void delegate (bool becomesVisible) visibilityChanged;
/// This will be called when window becomes visible for the first time.
/// You can do OpenGL initialization here. Note that in X11 you can't call
/// [setAsCurrentOpenGlContext] right after window creation, or X11 may
/// fail to send reparent and map events (hit that with proprietary NVidia drivers).
private bool _visibleForTheFirstTimeCalled;
void delegate () visibleForTheFirstTime;
/// Returns true if the window has been closed.
final @property bool closed() { return _closed; }
private final @property bool notClosed() { return !_closed; }
/// Returns true if the window is focused.
final @property bool focused() { return _focused; }
private bool _visible;
/// Returns true if the window is visible (mapped).
final @property bool visible() { return _visible; }
/// Closes the window. If there are no more open windows, the event loop will terminate.
void close() {
if (!_closed) {
runInGuiThread( {
if(_closed) return; // another thread got to it first. this isn't a big deal, it just means our message was queued
if (onClosing !is null) onClosing();
impl.closeWindow();
_closed = true;
} );
}
}
/++
`close` is one of the few methods that can be called from other threads. This `shared` overload reflects that.
History:
Overload added on March 7, 2021.
+/
void close() shared {
(cast() this).close();
}
/++
+/
void maximize() {
version(Windows)
ShowWindow(impl.hwnd, SW_MAXIMIZE);
else version(X11) {
setNetWmStateAtom(this.impl.window, GetAtom!("_NET_WM_STATE_MAXIMIZED_VERT", false)(XDisplayConnection.get), true, GetAtom!("_NET_WM_STATE_MAXIMIZED_HORZ", false)(XDisplayConnection.get));
// also note _NET_WM_STATE_FULLSCREEN
}
}
private bool _fullscreen;
/// not fully implemented but planned for a future release
void fullscreen(bool yes) {
version(X11)
setNetWmStateAtom(this.impl.window, GetAtom!("_NET_WM_STATE_FULLSCREEN", false)(XDisplayConnection.get), yes);
_fullscreen = yes;
}
bool fullscreen() {
return _fullscreen;
}
/++
Note: only implemented on Windows. No-op on other platforms. You may want to use [hide] instead.
+/
void minimize() {
version(Windows)
ShowWindow(impl.hwnd, SW_MINIMIZE);
//else version(X11)
//setNetWmStateAtom(this, GetAtom!("_NET_WM_STATE_MINIMIZED", false)(XDisplayConnection.get), true);
}
/// Alias for `hidden = false`
void show() {
hidden = false;
}
/// Alias for `hidden = true`
void hide() {
hidden = true;
}
/// Hide cursor when it enters the window.
void hideCursor() {
version(OSXCocoa) throw new NotYetImplementedException(); else
if (!_closed) impl.hideCursor();
}
/// Don't hide cursor when it enters the window.
void showCursor() {
version(OSXCocoa) throw new NotYetImplementedException(); else
if (!_closed) impl.showCursor();
}
/** "Warp" mouse pointer to coordinates relative to window top-left corner. Return "success" flag.
*
* Please remember that the cursor is a shared resource that should usually be left to the user's
* control. Try to think for other approaches before using this function.
*
* Note: "warping" pointer will not send any synthesised mouse events, so you probably doesn't want
* to use it to move mouse pointer to some active GUI area, for example, as your window won't
* receive "mouse moved here" event.
*/
bool warpMouse (int x, int y) {
version(X11) {
if (!_closed) { impl.warpMouse(x, y); return true; }
} else version(Windows) {
if (!_closed) {
POINT point;
point.x = x;
point.y = y;
if(ClientToScreen(impl.hwnd, &point)) {
SetCursorPos(point.x, point.y);
return true;
}
}
}
return false;
}
/// Send dummy window event to ping event loop. Required to process NotificationIcon on X11, for example.
void sendDummyEvent () {
version(X11) {
if (!_closed) { impl.sendDummyEvent(); }
}
}
/// Set window minimal size.
void setMinSize (int minwidth, int minheight) {
version(OSXCocoa) throw new NotYetImplementedException(); else
if (!_closed) impl.setMinSize(minwidth, minheight);
}
/// Set window maximal size.
void setMaxSize (int maxwidth, int maxheight) {
version(OSXCocoa) throw new NotYetImplementedException(); else
if (!_closed) impl.setMaxSize(maxwidth, maxheight);
}
/// Set window resize step (window size will be changed with the given granularity on supported platforms).
/// Currently only supported on X11.
void setResizeGranularity (int granx, int grany) {
version(OSXCocoa) throw new NotYetImplementedException(); else
if (!_closed) impl.setResizeGranularity(granx, grany);
}
/// Move window.
void move(int x, int y) {
version(OSXCocoa) throw new NotYetImplementedException(); else
if (!_closed) impl.move(x, y);
}
/// ditto
void move(Point p) {
version(OSXCocoa) throw new NotYetImplementedException(); else
if (!_closed) impl.move(p.x, p.y);
}
/++
Resize window.
Note that the width and height of the window are NOT instantly
updated - it waits for the window manager to approve the resize
request, which means you must return to the event loop before the
width and height are actually changed.
+/
void resize(int w, int h) {
if(!_closed && _fullscreen) fullscreen = false;
version(OSXCocoa) throw new NotYetImplementedException(); else
if (!_closed) impl.resize(w, h);
}
/// Move and resize window (this can be faster and more visually pleasant than doing it separately).
void moveResize (int x, int y, int w, int h) {
if(!_closed && _fullscreen) fullscreen = false;
version(OSXCocoa) throw new NotYetImplementedException(); else
if (!_closed) impl.moveResize(x, y, w, h);
}
private bool _hidden;
/// Returns true if the window is hidden.
final @property bool hidden() {
return _hidden;
}
/// Shows or hides the window based on the bool argument.
final @property void hidden(bool b) {
_hidden = b;
version(Windows) {
ShowWindow(impl.hwnd, b ? SW_HIDE : SW_SHOW);
} else version(X11) {
if(b)
//XUnmapWindow(impl.display, impl.window);
XWithdrawWindow(impl.display, impl.window, DefaultScreen(impl.display));
else
XMapWindow(impl.display, impl.window);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
/// Sets the window opacity. On X11 this requires a compositor to be running. On windows the WindowFlags.extraComposite must be set at window creation.
void opacity(double opacity) @property
in {
assert(opacity >= 0 && opacity <= 1);
} do {
version (Windows) {
impl.setOpacity(cast(ubyte)(255 * opacity));
} else version (X11) {
impl.setOpacity(cast(uint)(uint.max * opacity));
} else throw new NotYetImplementedException();
}
/++
Sets your event handlers, without entering the event loop. Useful if you
have multiple windows - set the handlers on each window, then only do
[eventLoop] on your main window or call `EventLoop.get.run();`.
This assigns the given handlers to [handleKeyEvent], [handleCharEvent],
[handlePulse], and [handleMouseEvent] automatically based on the provide
delegate signatures.
+/
void setEventHandlers(T...)(T eventHandlers) {
// FIXME: add more events
foreach(handler; eventHandlers) {
static if(__traits(compiles, handleKeyEvent = handler)) {
handleKeyEvent = handler;
} else static if(__traits(compiles, handleCharEvent = handler)) {
handleCharEvent = handler;
} else static if(__traits(compiles, handlePulse = handler)) {
handlePulse = handler;
} else static if(__traits(compiles, handleMouseEvent = handler)) {
handleMouseEvent = handler;
} else static assert(0, "I can't use this event handler " ~ typeof(handler).stringof ~ "\nHave you tried using the delegate keyword?");
}
}
/++
The event loop automatically returns when the window is closed
pulseTimeout is given in milliseconds. If pulseTimeout == 0, no
pulse timer is created. The event loop will block until an event
arrives or the pulse timer goes off.
The given `eventHandlers` are passed to [setEventHandlers], which in turn
assigns them to [handleKeyEvent], [handleCharEvent], [handlePulse], and
[handleMouseEvent], based on the signature of delegates you provide.
Give one with no parameters to set a timer pulse handler. Give one that
takes [KeyEvent] for a key handler, [MouseEvent], for a mouse handler,
and one that takes `dchar` for a char event handler. You can use as many
or as few handlers as you need for your application.
History:
The overload without `pulseTimeout` was added on December 8, 2021.
On December 9, 2021, the default blocking mode (which is now configurable
because [eventLoopWithBlockingMode] was added) switched from
[BlockingMode.untilApplicationQuits] over to [BlockingMode.automatic]. This
should almost never be noticeable to you since the typical simpledisplay
paradigm has been (and I still recommend) to have one `eventLoop` call.
See_Also:
[eventLoopWithBlockingMode]
+/
final int eventLoop(T...)(
long pulseTimeout, /// set to zero if you don't want a pulse.
T eventHandlers) /// delegate list like std.concurrency.receive
{
return eventLoopWithBlockingMode(BlockingMode.automatic, pulseTimeout, eventHandlers);
}
/// ditto
final int eventLoop(T...)(T eventHandlers) if(T.length == 0 || is(T[0] == delegate))
{
return eventLoopWithBlockingMode(BlockingMode.automatic, 0, eventHandlers);
}
/++
This is the function [eventLoop] forwards to. It, in turn, forwards to `EventLoop.get.run`.
History:
Added December 8, 2021 (dub v10.5)
Previously, this implementation was right inside [eventLoop], but when I wanted
to add the new [BlockingMode] parameter, the compiler got in a trouble loop so I
just renamed it instead of adding as an overload. Besides, the new name makes it
easier to remember the order and avoids ambiguity between two int-like params anyway.
See_Also:
[SimpleWindow.eventLoop], [EventLoop]
Bugs:
The blocking mode is not implemented on OSX Cocoa nor on the (deprecated) arsd.eventloop.
+/
final int eventLoopWithBlockingMode(T...)(
BlockingMode blockingMode, /// when you want this function to block until
long pulseTimeout, /// set to zero if you don't want a pulse.
T eventHandlers) /// delegate list like std.concurrency.receive
{
setEventHandlers(eventHandlers);
version(with_eventloop) {
// delegates event loop to my other module
version(X11)
XFlush(display);
import arsd.eventloop;
auto handle = setInterval(handlePulse, cast(int) pulseTimeout);
scope(exit) clearInterval(handle);
loop();
return 0;
} else version(OSXCocoa) {
// FIXME
if (handlePulse !is null && pulseTimeout != 0) {
timer = scheduledTimer(pulseTimeout*1e-3,
view, sel_registerName("simpledisplay_pulse"),
null, true);
}
setNeedsDisplay(view, true);
run(NSApp);
return 0;
} else {
EventLoop el = EventLoop(pulseTimeout, handlePulse);
if((blockingMode & BlockingMode.onlyIfNotNested) && el.impl.refcount > 1)
return 0;
return el.run(
((blockingMode & 0x0f) == BlockingMode.untilApplicationQuits) ?
null :
&this.notClosed
);
}
}
/++
This lets you draw on the window (or its backing buffer) using basic
2D primitives.
Be sure to call this in a limited scope because your changes will not
actually appear on the window until ScreenPainter's destructor runs.
Returns: an instance of [ScreenPainter], which has the drawing methods
on it to draw on this window.
Params:
manualInvalidations = if you set this to true, you will need to
set the invalid rectangle on the painter yourself. If false, it
assumes the whole window has been redrawn each time you draw.
Only invalidated rectangles are blitted back to the window when
the destructor runs. Doing this yourself can reduce flickering
of child windows.
History:
The `manualInvalidations` parameter overload was added on
December 30, 2021 (dub v10.5)
+/
ScreenPainter draw() {
return draw(false);
}
/// ditto
ScreenPainter draw(bool manualInvalidations) {
return impl.getPainter(manualInvalidations);
}
// This is here to implement the interface we use for various native handlers.
NativeEventHandler getNativeEventHandler() { return handleNativeEvent; }
// maps native window handles to SimpleWindow instances, if there are any
// you shouldn't need this, but it is public in case you do in a native event handler or something
public __gshared SimpleWindow[NativeWindowHandle] nativeMapping;
/// Width of the window's drawable client area, in pixels.
@scriptable
final @property int width() const pure nothrow @safe @nogc { return _width; }
/// Height of the window's drawable client area, in pixels.
@scriptable
final @property int height() const pure nothrow @safe @nogc { return _height; }
private int _width;
private int _height;
// HACK: making the best of some copy constructor woes with refcounting
private ScreenPainterImplementation* activeScreenPainter_;
protected ScreenPainterImplementation* activeScreenPainter() { return activeScreenPainter_; }
protected void activeScreenPainter(ScreenPainterImplementation* i) { activeScreenPainter_ = i; }
private OpenGlOptions openglMode;
private Resizability resizability;
private WindowTypes windowType;
private int customizationFlags;
/// `true` if OpenGL was initialized for this window.
@property bool isOpenGL () const pure nothrow @safe @nogc {
version(without_opengl)
return false;
else
return (openglMode == OpenGlOptions.yes);
}
@property Resizability resizingMode () const pure nothrow @safe @nogc { return resizability; } /// Original resizability.
@property WindowTypes type () const pure nothrow @safe @nogc { return windowType; } /// Original window type.
@property int customFlags () const pure nothrow @safe @nogc { return customizationFlags; } /// Original customization flags.
/// "Lock" this window handle, to do multithreaded synchronization. You probably won't need
/// to call this, as it's not recommended to share window between threads.
void mtLock () {
version(X11) {
XLockDisplay(this.display);
}
}
/// "Unlock" this window handle, to do multithreaded synchronization. You probably won't need
/// to call this, as it's not recommended to share window between threads.
void mtUnlock () {
version(X11) {
XUnlockDisplay(this.display);
}
}
/// Emit a beep to get user's attention.
void beep () {
version(X11) {
XBell(this.display, 100);
} else version(Windows) {
MessageBeep(0xFFFFFFFF);
}
}
version(without_opengl) {} else {
/// Put your code in here that you want to be drawn automatically when your window is uncovered. Set a handler here *before* entering your event loop any time you pass `OpenGlOptions.yes` to the constructor. Ideally, you will set this delegate immediately after constructing the `SimpleWindow`.
void delegate() redrawOpenGlScene;
/// This will allow you to change OpenGL vsync state.
final @property void vsync (bool wait) {
if (this._closed) return; // window may be closed, but timer is still firing; avoid GLXBadDrawable error
version(X11) {
setAsCurrentOpenGlContext();
glxSetVSync(display, impl.window, wait);
} else version(Windows) {
setAsCurrentOpenGlContext();
wglSetVSync(wait);
}
}
/// Set this to `false` if you don't need to do `glFinish()` after `swapOpenGlBuffers()`.
/// Note that at least NVidia proprietary driver may segfault if you will modify texture fast
/// enough without waiting 'em to finish their frame bussiness.
bool useGLFinish = true;
// FIXME: it should schedule it for the end of the current iteration of the event loop...
/// call this to invoke your delegate. It automatically sets up the context and flips the buffer. If you need to redraw the scene in response to an event, call this.
void redrawOpenGlSceneNow() {
version(X11) if (!this._visible) return; // no need to do this if window is invisible
if (this._closed) return; // window may be closed, but timer is still firing; avoid GLXBadDrawable error
if(redrawOpenGlScene is null)
return;
this.mtLock();
scope(exit) this.mtUnlock();
this.setAsCurrentOpenGlContext();
redrawOpenGlScene();
this.swapOpenGlBuffers();
// at least nvidia proprietary crap segfaults on exit if you won't do this and will call glTexSubImage2D() too fast; no, `glFlush()` won't work.
if (useGLFinish) glFinish();
}
private bool redrawOpenGlSceneSoonSet = false;
private static class RedrawOpenGlSceneEvent {
SimpleWindow w;
this(SimpleWindow w) { this.w = w; }
}
private RedrawOpenGlSceneEvent redrawOpenGlSceneEvent;
/++
Queues an opengl redraw as soon as the other pending events are cleared.
+/
void redrawOpenGlSceneSoon() {
if(!redrawOpenGlSceneSoonSet) {
redrawOpenGlSceneEvent = new RedrawOpenGlSceneEvent(this);
this.addEventListener((RedrawOpenGlSceneEvent e) { e.w.redrawOpenGlSceneNow(); });
redrawOpenGlSceneSoonSet = true;
}
this.postEvent(redrawOpenGlSceneEvent, true);
}
/// Makes all gl* functions target this window until changed. This is only valid if you passed `OpenGlOptions.yes` to the constructor.
void setAsCurrentOpenGlContext() {
assert(openglMode == OpenGlOptions.yes);
version(X11) {
if(glXMakeCurrent(display, impl.window, impl.glc) == 0)
throw new Exception("glXMakeCurrent");
} else version(Windows) {
static if (SdpyIsUsingIVGLBinds) import iv.glbinds; // override druntime windows imports
if (!wglMakeCurrent(ghDC, ghRC))
throw new Exception("wglMakeCurrent"); // let windows users suffer too
}
}
/// Makes all gl* functions target this window until changed. This is only valid if you passed `OpenGlOptions.yes` to the constructor.
/// This doesn't throw, returning success flag instead.
bool setAsCurrentOpenGlContextNT() nothrow {
assert(openglMode == OpenGlOptions.yes);
version(X11) {
return (glXMakeCurrent(display, impl.window, impl.glc) != 0);
} else version(Windows) {
static if (SdpyIsUsingIVGLBinds) import iv.glbinds; // override druntime windows imports
return wglMakeCurrent(ghDC, ghRC) ? true : false;
}
}
/// Releases OpenGL context, so it can be reused in, for example, different thread. This is only valid if you passed `OpenGlOptions.yes` to the constructor.
/// This doesn't throw, returning success flag instead.
bool releaseCurrentOpenGlContext() nothrow {
assert(openglMode == OpenGlOptions.yes);
version(X11) {
return (glXMakeCurrent(display, 0, null) != 0);
} else version(Windows) {
static if (SdpyIsUsingIVGLBinds) import iv.glbinds; // override druntime windows imports
return wglMakeCurrent(ghDC, null) ? true : false;
}
}
/++
simpledisplay always uses double buffering, usually automatically. This
manually swaps the OpenGL buffers.
You should not need to call this yourself because simpledisplay will do it
for you after calling your `redrawOpenGlScene`.
Remember that this may throw an exception, which you can catch in a multithreaded
application to keep your thread from dying from an unhandled exception.
+/
void swapOpenGlBuffers() {
assert(openglMode == OpenGlOptions.yes);
version(X11) {
if (!this._visible) return; // no need to do this if window is invisible
if (this._closed) return; // window may be closed, but timer is still firing; avoid GLXBadDrawable error
glXSwapBuffers(display, impl.window);
} else version(Windows) {
SwapBuffers(ghDC);
}
}
}
/++
Set the window title, which is visible on the window manager title bar, operating system taskbar, etc.
---
auto window = new SimpleWindow(100, 100, "First title");
window.title = "A new title";
---
You may call this function at any time.
+/
@property void title(string title) {
_title = title;
version(OSXCocoa) throw new NotYetImplementedException(); else
impl.setTitle(title);
}
private string _title;
/// Gets the title
@property string title() {
if(_title is null)
_title = getRealTitle();
return _title;
}
/++
Get the title as set by the window manager.
May not match what you attempted to set.
+/
string getRealTitle() {
static if(is(typeof(impl.getTitle())))
return impl.getTitle();
else
return null;
}
// don't use this generally it is not yet really released
version(X11)
@property Image secret_icon() {
return secret_icon_inner;
}
private Image secret_icon_inner;
/// Set the icon that is seen in the title bar or taskbar, etc., for the user.
@property void icon(MemoryImage icon) {
auto tci = icon.getAsTrueColorImage();
version(Windows) {
winIcon = new WindowsIcon(icon);
SendMessageA(impl.hwnd, 0x0080 /*WM_SETICON*/, 0 /*ICON_SMALL*/, cast(LPARAM) winIcon.hIcon); // there is also 1 == ICON_BIG
} else version(X11) {
secret_icon_inner = Image.fromMemoryImage(icon);
// FIXME: ensure this is correct
auto display = XDisplayConnection.get;
arch_ulong[] buffer;
buffer ~= icon.width;
buffer ~= icon.height;
foreach(c; tci.imageData.colors) {
arch_ulong b;
b |= c.a << 24;
b |= c.r << 16;
b |= c.g << 8;
b |= c.b;
buffer ~= b;
}
XChangeProperty(
display,
impl.window,
GetAtom!("_NET_WM_ICON", true)(display),
GetAtom!"CARDINAL"(display),
32 /* bits */,
0 /*PropModeReplace*/,
buffer.ptr,
cast(int) buffer.length);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
version(Windows)
private WindowsIcon winIcon;
bool _suppressDestruction;
~this() {
if(_suppressDestruction)
return;
impl.dispose();
}
private bool _closed;
// the idea here is to draw something temporary on top of the main picture e.g. a blinking cursor
/*
ScreenPainter drawTransiently() {
return impl.getPainter();
}
*/
/// Draws an image on the window. This is meant to provide quick look
/// of a static image generated elsewhere.
@property void image(Image i) {
/+
version(Windows) {
BITMAP bm;
HDC hdc = GetDC(hwnd);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = SelectObject(hdcMem, i.handle);
GetObject(i.handle, bm.sizeof, &bm);
BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
ReleaseDC(hwnd, hdc);
/*
RECT r;
r.right = i.width;
r.bottom = i.height;
InvalidateRect(hwnd, &r, false);
*/
} else
version(X11) {
if(!destroyed) {
if(i.usingXshm)
XShmPutImage(display, cast(Drawable) window, gc, i.handle, 0, 0, 0, 0, i.width, i.height, false);
else
XPutImage(display, cast(Drawable) window, gc, i.handle, 0, 0, 0, 0, i.width, i.height);
}
} else
version(OSXCocoa) {
draw().drawImage(Point(0, 0), i);
setNeedsDisplay(view, true);
} else static assert(0);
+/
auto painter = this.draw;
painter.drawImage(Point(0, 0), i);
}
/++
Changes the cursor for the window. If the cursor is hidden via [hideCursor], this has no effect.
---
window.cursor = GenericCursor.Help;
// now the window mouse cursor is set to a generic help
---
+/
@property void cursor(MouseCursor cursor) {
version(OSXCocoa)
featureNotImplemented();
else
if(this.impl.curHidden <= 0) {
static if(UsingSimpledisplayX11) {
auto ch = cursor.cursorHandle;
XDefineCursor(XDisplayConnection.get(), this.impl.window, ch);
} else version(Windows) {
auto ch = cursor.cursorHandle;
impl.currentCursor = ch;
SetCursor(ch); // redraw without waiting for mouse movement to update
} else featureNotImplemented();
}
}
/// What follows are the event handlers. These are set automatically
/// by the eventLoop function, but are still public so you can change
/// them later. wasPressed == true means key down. false == key up.
/// Handles a low-level keyboard event. Settable through setEventHandlers.
void delegate(KeyEvent ke) handleKeyEvent;
/// Handles a higher level keyboard event - c is the character just pressed. Settable through setEventHandlers.
void delegate(dchar c) handleCharEvent;
/// Handles a timer pulse. Settable through setEventHandlers.
void delegate() handlePulse;
/// Called when the focus changes, param is if we have it (true) or are losing it (false).
void delegate(bool) onFocusChange;
/** Called inside `close()` method. Our window is still alive, and we can free various resources.
* Sometimes it is easier to setup the delegate instead of subclassing. */
void delegate() onClosing;
/** Called when we received destroy notification. At this stage we cannot do much with our window
* (as it is already dead, and it's native handle cannot be used), but we still can do some
* last minute cleanup. */
void delegate() onDestroyed;
static if (UsingSimpledisplayX11)
/** Called when Expose event comes. See Xlib manual to understand the arguments.
* Return `false` if you want Simpledisplay to copy backbuffer, or `true` if you did it yourself.
* You will probably never need to setup this handler, it is for very low-level stuff.
*
* WARNING! Xlib is multithread-locked when this handles is called! */
bool delegate(int x, int y, int width, int height, int eventsLeft) handleExpose;
//version(Windows)
//bool delegate(WPARAM wParam, LPARAM lParam) handleWM_PAINT;
private {
int lastMouseX = int.min;
int lastMouseY = int.min;
void mdx(ref MouseEvent ev) {
if(lastMouseX == int.min || lastMouseY == int.min) {
ev.dx = 0;
ev.dy = 0;
} else {
ev.dx = ev.x - lastMouseX;
ev.dy = ev.y - lastMouseY;
}
lastMouseX = ev.x;
lastMouseY = ev.y;
}
}
/// Mouse event handler. Settable through setEventHandlers.
void delegate(MouseEvent) handleMouseEvent;
/// use to redraw child widgets if you use system apis to add stuff
void delegate() paintingFinished;
void delegate() paintingFinishedDg() {
return paintingFinished;
}
/// handle a resize, after it happens. You must construct the window with Resizability.allowResizing
/// for this to ever happen.
void delegate(int width, int height) windowResized;
/++
Platform specific - handle any native message this window gets.
Note: this is called *in addition to* other event handlers, unless you either:
1) On X11, return 0 indicating that you handled it. Any other return value is simply discarded.
2) On Windows, set the `mustReturn` parameter to 1 indicating you've done it and your return value should be forwarded to the operating system. If you do not set `mustReturn`, your return value will be discarded.
On Windows, your delegate takes the form of `int delegate(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, out int mustReturn)`.
On X, it takes the form of `int delegate(XEvent)`.
History:
In ancient versions, this was `static`. If you want a global hook, use [handleNativeGlobalEvent] instead.
Prior to November 27, 2021, the `mustReturn` parameter was not present, and the Windows implementation would discard return values. There's still a deprecated shim with that signature, but since the return value is often important, you shouldn't use it.
+/
NativeEventHandler handleNativeEvent_;
@property NativeEventHandler handleNativeEvent() nothrow pure @nogc const @safe {
return handleNativeEvent_;
}
@property void handleNativeEvent(NativeEventHandler neh) nothrow pure @nogc @safe {
handleNativeEvent_ = neh;
}
version(Windows)
// compatibility shim with the old deprecated way
// in this one, if you return 0, it means you must return. otherwise the ret value is ignored.
deprecated("This old api ignored your non-zero return values and that hurt it a lot. Add an `out int pleaseReturn` param to your delegate and set it to one if you must return the result to Windows. Otherwise, leave it zero and processing will continue through to the default window message processor.") @property void handleNativeEvent(int delegate(HWND, UINT, WPARAM, LPARAM) dg) {
handleNativeEvent_ = delegate int(HWND h, UINT m, WPARAM w, LPARAM l, out int r) {
auto ret = dg(h, m, w, l);
if(ret == 0)
r = 1;
return ret;
};
}
/// This is the same as handleNativeEvent, but static so it can hook ALL events in the loop.
/// If you used to use handleNativeEvent depending on it being static, just change it to use
/// this instead and it will work the same way.
__gshared NativeEventHandler handleNativeGlobalEvent;
// private:
/// The native implementation is available, but you shouldn't use it unless you are
/// familiar with the underlying operating system, don't mind depending on it, and
/// know simpledisplay.d's internals too. It is virtually private; you can hopefully
/// do what you need to do with handleNativeEvent instead.
///
/// This is likely to eventually change to be just a struct holding platform-specific
/// handles instead of a template mixin at some point because I'm not happy with the
/// code duplication here (ironically).
mixin NativeSimpleWindowImplementation!() impl;
/**
This is in-process one-way (from anything to window) event sending mechanics.
It is thread-safe, so it can be used in multi-threaded applications to send,
for example, "wake up and repaint" events when thread completed some operation.
This will allow to avoid using timer pulse to check events with synchronization,
'cause event handler will be called in UI thread. You can stop guessing which
pulse frequency will be enough for your app.
Note that events handlers may be called in arbitrary order, i.e. last registered
handler can be called first, and vice versa.
*/
public:
/** Is our custom event queue empty? Can be used in simple cases to prevent
* "spamming" window with events it can't cope with.
* It is safe to call this from non-UI threads.
*/
@property bool eventQueueEmpty() () {
synchronized(this) {
foreach (const ref o; eventQueue[0..eventQueueUsed]) if (!o.doProcess) return false;
}
return true;
}
/** Does our custom event queue contains at least one with the given type?
* Can be used in simple cases to prevent "spamming" window with events
* it can't cope with.
* It is safe to call this from non-UI threads.
*/
@property bool eventQueued(ET:Object) () {
synchronized(this) {
foreach (const ref o; eventQueue[0..eventQueueUsed]) {
if (!o.doProcess) {
if (cast(ET)(o.evt)) return true;
}
}
}
return false;
}
/++
Event listeners added with [addEventListener] have their exceptions swallowed by the event loop. This delegate can handle them again before it proceeds.
History:
Added May 12, 2021
+/
void delegate(Exception e) nothrow eventUncaughtException;
/** Add listener for custom event. Can be used like this:
*
* ---------------------
* auto eid = win.addEventListener((MyStruct evt) { ... });
* ...
* win.removeEventListener(eid);
* ---------------------
*
* Returns: 0 on failure (should never happen, so ignore it)
*
* $(WARNING Don't use this method in object destructors!)
*
* $(WARNING It is better to register all event handlers and don't remove 'em,
* 'cause if event handler id counter will overflow, you won't be able
* to register any more events.)
*/
uint addEventListener(ET:Object) (void delegate (ET) dg) {
if (dg is null) return 0; // ignore empty handlers
synchronized(this) {
//FIXME: abort on overflow?
if (++lastUsedHandlerId == 0) { --lastUsedHandlerId; return 0; } // alas, can't register more events. at all.
EventHandlerEntry e;
e.dg = delegate (Object o) {
if (auto co = cast(ET)o) {
try {
dg(co);
} catch (Exception e) {
// sorry!
if(eventUncaughtException)
eventUncaughtException(e);
}
return true;
}
return false;
};
e.id = lastUsedHandlerId;
auto optr = eventHandlers.ptr;
eventHandlers ~= e;
if (eventHandlers.ptr !is optr) {
import core.memory : GC;
if (eventHandlers.ptr is GC.addrOf(eventHandlers.ptr)) GC.setAttr(eventHandlers.ptr, GC.BlkAttr.NO_INTERIOR);
}
return lastUsedHandlerId;
}
}
/// Remove event listener. It is safe to pass invalid event id here.
/// $(WARNING Don't use this method in object destructors!)
void removeEventListener() (uint id) {
if (id == 0 || id > lastUsedHandlerId) return;
synchronized(this) {
foreach (immutable idx; 0..eventHandlers.length) {
if (eventHandlers[idx].id == id) {
foreach (immutable c; idx+1..eventHandlers.length) eventHandlers[c-1] = eventHandlers[c];
eventHandlers[$-1].dg = null;
eventHandlers.length -= 1;
eventHandlers.assumeSafeAppend;
return;
}
}
}
}
/// Post event to queue. It is safe to call this from non-UI threads.
/// If `timeoutmsecs` is greater than zero, the event will be delayed for at least `timeoutmsecs` milliseconds.
/// if `replace` is `true`, replace all existing events typed `ET` with the new one (if `evt` is empty, remove 'em all)
/// Returns `true` if event was queued. Always returns `false` if `evt` is null.
bool postTimeout(ET:Object) (ET evt, uint timeoutmsecs, bool replace=false) {
if (this.closed) return false; // closed windows can't handle events
// remove all events of type `ET`
void removeAllET () {
uint eidx = 0, ec = eventQueueUsed;
auto eptr = eventQueue.ptr;
while (eidx < ec) {
if (eptr.doProcess) { ++eidx; ++eptr; continue; }
if (cast(ET)eptr.evt !is null) {
// i found her!
if (inCustomEventProcessor) {
// if we're in custom event processing loop, processor will clear it for us
eptr.evt = null;
++eidx;
++eptr;
} else {
foreach (immutable c; eidx+1..ec) eventQueue.ptr[c-1] = eventQueue.ptr[c];
ec = --eventQueueUsed;
// clear last event (it is already copied)
eventQueue.ptr[ec].evt = null;
}
} else {
++eidx;
++eptr;
}
}
}
if (evt is null) {
if (replace) { synchronized(this) removeAllET(); }
// ignore empty events, they can't be handled anyway
return false;
}
// add events even if no event FD/event object created yet
synchronized(this) {
if (replace) removeAllET();
if (eventQueueUsed == uint.max) return false; // just in case
if (eventQueueUsed < eventQueue.length) {
eventQueue[eventQueueUsed++] = QueuedEvent(evt, timeoutmsecs);
} else {
if (eventQueue.capacity == eventQueue.length) {
// need to reallocate; do a trick to ensure that old array is cleared
auto oarr = eventQueue;
eventQueue ~= QueuedEvent(evt, timeoutmsecs);
// just in case, do yet another check
if (oarr.length != 0 && oarr.ptr !is eventQueue.ptr) foreach (ref e; oarr[0..eventQueueUsed]) e.evt = null;
import core.memory : GC;
if (eventQueue.ptr is GC.addrOf(eventQueue.ptr)) GC.setAttr(eventQueue.ptr, GC.BlkAttr.NO_INTERIOR);
} else {
auto optr = eventQueue.ptr;
eventQueue ~= QueuedEvent(evt, timeoutmsecs);
assert(eventQueue.ptr is optr);
}
++eventQueueUsed;
assert(eventQueueUsed == eventQueue.length);
}
if (!eventWakeUp()) {
// can't wake up event processor, so there is no reason to keep the event
assert(eventQueueUsed > 0);
eventQueue[--eventQueueUsed].evt = null;
return false;
}
return true;
}
}
/// Post event to queue. It is safe to call this from non-UI threads.
/// if `replace` is `true`, replace all existing events typed `ET` with the new one (if `evt` is empty, remove 'em all)
/// Returns `true` if event was queued. Always returns `false` if `evt` is null.
bool postEvent(ET:Object) (ET evt, bool replace=false) {
return postTimeout!ET(evt, 0, replace);
}
private:
private import core.time : MonoTime;
version(Posix) {
__gshared int customEventFDRead = -1;
__gshared int customEventFDWrite = -1;
__gshared int customSignalFD = -1;
} else version(Windows) {
__gshared HANDLE customEventH = null;
}
// wake up event processor
static bool eventWakeUp () {
version(X11) {
import core.sys.posix.unistd : write;
ulong n = 1;
if (customEventFDWrite >= 0) write(customEventFDWrite, &n, n.sizeof);
return true;
} else version(Windows) {
if (customEventH !is null) SetEvent(customEventH);
return true;
} else {
// not implemented for other OSes
return false;
}
}
static struct QueuedEvent {
Object evt;
bool timed = false;
MonoTime hittime = MonoTime.zero;
bool doProcess = false; // process event at the current iteration (internal flag)
this (Object aevt, uint toutmsecs) {
evt = aevt;
if (toutmsecs > 0) {
import core.time : msecs;
timed = true;
hittime = MonoTime.currTime+toutmsecs.msecs;
}
}
}
alias CustomEventHandler = bool delegate (Object o) nothrow;
static struct EventHandlerEntry {
CustomEventHandler dg;
uint id;
}
uint lastUsedHandlerId;
EventHandlerEntry[] eventHandlers;
QueuedEvent[] eventQueue = null;
uint eventQueueUsed = 0; // to avoid `.assumeSafeAppend` and length changes
bool inCustomEventProcessor = false; // required to properly remove events
// process queued events and call custom event handlers
// this will not process events posted from called handlers (such events are postponed for the next iteration)
void processCustomEvents () {
bool hasSomethingToDo = false;
uint ecount;
bool ocep;
synchronized(this) {
ocep = inCustomEventProcessor;
inCustomEventProcessor = true;
ecount = eventQueueUsed; // user may want to post new events from an event handler; process 'em on next iteration
auto ctt = MonoTime.currTime;
bool hasEmpty = false;
// mark events to process (this is required for `eventQueued()`)
foreach (ref qe; eventQueue[0..ecount]) {
if (qe.evt is null) { hasEmpty = true; continue; }
if (qe.timed) {
qe.doProcess = (qe.hittime <= ctt);
} else {
qe.doProcess = true;
}
hasSomethingToDo = (hasSomethingToDo || qe.doProcess);
}
if (!hasSomethingToDo) {
// remove empty events
if (hasEmpty) {
uint eidx = 0, ec = eventQueueUsed;
auto eptr = eventQueue.ptr;
while (eidx < ec) {
if (eptr.evt is null) {
foreach (immutable c; eidx+1..ec) eventQueue.ptr[c-1] = eventQueue.ptr[c];
ec = --eventQueueUsed;
eventQueue.ptr[ec].evt = null; // make GC life easier
} else {
++eidx;
++eptr;
}
}
}
inCustomEventProcessor = ocep;
return;
}
}
// process marked events
uint efree = 0; // non-processed events will be put at this index
EventHandlerEntry[] eh;
Object evt;
foreach (immutable eidx; 0..ecount) {
synchronized(this) {
if (!eventQueue[eidx].doProcess) {
// skip this event
assert(efree <= eidx);
if (efree != eidx) {
// copy this event to queue start
eventQueue[efree] = eventQueue[eidx];
eventQueue[eidx].evt = null; // just in case
}
++efree;
continue;
}
evt = eventQueue[eidx].evt;
eventQueue[eidx].evt = null; // in case event handler will hit GC
if (evt is null) continue; // just in case
// try all handlers; this can be slow, but meh...
eh = eventHandlers;
}
foreach (ref evhan; eh) if (evhan.dg !is null) evhan.dg(evt);
evt = null;
eh = null;
}
synchronized(this) {
// move all unprocessed events to queue top; efree holds first "free index"
foreach (immutable eidx; ecount..eventQueueUsed) {
assert(efree <= eidx);
if (efree != eidx) eventQueue[efree] = eventQueue[eidx];
++efree;
}
eventQueueUsed = efree;
// wake up event processor on next event loop iteration if we have more queued events
// also, remove empty events
bool awaken = false;
uint eidx = 0, ec = eventQueueUsed;
auto eptr = eventQueue.ptr;
while (eidx < ec) {
if (eptr.evt is null) {
foreach (immutable c; eidx+1..ec) eventQueue.ptr[c-1] = eventQueue.ptr[c];
ec = --eventQueueUsed;
eventQueue.ptr[ec].evt = null; // make GC life easier
} else {
if (!awaken && !eptr.timed) { eventWakeUp(); awaken = true; }
++eidx;
++eptr;
}
}
inCustomEventProcessor = ocep;
}
}
// for all windows in nativeMapping
package static void processAllCustomEvents () {
justCommunication.processCustomEvents();
foreach (SimpleWindow sw; SimpleWindow.nativeMapping.byValue) {
if (sw is null || sw.closed) continue;
sw.processCustomEvents();
}
runPendingRunInGuiThreadDelegates();
}
// 0: infinite (i.e. no scheduled events in queue)
uint eventQueueTimeoutMSecs () {
synchronized(this) {
if (eventQueueUsed == 0) return 0;
if (inCustomEventProcessor) assert(0, "WUTAFUUUUUUU..."); // the thing that should not be. ABSOLUTELY! (c)
uint res = int.max;
auto ctt = MonoTime.currTime;
foreach (const ref qe; eventQueue[0..eventQueueUsed]) {
if (qe.evt is null) assert(0, "WUTAFUUUUUUU..."); // the thing that should not be. ABSOLUTELY! (c)
if (qe.doProcess) continue; // just in case
if (!qe.timed) return 1; // minimal
if (qe.hittime <= ctt) return 1; // minimal
auto tms = (qe.hittime-ctt).total!"msecs";
if (tms < 1) tms = 1; // safety net
if (tms >= int.max) tms = int.max-1; // and another safety net
if (res > tms) res = cast(uint)tms;
}
return (res >= int.max ? 0 : res);
}
}
// for all windows in nativeMapping
static uint eventAllQueueTimeoutMSecs () {
uint res = uint.max;
foreach (SimpleWindow sw; SimpleWindow.nativeMapping.byValue) {
if (sw is null || sw.closed) continue;
uint to = sw.eventQueueTimeoutMSecs();
if (to && to < res) {
res = to;
if (to == 1) break; // can't have less than this
}
}
return (res >= int.max ? 0 : res);
}
}
/++
Magic pseudo-window for just posting events to a global queue.
Not entirely supported, I might delete it at any time.
Added Nov 5, 2021.
+/
__gshared SimpleWindow justCommunication = new SimpleWindow(NativeWindowHandle.init);
/* Drag and drop support { */
version(X11) {
} else version(Windows) {
import core.sys.windows.uuid;
import core.sys.windows.ole2;
import core.sys.windows.oleidl;
import core.sys.windows.objidl;
import core.sys.windows.wtypes;
pragma(lib, "ole32");
void initDnd() {
auto err = OleInitialize(null);
if(err != S_OK && err != S_FALSE)
throw new Exception("init");//err);
}
}
/* } End drag and drop support */
/// Represents a mouse cursor (aka the mouse pointer, the image seen on screen that indicates where the mouse is pointing).
/// See [GenericCursor].
class MouseCursor {
int osId;
bool isStockCursor;
private this(int osId) {
this.osId = osId;
this.isStockCursor = true;
}
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms648385(v=vs.85).aspx
this(int xHotSpot, int yHotSpot, ubyte[] andMask, ubyte[] xorMask) {}
version(Windows) {
HCURSOR cursor_;
HCURSOR cursorHandle() {
if(cursor_ is null)
cursor_ = LoadCursor(null, MAKEINTRESOURCE(osId));
return cursor_;
}
} else static if(UsingSimpledisplayX11) {
Cursor cursor_ = None;
int xDisplaySequence;
Cursor cursorHandle() {
if(this.osId == None)
return None;
// we need to reload if we on a new X connection
if(cursor_ == None || XDisplayConnection.connectionSequenceNumber != xDisplaySequence) {
cursor_ = XCreateFontCursor(XDisplayConnection.get(), this.osId);
xDisplaySequence = XDisplayConnection.connectionSequenceNumber;
}
return cursor_;
}
}
}
// https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
// https://tronche.com/gui/x/xlib/appendix/b/
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms648391(v=vs.85).aspx
/// Note that there is no exact appearance guaranteed for any of these items; it may change appearance on different operating systems or future simpledisplay versions.
enum GenericCursorType {
Default, /// The default arrow pointer.
Wait, /// A cursor indicating something is loading and the user must wait.
Hand, /// A pointing finger, like the one used hovering over hyperlinks in a web browser.
Help, /// A cursor indicating the user can get help about the pointer location.
Cross, /// A crosshair.
Text, /// An i-beam shape, typically used to indicate text selection is possible.
Move, /// Pointer indicating movement is possible. May also be used as SizeAll.
UpArrow, /// An arrow pointing straight up.
Progress, /// The hourglass and arrow, indicating the computer is working but the user can still work. Not great results on X11.
NotAllowed, /// Indicates the current operation is not allowed. Not great results on X11.
SizeNesw, /// Arrow pointing northeast and southwest (lower-left corner resize indicator).
SizeNs, /// Arrow pointing north and south (upper/lower edge resize indicator).
SizeNwse, /// Arrow pointing northwest and southeast (upper-left corner resize indicator).
SizeWe, /// Arrow pointing west and east (left/right edge resize indicator).
}
/*
X_plus == css cell == Windows ?
*/
/// You get one by `GenericCursor.SomeTime`. See [GenericCursorType] for a list of types.
static struct GenericCursor {
static:
///
MouseCursor opDispatch(string str)() if(__traits(hasMember, GenericCursorType, str)) {
static MouseCursor mc;
auto type = __traits(getMember, GenericCursorType, str);
if(mc is null) {
version(Windows) {
int osId;
final switch(type) {
case GenericCursorType.Default: osId = IDC_ARROW; break;
case GenericCursorType.Wait: osId = IDC_WAIT; break;
case GenericCursorType.Hand: osId = IDC_HAND; break;
case GenericCursorType.Help: osId = IDC_HELP; break;
case GenericCursorType.Cross: osId = IDC_CROSS; break;
case GenericCursorType.Text: osId = IDC_IBEAM; break;
case GenericCursorType.Move: osId = IDC_SIZEALL; break;
case GenericCursorType.UpArrow: osId = IDC_UPARROW; break;
case GenericCursorType.Progress: osId = IDC_APPSTARTING; break;
case GenericCursorType.NotAllowed: osId = IDC_NO; break;
case GenericCursorType.SizeNesw: osId = IDC_SIZENESW; break;
case GenericCursorType.SizeNs: osId = IDC_SIZENS; break;
case GenericCursorType.SizeNwse: osId = IDC_SIZENWSE; break;
case GenericCursorType.SizeWe: osId = IDC_SIZEWE; break;
}
} else static if(UsingSimpledisplayX11) {
int osId;
final switch(type) {
case GenericCursorType.Default: osId = None; break;
case GenericCursorType.Wait: osId = 150 /* XC_watch */; break;
case GenericCursorType.Hand: osId = 60 /* XC_hand2 */; break;
case GenericCursorType.Help: osId = 92 /* XC_question_arrow */; break;
case GenericCursorType.Cross: osId = 34 /* XC_crosshair */; break;
case GenericCursorType.Text: osId = 152 /* XC_xterm */; break;
case GenericCursorType.Move: osId = 52 /* XC_fleur */; break;
case GenericCursorType.UpArrow: osId = 22 /* XC_center_ptr */; break;
case GenericCursorType.Progress: osId = 150 /* XC_watch, best i can do i think */; break;
case GenericCursorType.NotAllowed: osId = 24 /* XC_circle. not great */; break;
case GenericCursorType.SizeNesw: osId = 12 /* XC_bottom_left_corner */ ; break;
case GenericCursorType.SizeNs: osId = 116 /* XC_sb_v_double_arrow */; break;
case GenericCursorType.SizeNwse: osId = 14 /* XC_bottom_right_corner */; break;
case GenericCursorType.SizeWe: osId = 108 /* XC_sb_h_double_arrow */; break;
}
} else featureNotImplemented();
mc = new MouseCursor(osId);
}
return mc;
}
}
/++
If you want to get more control over the event loop, you can use this.
Typically though, you can just call [SimpleWindow.eventLoop] which forwards
to `EventLoop.get.run`.
+/
struct EventLoop {
@disable this();
/// Gets a reference to an existing event loop
static EventLoop get() {
return EventLoop(0, null);
}
static void quitApplication() {
EventLoop.get().exit();
}
private __gshared static Object monitor = new Object(); // deliberate CTFE usage here fyi
/// Construct an application-global event loop for yourself
/// See_Also: [SimpleWindow.setEventHandlers]
this(long pulseTimeout, void delegate() handlePulse) {
synchronized(monitor) {
if(impl is null) {
claimGuiThread();
version(sdpy_thread_checks) assert(thisIsGuiThread);
impl = new EventLoopImpl(pulseTimeout, handlePulse);
} else {
if(pulseTimeout) {
impl.pulseTimeout = pulseTimeout;
impl.handlePulse = handlePulse;
}
}
impl.refcount++;
}
}
~this() {
if(impl is null)
return;
impl.refcount--;
if(impl.refcount == 0) {
impl.dispose();
if(thisIsGuiThread)
guiThreadFinalize();
}
}
this(this) {
if(impl is null)
return;
impl.refcount++;
}
/// Runs the event loop until the whileCondition, if present, returns false
int run(bool delegate() whileCondition = null) {
assert(impl !is null);
impl.notExited = true;
return impl.run(whileCondition);
}
/// Exits the event loop
void exit() {
assert(impl !is null);
impl.notExited = false;
}
version(linux)
ref void delegate(int) signalHandler() {
assert(impl !is null);
return impl.signalHandler;
}
__gshared static EventLoopImpl* impl;
}
version(linux)
void delegate(int, int) globalHupHandler;
version(Posix)
void makeNonBlocking(int fd) {
import fcntl = core.sys.posix.fcntl;
auto flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0);
if(flags == -1)
throw new Exception("fcntl get");
flags |= fcntl.O_NONBLOCK;
auto s = fcntl.fcntl(fd, fcntl.F_SETFL, flags);
if(s == -1)
throw new Exception("fcntl set");
}
struct EventLoopImpl {
int refcount;
bool notExited = true;
version(linux) {
static import ep = core.sys.linux.epoll;
static import unix = core.sys.posix.unistd;
static import err = core.stdc.errno;
import core.sys.linux.timerfd;
void delegate(int) signalHandler;
}
version(X11) {
int pulseFd = -1;
version(linux) ep.epoll_event[16] events = void;
} else version(Windows) {
Timer pulser;
HANDLE[] handles;
}
/// "Lock" this window handle, to do multithreaded synchronization. You probably won't need
/// to call this, as it's not recommended to share window between threads.
void mtLock () {
version(X11) {
XLockDisplay(this.display);
}
}
version(X11)
auto display() { return XDisplayConnection.get; }
/// "Unlock" this window handle, to do multithreaded synchronization. You probably won't need
/// to call this, as it's not recommended to share window between threads.
void mtUnlock () {
version(X11) {
XUnlockDisplay(this.display);
}
}
version(with_eventloop)
void initialize(long pulseTimeout) {}
else
void initialize(long pulseTimeout) {
version(Windows) {
if(pulseTimeout && handlePulse !is null)
pulser = new Timer(cast(int) pulseTimeout, handlePulse);
if (customEventH is null) {
customEventH = CreateEvent(null, FALSE/*autoreset*/, FALSE/*initial state*/, null);
if (customEventH !is null) {
handles ~= customEventH;
} else {
// this is something that should not be; better be safe than sorry
throw new Exception("can't create eventfd for custom event processing");
}
}
SimpleWindow.processAllCustomEvents(); // process events added before event object creation
}
version(linux) {
prepareEventLoop();
{
auto display = XDisplayConnection.get;
// adding Xlib file
ep.epoll_event ev = void;
{ import core.stdc.string : memset; memset(&ev, 0, ev.sizeof); } // this makes valgrind happy
ev.events = ep.EPOLLIN;
ev.data.fd = display.fd;
//import std.conv;
if(ep.epoll_ctl(epollFd, ep.EPOLL_CTL_ADD, display.fd, &ev) == -1)
throw new Exception("add x fd");// ~ to!string(epollFd));
displayFd = display.fd;
}
if(pulseTimeout && handlePulse !is null) {
pulseFd = timerfd_create(CLOCK_MONOTONIC, 0);
if(pulseFd == -1)
throw new Exception("pulse timer create failed");
itimerspec value;
value.it_value.tv_sec = cast(int) (pulseTimeout / 1000);
value.it_value.tv_nsec = (pulseTimeout % 1000) * 1000_000;
value.it_interval.tv_sec = cast(int) (pulseTimeout / 1000);
value.it_interval.tv_nsec = (pulseTimeout % 1000) * 1000_000;
if(timerfd_settime(pulseFd, 0, &value, null) == -1)
throw new Exception("couldn't make pulse timer");
ep.epoll_event ev = void;
{ import core.stdc.string : memset; memset(&ev, 0, ev.sizeof); } // this makes valgrind happy
ev.events = ep.EPOLLIN;
ev.data.fd = pulseFd;
ep.epoll_ctl(epollFd, ep.EPOLL_CTL_ADD, pulseFd, &ev);
}
// eventfd for custom events
if (customEventFDWrite == -1) {
customEventFDWrite = eventfd(0, 0);
customEventFDRead = customEventFDWrite;
if (customEventFDRead >= 0) {
ep.epoll_event ev = void;
{ import core.stdc.string : memset; memset(&ev, 0, ev.sizeof); } // this makes valgrind happy
ev.events = ep.EPOLLIN;
ev.data.fd = customEventFDRead;
ep.epoll_ctl(epollFd, ep.EPOLL_CTL_ADD, customEventFDRead, &ev);
} else {
// this is something that should not be; better be safe than sorry
throw new Exception("can't create eventfd for custom event processing");
}
}
if (customSignalFD == -1) {
import core.sys.linux.sys.signalfd;
sigset_t sigset;
auto err = sigemptyset(&sigset);
assert(!err);
err = sigaddset(&sigset, SIGINT);
assert(!err);
err = sigaddset(&sigset, SIGHUP);
assert(!err);
err = sigprocmask(SIG_BLOCK, &sigset, null);
assert(!err);
customSignalFD = signalfd(-1, &sigset, SFD_NONBLOCK);
assert(customSignalFD != -1);
ep.epoll_event ev = void;
{ import core.stdc.string : memset; memset(&ev, 0, ev.sizeof); } // this makes valgrind happy
ev.events = ep.EPOLLIN;
ev.data.fd = customSignalFD;
ep.epoll_ctl(epollFd, ep.EPOLL_CTL_ADD, customSignalFD, &ev);
}
} else version(Posix) {
prepareEventLoop();
if (customEventFDRead == -1) {
int[2] bfr;
import core.sys.posix.unistd;
auto ret = pipe(bfr);
if(ret == -1) throw new Exception("pipe");
customEventFDRead = bfr[0];
customEventFDWrite = bfr[1];
}
}
SimpleWindow.processAllCustomEvents(); // process events added before event FD creation
version(linux) {
this.mtLock();
scope(exit) this.mtUnlock();
XPending(display); // no, really
}
disposed = false;
}
bool disposed = true;
version(X11)
int displayFd = -1;
version(with_eventloop)
void dispose() {}
else
void dispose() {
disposed = true;
version(X11) {
if(pulseFd != -1) {
import unix = core.sys.posix.unistd;
unix.close(pulseFd);
pulseFd = -1;
}
version(linux)
if(displayFd != -1) {
// clean up xlib fd when we exit, in case we come back later e.g. X disconnect and reconnect with new FD, don't want to still keep the old one around
ep.epoll_event ev = void;
{ import core.stdc.string : memset; memset(&ev, 0, ev.sizeof); } // this makes valgrind happy
ev.events = ep.EPOLLIN;
ev.data.fd = displayFd;
//import std.conv;
ep.epoll_ctl(epollFd, ep.EPOLL_CTL_DEL, displayFd, &ev);
displayFd = -1;
}
} else version(Windows) {
if(pulser !is null) {
pulser.destroy();
pulser = null;
}
if (customEventH !is null) {
CloseHandle(customEventH);
customEventH = null;
}
}
}
this(long pulseTimeout, void delegate() handlePulse) {
this.pulseTimeout = pulseTimeout;
this.handlePulse = handlePulse;
initialize(pulseTimeout);
}
private long pulseTimeout;
void delegate() handlePulse;
~this() {
dispose();
}
version(Posix)
ref int customEventFDRead() { return SimpleWindow.customEventFDRead; }
version(Posix)
ref int customEventFDWrite() { return SimpleWindow.customEventFDWrite; }
version(linux)
ref int customSignalFD() { return SimpleWindow.customSignalFD; }
version(Windows)
ref auto customEventH() { return SimpleWindow.customEventH; }
version(with_eventloop) {
int loopHelper(bool delegate() whileCondition) {
// FIXME: whileCondition
import arsd.eventloop;
loop();
return 0;
}
} else
int loopHelper(bool delegate() whileCondition) {
version(X11) {
bool done = false;
XFlush(display);
insideXEventLoop = true;
scope(exit) insideXEventLoop = false;
version(linux) {
while(!done && (whileCondition is null || whileCondition() == true) && notExited) {
bool forceXPending = false;
auto wto = SimpleWindow.eventAllQueueTimeoutMSecs();
// eh... some events may be queued for "squashing" (or "late delivery"), so we have to do the following magic
{
this.mtLock();
scope(exit) this.mtUnlock();
if (XEventsQueued(this.display, QueueMode.QueuedAlready)) { forceXPending = true; if (wto > 10 || wto <= 0) wto = 10; } // so libX event loop will be able to do it's work
}
//{ import core.stdc.stdio; printf("*** wto=%d; force=%d\n", wto, (forceXPending ? 1 : 0)); }
auto nfds = ep.epoll_wait(epollFd, events.ptr, events.length, (wto == 0 || wto >= int.max ? -1 : cast(int)wto));
if(nfds == -1) {
if(err.errno == err.EINTR) {
//if(forceXPending) goto xpending;
continue; // interrupted by signal, just try again
}
throw new Exception("epoll wait failure");
}
SimpleWindow.processAllCustomEvents(); // anyway
//version(sdddd) { import std.stdio; writeln("nfds=", nfds, "; [0]=", events[0].data.fd); }
foreach(idx; 0 .. nfds) {
if(done) break;
auto fd = events[idx].data.fd;
assert(fd != -1); // should never happen cuz the api doesn't do that but better to assert than assume.
auto flags = events[idx].events;
if(flags & ep.EPOLLIN) {
if (fd == customSignalFD) {
version(linux) {
import core.sys.linux.sys.signalfd;
import core.sys.posix.unistd : read;
signalfd_siginfo info;
read(customSignalFD, &info, info.sizeof);
auto sig = info.ssi_signo;
if(EventLoop.get.signalHandler !is null) {
EventLoop.get.signalHandler()(sig);
} else {
EventLoop.get.exit();
}
}
} else if(fd == display.fd) {
version(sdddd) { import std.stdio; writeln("X EVENT PENDING!"); }
this.mtLock();
scope(exit) this.mtUnlock();
while(!done && XPending(display)) {
done = doXNextEvent(this.display);
}
forceXPending = false;
} else if(fd == pulseFd) {
long expirationCount;
// if we go over the count, I ignore it because i don't want the pulse to go off more often and eat tons of cpu time...
handlePulse();
// read just to clear the buffer so poll doesn't trigger again
// BTW I read AFTER the pulse because if the pulse handler takes
// a lot of time to execute, we don't want the app to get stuck
// in a loop of timer hits without a chance to do anything else
//
// IOW handlePulse happens at most once per pulse interval.
unix.read(pulseFd, &expirationCount, expirationCount.sizeof);
forceXPending = true; // some events might have been added while the pulse was going off and xlib already read it from the fd (like as a result of a draw done in the timer handler). if so we need to flush that separately to ensure it is not delayed
} else if (fd == customEventFDRead) {
// we have some custom events; process 'em
import core.sys.posix.unistd : read;
ulong n;
read(customEventFDRead, &n, n.sizeof); // reset counter value to zero again
//{ import core.stdc.stdio; printf("custom event! count=%u\n", eventQueueUsed); }
//SimpleWindow.processAllCustomEvents();
} else {
// some other timer
version(sdddd) { import std.stdio; writeln("unknown fd: ", fd); }
if(Timer* t = fd in Timer.mapping)
(*t).trigger();
if(PosixFdReader* pfr = fd in PosixFdReader.mapping)
(*pfr).ready(flags);
// or i might add support for other FDs too
// but for now it is just timer
// (if you want other fds, use arsd.eventloop and compile with -version=with_eventloop), it offers a fuller api for arbitrary stuff.
}
}
if(flags & ep.EPOLLHUP) {
if(PosixFdReader* pfr = fd in PosixFdReader.mapping)
(*pfr).hup(flags);
if(globalHupHandler)
globalHupHandler(fd, flags);
}
/+
} else {
// not interested in OUT, we are just reading here.
//
// error or hup might also be reported
// but it shouldn't here since we are only
// using a few types of FD and Xlib will report
// if it dies.
// so instead of thoughtfully handling it, I'll
// just throw. for now at least
throw new Exception("epoll did something else");
}
+/
}
// if we won't call `XPending()` here, libX may delay some internal event delivery.
// i.e. we HAVE to repeatedly call `XPending()` even if libX fd wasn't signalled!
xpending:
if (!done && forceXPending) {
this.mtLock();
scope(exit) this.mtUnlock();
//{ import core.stdc.stdio; printf("*** queued: %d\n", XEventsQueued(this.display, QueueMode.QueuedAlready)); }
while(!done && XPending(display)) {
done = doXNextEvent(this.display);
}
}
}
} else {
// Generic fallback: yes to simple pulse support,
// but NO timer support!
// FIXME: we could probably support the POSIX timer_create
// signal-based option, but I'm in no rush to write it since
// I prefer the fd-based functions.
while (!done && (whileCondition is null || whileCondition() == true) && notExited) {
import core.sys.posix.poll;
pollfd[] pfds;
pollfd[32] pfdsBuffer;
auto len = PosixFdReader.mapping.length + 2;
// FIXME: i should just reuse the buffer
if(len < pfdsBuffer.length)
pfds = pfdsBuffer[0 .. len];
else
pfds = new pollfd[](len);
pfds[0].fd = display.fd;
pfds[0].events = POLLIN;
pfds[0].revents = 0;
int slot = 1;
if(customEventFDRead != -1) {
pfds[slot].fd = customEventFDRead;
pfds[slot].events = POLLIN;
pfds[slot].revents = 0;
slot++;
}
foreach(fd, obj; PosixFdReader.mapping) {
if(!obj.enabled) continue;
pfds[slot].fd = fd;
pfds[slot].events = POLLIN;
pfds[slot].revents = 0;
slot++;
}
auto ret = poll(pfds.ptr, slot, pulseTimeout > 0 ? cast(int) pulseTimeout : -1);
if(ret == -1) throw new Exception("poll");
if(ret == 0) {
// FIXME it may not necessarily time out if events keep coming
if(handlePulse !is null)
handlePulse();
} else {
foreach(s; 0 .. slot) {
if(pfds[s].revents == 0) continue;
if(pfds[s].fd == display.fd) {
while(!done && XPending(display)) {
this.mtLock();
scope(exit) this.mtUnlock();
done = doXNextEvent(this.display);
}
} else if(customEventFDRead != -1 && pfds[s].fd == customEventFDRead) {
import core.sys.posix.unistd : read;
ulong n;
read(customEventFDRead, &n, n.sizeof);
SimpleWindow.processAllCustomEvents();
} else {
auto obj = PosixFdReader.mapping[pfds[s].fd];
if(pfds[s].revents & POLLNVAL) {
obj.dispose();
} else {
obj.ready(pfds[s].revents);
}
}
ret--;
if(ret == 0) break;
}
}
}
}
}
version(Windows) {
int ret = -1;
MSG message;
while(ret != 0 && (whileCondition is null || whileCondition() == true) && notExited) {
eventLoopRound++;
auto wto = SimpleWindow.eventAllQueueTimeoutMSecs();
auto waitResult = MsgWaitForMultipleObjectsEx(
cast(int) handles.length, handles.ptr,
(wto == 0 ? INFINITE : wto), /* timeout */
0x04FF, /* QS_ALLINPUT */
0x0002 /* MWMO_ALERTABLE */ | 0x0004 /* MWMO_INPUTAVAILABLE */);
SimpleWindow.processAllCustomEvents(); // anyway
enum WAIT_OBJECT_0 = 0;
if(waitResult >= WAIT_OBJECT_0 && waitResult < handles.length + WAIT_OBJECT_0) {
auto h = handles[waitResult - WAIT_OBJECT_0];
if(auto e = h in WindowsHandleReader.mapping) {
(*e).ready();
}
} else if(waitResult == handles.length + WAIT_OBJECT_0) {
// message ready
int count;
while(PeekMessage(&message, null, 0, 0, PM_NOREMOVE)) { // need to peek since sometimes MsgWaitForMultipleObjectsEx returns even though GetMessage can block. tbh i don't fully understand it but the docs say it is foreground activation
ret = GetMessage(&message, null, 0, 0);
if(ret == -1)
throw new Exception("GetMessage failed");
TranslateMessage(&message);
DispatchMessage(&message);
count++;
if(count > 10)
break; // take the opportunity to catch up on other events
if(ret == 0) { // WM_QUIT
EventLoop.quitApplication();
break;
}
}
} else if(waitResult == 0x000000C0L /* WAIT_IO_COMPLETION */) {
SleepEx(0, true); // I call this to give it a chance to do stuff like async io
} else if(waitResult == 258L /* WAIT_TIMEOUT */) {
// timeout, should never happen since we aren't using it
} else if(waitResult == 0xFFFFFFFF) {
// failed
throw new Exception("MsgWaitForMultipleObjectsEx failed");
} else {
// idk....
}
}
// return message.wParam;
return 0;
} else {
return 0;
}
}
int run(bool delegate() whileCondition = null) {
if(disposed)
initialize(this.pulseTimeout);
version(X11) {
try {
return loopHelper(whileCondition);
} catch(XDisconnectException e) {
if(e.userRequested) {
foreach(item; CapableOfHandlingNativeEvent.nativeHandleMapping)
item.discardConnectionState();
XCloseDisplay(XDisplayConnection.display);
}
XDisplayConnection.display = null;
this.dispose();
throw e;
}
} else {
return loopHelper(whileCondition);
}
}
}
/++
Provides an icon on the system notification area (also known as the system tray).
If a notification area is not available with the NotificationIcon object is created,
it will silently succeed and simply attempt to create one when an area becomes available.
NotificationAreaIcon on Windows assumes you are on Windows Vista or later.
If this is wrong, pass -version=WindowsXP to dmd when compiling and it will
use the older version.
+/
version(OSXCocoa) {} else // NotYetImplementedException
class NotificationAreaIcon : CapableOfHandlingNativeEvent {
version(X11) {
void recreateAfterDisconnect() {
stateDiscarded = false;
clippixmap = None;
throw new Exception("NOT IMPLEMENTED");
}
bool stateDiscarded;
void discardConnectionState() {
stateDiscarded = true;
}
}
version(X11) {
Image img;
NativeEventHandler getNativeEventHandler() {
return delegate int(XEvent e) {
switch(e.type) {
case EventType.Expose:
//case EventType.VisibilityNotify:
redraw();
break;
case EventType.ClientMessage:
version(sddddd) {
import std.stdio;
writeln("\t", e.xclient.message_type == GetAtom!("_XEMBED")(XDisplayConnection.get));
writeln("\t", e.xclient.format);
writeln("\t", e.xclient.data.l);
}
break;
case EventType.ButtonPress:
auto event = e.xbutton;
if (onClick !is null || onClickEx !is null) {
MouseButton mb = cast(MouseButton)0;
switch (event.button) {
case 1: mb = MouseButton.left; break; // left
case 2: mb = MouseButton.middle; break; // middle
case 3: mb = MouseButton.right; break; // right
case 4: mb = MouseButton.wheelUp; break; // scroll up
case 5: mb = MouseButton.wheelDown; break; // scroll down
case 6: break; // idk
case 7: break; // idk
case 8: mb = MouseButton.backButton; break;
case 9: mb = MouseButton.forwardButton; break;
default:
}
if (mb) {
try { onClick()(mb); } catch (Exception) {}
if (onClickEx !is null) try { onClickEx(event.x_root, event.y_root, mb, cast(ModifierState)event.state); } catch (Exception) {}
}
}
break;
case EventType.EnterNotify:
if (onEnter !is null) {
onEnter(e.xcrossing.x_root, e.xcrossing.y_root, cast(ModifierState)e.xcrossing.state);
}
break;
case EventType.LeaveNotify:
if (onLeave !is null) try { onLeave(); } catch (Exception) {}
break;
case EventType.DestroyNotify:
active = false;
CapableOfHandlingNativeEvent.nativeHandleMapping.remove(nativeHandle);
break;
case EventType.ConfigureNotify:
auto event = e.xconfigure;
this.width = event.width;
this.height = event.height;
//import std.stdio; writeln(width, " x " , height, " @ ", event.x, " ", event.y);
redraw();
break;
default: return 1;
}
return 1;
};
}
/* private */ void hideBalloon() {
balloon.close();
version(with_timer)
timer.destroy();
balloon = null;
version(with_timer)
timer = null;
}
void redraw() {
if (!active) return;
auto display = XDisplayConnection.get;
auto gc = DefaultGC(display, DefaultScreen(display));
XClearWindow(display, nativeHandle);
XSetClipMask(display, gc, clippixmap);
XSetForeground(display, gc,
cast(uint) 0 << 16 |
cast(uint) 0 << 8 |
cast(uint) 0);
XFillRectangle(display, nativeHandle, gc, 0, 0, width, height);
if (img is null) {
XSetForeground(display, gc,
cast(uint) 0 << 16 |
cast(uint) 127 << 8 |
cast(uint) 0);
XFillArc(display, nativeHandle,
gc, width / 4, height / 4, width * 2 / 4, height * 2 / 4, 0 * 64, 360 * 64);
} else {
int dx = 0;
int dy = 0;
if(width > img.width)
dx = (width - img.width) / 2;
if(height > img.height)
dy = (height - img.height) / 2;
XSetClipOrigin(display, gc, dx, dy);
if (img.usingXshm)
XShmPutImage(display, cast(Drawable)nativeHandle, gc, img.handle, 0, 0, dx, dy, img.width, img.height, false);
else
XPutImage(display, cast(Drawable)nativeHandle, gc, img.handle, 0, 0, dx, dy, img.width, img.height);
}
XSetClipMask(display, gc, None);
flushGui();
}
static Window getTrayOwner() {
auto display = XDisplayConnection.get;
auto i = cast(int) DefaultScreen(display);
if(i < 10 && i >= 0) {
static Atom atom;
if(atom == None)
atom = XInternAtom(display, cast(char*) ("_NET_SYSTEM_TRAY_S"~(cast(char) (i + '0')) ~ '\0').ptr, false);
return XGetSelectionOwner(display, atom);
}
return None;
}
static void sendTrayMessage(arch_long message, arch_long d1, arch_long d2, arch_long d3) {
auto to = getTrayOwner();
auto display = XDisplayConnection.get;
XEvent ev;
ev.xclient.type = EventType.ClientMessage;
ev.xclient.window = to;
ev.xclient.message_type = GetAtom!("_NET_SYSTEM_TRAY_OPCODE", true)(display);
ev.xclient.format = 32;
ev.xclient.data.l[0] = CurrentTime;
ev.xclient.data.l[1] = message;
ev.xclient.data.l[2] = d1;
ev.xclient.data.l[3] = d2;
ev.xclient.data.l[4] = d3;
XSendEvent(XDisplayConnection.get, to, false, EventMask.NoEventMask, &ev);
}
private static NotificationAreaIcon[] activeIcons;
// FIXME: possible leak with this stuff, should be able to clear it and stuff.
private void newManager() {
close();
createXWin();
if(this.clippixmap)
XFreePixmap(XDisplayConnection.get, clippixmap);
if(this.originalMemoryImage)
this.icon = this.originalMemoryImage;
else if(this.img)
this.icon = this.img;
}
private void createXWin () {
// create window
auto display = XDisplayConnection.get;
// to check for MANAGER on root window to catch new/changed tray owners
XDisplayConnection.addRootInput(EventMask.StructureNotifyMask);
// so if a thing does appear, we can handle it
foreach(ai; activeIcons)
if(ai is this)
goto alreadythere;
activeIcons ~= this;
alreadythere:
// and check for an existing tray
auto trayOwner = getTrayOwner();
if(trayOwner == None)
return;
//throw new Exception("No notification area found");
Visual* v = cast(Visual*) CopyFromParent;
/+
auto visualProp = getX11PropertyData(trayOwner, GetAtom!("_NET_SYSTEM_TRAY_VISUAL", true)(display));
if(visualProp !is null) {
c_ulong[] info = cast(c_ulong[]) visualProp;
if(info.length == 1) {
auto vid = info[0];
int returned;
XVisualInfo t;
t.visualid = vid;
auto got = XGetVisualInfo(display, VisualIDMask, &t, &returned);
if(got !is null) {
if(returned == 1) {
v = got.visual;
import std.stdio;
writeln("using special visual ", *got);
}
XFree(got);
}
}
}
+/
auto nativeWindow = XCreateWindow(display, RootWindow(display, DefaultScreen(display)), 0, 0, 16, 16, 0, 24, InputOutput, v, 0, null);
assert(nativeWindow);
XSetWindowBackgroundPixmap(display, nativeWindow, 1 /* ParentRelative */);
nativeHandle = nativeWindow;
///+
arch_ulong[2] info;
info[0] = 0;
info[1] = 1;
string title = this.name is null ? "simpledisplay.d program" : this.name;
auto XA_UTF8 = XInternAtom(display, "UTF8_STRING".ptr, false);
auto XA_NETWM_NAME = XInternAtom(display, "_NET_WM_NAME".ptr, false);
XChangeProperty(display, nativeWindow, XA_NETWM_NAME, XA_UTF8, 8, PropModeReplace, title.ptr, cast(uint)title.length);
XChangeProperty(
display,
nativeWindow,
GetAtom!("_XEMBED_INFO", true)(display),
GetAtom!("_XEMBED_INFO", true)(display),
32 /* bits */,
0 /*PropModeReplace*/,
info.ptr,
2);
import core.sys.posix.unistd;
arch_ulong pid = getpid();
XChangeProperty(
display,
nativeWindow,
GetAtom!("_NET_WM_PID", true)(display),
XA_CARDINAL,
32 /* bits */,
0 /*PropModeReplace*/,
&pid,
1);
updateNetWmIcon();
if (sdpyWindowClassStr !is null && sdpyWindowClassStr[0]) {
//{ import core.stdc.stdio; printf("winclass: [%s]\n", sdpyWindowClassStr); }
XClassHint klass;
XWMHints wh;
XSizeHints size;
klass.res_name = sdpyWindowClassStr;
klass.res_class = sdpyWindowClassStr;
XSetWMProperties(display, nativeWindow, null, null, null, 0, &size, &wh, &klass);
}
// believe it or not, THIS is what xfce needed for the 9999 issue
XSizeHints sh;
c_long spr;
XGetWMNormalHints(display, nativeWindow, &sh, &spr);
sh.flags |= PMaxSize | PMinSize;
// FIXME maybe nicer resizing
sh.min_width = 16;
sh.min_height = 16;
sh.max_width = 16;
sh.max_height = 16;
XSetWMNormalHints(display, nativeWindow, &sh);
//+/
XSelectInput(display, nativeWindow,
EventMask.ButtonPressMask | EventMask.ExposureMask | EventMask.StructureNotifyMask | EventMask.VisibilityChangeMask |
EventMask.EnterWindowMask | EventMask.LeaveWindowMask);
sendTrayMessage(SYSTEM_TRAY_REQUEST_DOCK, nativeWindow, 0, 0);
CapableOfHandlingNativeEvent.nativeHandleMapping[nativeWindow] = this;
active = true;
}
void updateNetWmIcon() {
if(img is null) return;
auto display = XDisplayConnection.get;
// FIXME: ensure this is correct
arch_ulong[] buffer;
auto imgMi = img.toTrueColorImage;
buffer ~= imgMi.width;
buffer ~= imgMi.height;
foreach(c; imgMi.imageData.colors) {
arch_ulong b;
b |= c.a << 24;
b |= c.r << 16;
b |= c.g << 8;
b |= c.b;
buffer ~= b;
}
XChangeProperty(
display,
nativeHandle,
GetAtom!"_NET_WM_ICON"(display),
GetAtom!"CARDINAL"(display),
32 /* bits */,
0 /*PropModeReplace*/,
buffer.ptr,
cast(int) buffer.length);
}
private SimpleWindow balloon;
version(with_timer)
private Timer timer;
private Window nativeHandle;
private Pixmap clippixmap = None;
private int width = 16;
private int height = 16;
private bool active = false;
void delegate (int x, int y, MouseButton button, ModifierState mods) onClickEx; /// x and y are globals (relative to root window). X11 only.
void delegate (int x, int y, ModifierState mods) onEnter; /// x and y are global window coordinates. X11 only.
void delegate () onLeave; /// X11 only.
@property bool closed () const pure nothrow @safe @nogc { return !active; } ///
/// X11 only. Get global window coordinates and size. This can be used to show various notifications.
void getWindowRect (out int x, out int y, out int width, out int height) {
if (!active) { width = 1; height = 1; return; } // 1: just in case
Window dummyw;
auto dpy = XDisplayConnection.get;
//XWindowAttributes xwa;
//XGetWindowAttributes(dpy, nativeHandle, &xwa);
//XTranslateCoordinates(dpy, nativeHandle, RootWindow(dpy, DefaultScreen(dpy)), xwa.x, xwa.y, &x, &y, &dummyw);
XTranslateCoordinates(dpy, nativeHandle, RootWindow(dpy, DefaultScreen(dpy)), x, y, &x, &y, &dummyw);
width = this.width;
height = this.height;
}
}
/+
What I actually want from this:
* set / change: icon, tooltip
* handle: mouse click, right click
* show: notification bubble.
+/
version(Windows) {
WindowsIcon win32Icon;
HWND hwnd;
NOTIFYICONDATAW data;
NativeEventHandler getNativeEventHandler() {
return delegate int(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, out int mustReturn) {
if(msg == WM_USER) {
auto event = LOWORD(lParam);
auto iconId = HIWORD(lParam);
//auto x = GET_X_LPARAM(wParam);
//auto y = GET_Y_LPARAM(wParam);
switch(event) {
case WM_LBUTTONDOWN:
onClick()(MouseButton.left);
break;
case WM_RBUTTONDOWN:
onClick()(MouseButton.right);
break;
case WM_MBUTTONDOWN:
onClick()(MouseButton.middle);
break;
case WM_MOUSEMOVE:
// sent, we could use it.
break;
case WM_MOUSEWHEEL:
// NOT SENT
break;
//case NIN_KEYSELECT:
//case NIN_SELECT:
//break;
default: {}
}
}
return 0;
};
}
enum NIF_SHOWTIP = 0x00000080;
private static struct NOTIFYICONDATAW {
DWORD cbSize;
HWND hWnd;
UINT uID;
UINT uFlags;
UINT uCallbackMessage;
HICON hIcon;
WCHAR[128] szTip;
DWORD dwState;
DWORD dwStateMask;
WCHAR[256] szInfo;
union {
UINT uTimeout;
UINT uVersion;
}
WCHAR[64] szInfoTitle;
DWORD dwInfoFlags;
GUID guidItem;
HICON hBalloonIcon;
}
}
/++
Note that on Windows, only left, right, and middle buttons are sent.
Mouse wheel buttons are NOT set, so don't rely on those events if your
program is meant to be used on Windows too.
+/
this(string name, MemoryImage icon, void delegate(MouseButton button) onClick) {
// The canonical constructor for Windows needs the MemoryImage, so it is here,
// but on X, we need an Image, so its canonical ctor is there. They should
// forward to each other though.
version(X11) {
this.name = name;
this.onClick = onClick;
createXWin();
this.icon = icon;
} else version(Windows) {
this.onClick = onClick;
this.win32Icon = new WindowsIcon(icon);
HINSTANCE hInstance = cast(HINSTANCE) GetModuleHandle(null);
static bool registered = false;
if(!registered) {
WNDCLASSEX wc;
wc.cbSize = wc.sizeof;
wc.hInstance = hInstance;
wc.lpfnWndProc = &WndProc;
wc.lpszClassName = "arsd_simpledisplay_notification_icon"w.ptr;
if(!RegisterClassExW(&wc))
throw new WindowsApiException("RegisterClass");
registered = true;
}
this.hwnd = CreateWindowW("arsd_simpledisplay_notification_icon"w.ptr, "test"w.ptr /* name */, 0 /* dwStyle */, 0, 0, 0, 0, HWND_MESSAGE, null, hInstance, null);
if(hwnd is null)
throw new Exception("CreateWindow");
data.cbSize = data.sizeof;
data.hWnd = hwnd;
data.uID = cast(uint) cast(void*) this;
data.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP | NIF_STATE | NIF_SHOWTIP /* use default tooltip, for now. */;
// NIF_INFO means show balloon
data.uCallbackMessage = WM_USER;
data.hIcon = this.win32Icon.hIcon;
data.szTip = ""; // FIXME
data.dwState = 0; // NIS_HIDDEN; // windows vista
data.dwStateMask = NIS_HIDDEN; // windows vista
data.uVersion = 4; // NOTIFYICON_VERSION_4; // Windows Vista and up
Shell_NotifyIcon(NIM_ADD, cast(NOTIFYICONDATA*) &data);
CapableOfHandlingNativeEvent.nativeHandleMapping[this.hwnd] = this;
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
/// ditto
this(string name, Image icon, void delegate(MouseButton button) onClick) {
version(X11) {
this.onClick = onClick;
this.name = name;
createXWin();
this.icon = icon;
} else version(Windows) {
this(name, icon is null ? null : icon.toTrueColorImage(), onClick);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
version(X11) {
/++
X-specific extension (for now at least)
+/
this(string name, MemoryImage icon, void delegate(int x, int y, MouseButton button, ModifierState mods) onClickEx) {
this.onClickEx = onClickEx;
createXWin();
if (icon !is null) this.icon = icon;
}
/// ditto
this(string name, Image icon, void delegate(int x, int y, MouseButton button, ModifierState mods) onClickEx) {
this.onClickEx = onClickEx;
createXWin();
this.icon = icon;
}
}
private void delegate (MouseButton button) onClick_;
///
@property final void delegate(MouseButton) onClick() {
if(onClick_ is null)
onClick_ = delegate void(MouseButton) {};
return onClick_;
}
/// ditto
@property final void onClick(void delegate(MouseButton) handler) {
// I made this a property setter so we can wrap smaller arg
// delegates and just forward all to onClickEx or something.
onClick_ = handler;
}
string name_;
@property void name(string n) {
name_ = n;
}
@property string name() {
return name_;
}
private MemoryImage originalMemoryImage;
///
@property void icon(MemoryImage i) {
version(X11) {
this.originalMemoryImage = i;
if (!active) return;
if (i !is null) {
this.img = Image.fromMemoryImage(i);
this.clippixmap = transparencyMaskFromMemoryImage(i, nativeHandle);
//import std.stdio; writeln("using pixmap ", clippixmap);
updateNetWmIcon();
redraw();
} else {
if (this.img !is null) {
this.img = null;
redraw();
}
}
} else version(Windows) {
this.win32Icon = new WindowsIcon(i);
data.uFlags = NIF_ICON;
data.hIcon = this.win32Icon.hIcon;
Shell_NotifyIcon(NIM_MODIFY, cast(NOTIFYICONDATA*) &data);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
/// ditto
@property void icon (Image i) {
version(X11) {
if (!active) return;
if (i !is img) {
originalMemoryImage = null;
img = i;
redraw();
}
} else version(Windows) {
this.icon(i is null ? null : i.toTrueColorImage());
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
/++
Shows a balloon notification. You can only show one balloon at a time, if you call
it twice while one is already up, the first balloon will be replaced.
The user is free to block notifications and they will automatically disappear after
a timeout period.
Params:
title = Title of the notification. Must be 40 chars or less or the OS may truncate it.
message = The message to pop up. Must be 220 chars or less or the OS may truncate it.
icon = the icon to display with the notification. If null, it uses your existing icon.
onclick = delegate called if the user clicks the balloon. (not yet implemented)
timeout = your suggested timeout period. The operating system is free to ignore your suggestion.
+/
void showBalloon(string title, string message, MemoryImage icon = null, void delegate() onclick = null, int timeout = 2_500) {
bool useCustom = true;
version(libnotify) {
if(onclick is null) // libnotify impl doesn't support callbacks yet because it doesn't do a dbus message loop
try {
if(!active) return;
if(libnotify is null) {
libnotify = new C_DynamicLibrary("libnotify.so");
libnotify.call!("notify_init", int, const char*)()((ApplicationName ~ "\0").ptr);
}
auto n = libnotify.call!("notify_notification_new", void*, const char*, const char*, const char*)()((title~"\0").ptr, (message~"\0").ptr, null /* icon */);
libnotify.call!("notify_notification_set_timeout", void, void*, int)()(n, timeout);
if(onclick) {
libnotify_action_delegates[libnotify_action_delegates_count] = onclick;
libnotify.call!("notify_notification_add_action", void, void*, const char*, const char*, typeof(&libnotify_action_callback_sdpy), void*, void*)()(n, "DEFAULT".ptr, "Go".ptr, &libnotify_action_callback_sdpy, cast(void*) libnotify_action_delegates_count, null);
libnotify_action_delegates_count++;
}
// FIXME icon
// set hint image-data
// set default action for onclick
void* error;
libnotify.call!("notify_notification_show", bool, void*, void**)()(n, &error);
useCustom = false;
} catch(Exception e) {
}
}
version(X11) {
if(useCustom) {
if(!active) return;
if(balloon) {
hideBalloon();
}
// I know there are two specs for this, but one is never
// implemented by any window manager I have ever seen, and
// the other is a bloated mess and too complicated for simpledisplay...
// so doing my own little window instead.
balloon = new SimpleWindow(380, 120, null, OpenGlOptions.no, Resizability.fixedSize, WindowTypes.notification, WindowFlags.dontAutoShow/*, window*/);
int x, y, width, height;
getWindowRect(x, y, width, height);
int bx = x - balloon.width;
int by = y - balloon.height;
if(bx < 0)
bx = x + width + balloon.width;
if(by < 0)
by = y + height;
// just in case, make sure it is actually on scren
if(bx < 0)
bx = 0;
if(by < 0)
by = 0;
balloon.move(bx, by);
auto painter = balloon.draw();
painter.fillColor = Color(220, 220, 220);
painter.outlineColor = Color.black;
painter.drawRectangle(Point(0, 0), balloon.width, balloon.height);
auto iconWidth = icon is null ? 0 : icon.width;
if(icon)
painter.drawImage(Point(4, 4), Image.fromMemoryImage(icon));
iconWidth += 6; // margin around the icon
// draw a close button
painter.outlineColor = Color(44, 44, 44);
painter.fillColor = Color(255, 255, 255);
painter.drawRectangle(Point(balloon.width - 15, 3), 13, 13);
painter.pen = Pen(Color.black, 3);
painter.drawLine(Point(balloon.width - 14, 4), Point(balloon.width - 4, 14));
painter.drawLine(Point(balloon.width - 4, 4), Point(balloon.width - 14, 13));
painter.pen = Pen(Color.black, 1);
painter.fillColor = Color(220, 220, 220);
// Draw the title and message
painter.drawText(Point(4 + iconWidth, 4), title);
painter.drawLine(
Point(4 + iconWidth, 4 + painter.fontHeight + 1),
Point(balloon.width - 4, 4 + painter.fontHeight + 1),
);
painter.drawText(Point(4 + iconWidth, 4 + painter.fontHeight + 4), message);
balloon.setEventHandlers(
(MouseEvent ev) {
if(ev.type == MouseEventType.buttonPressed) {
if(ev.x > balloon.width - 16 && ev.y < 16)
hideBalloon();
else if(onclick)
onclick();
}
}
);
balloon.show();
version(with_timer)
timer = new Timer(timeout, &hideBalloon);
else {} // FIXME
}
} else version(Windows) {
enum NIF_INFO = 0x00000010;
data.uFlags = NIF_INFO;
// FIXME: go back to the last valid unicode code point
if(title.length > 40)
title = title[0 .. 40];
if(message.length > 220)
message = message[0 .. 220];
enum NIIF_RESPECT_QUIET_TIME = 0x00000080;
enum NIIF_LARGE_ICON = 0x00000020;
enum NIIF_NOSOUND = 0x00000010;
enum NIIF_USER = 0x00000004;
enum NIIF_ERROR = 0x00000003;
enum NIIF_WARNING = 0x00000002;
enum NIIF_INFO = 0x00000001;
enum NIIF_NONE = 0;
WCharzBuffer t = WCharzBuffer(title);
WCharzBuffer m = WCharzBuffer(message);
t.copyInto(data.szInfoTitle);
m.copyInto(data.szInfo);
data.dwInfoFlags = NIIF_RESPECT_QUIET_TIME;
if(icon !is null) {
auto i = new WindowsIcon(icon);
data.hBalloonIcon = i.hIcon;
data.dwInfoFlags |= NIIF_USER;
}
Shell_NotifyIcon(NIM_MODIFY, cast(NOTIFYICONDATA*) &data);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
///
//version(Windows)
void show() {
version(X11) {
if(!hidden)
return;
sendTrayMessage(SYSTEM_TRAY_REQUEST_DOCK, nativeHandle, 0, 0);
hidden = false;
} else version(Windows) {
data.uFlags = NIF_STATE;
data.dwState = 0; // NIS_HIDDEN; // windows vista
data.dwStateMask = NIS_HIDDEN; // windows vista
Shell_NotifyIcon(NIM_MODIFY, cast(NOTIFYICONDATA*) &data);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
version(X11)
bool hidden = false;
///
//version(Windows)
void hide() {
version(X11) {
if(hidden)
return;
hidden = true;
XUnmapWindow(XDisplayConnection.get, nativeHandle);
} else version(Windows) {
data.uFlags = NIF_STATE;
data.dwState = NIS_HIDDEN; // windows vista
data.dwStateMask = NIS_HIDDEN; // windows vista
Shell_NotifyIcon(NIM_MODIFY, cast(NOTIFYICONDATA*) &data);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
///
void close () {
version(X11) {
if (active) {
active = false; // event handler will set this too, but meh
XUnmapWindow(XDisplayConnection.get, nativeHandle); // 'cause why not; let's be polite
XDestroyWindow(XDisplayConnection.get, nativeHandle);
flushGui();
}
} else version(Windows) {
Shell_NotifyIcon(NIM_DELETE, cast(NOTIFYICONDATA*) &data);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
~this() {
version(X11)
if(clippixmap != None)
XFreePixmap(XDisplayConnection.get, clippixmap);
close();
}
}
version(X11)
/// Call `XFreePixmap` on the return value.
Pixmap transparencyMaskFromMemoryImage(MemoryImage i, Window window) {
char[] data = new char[](i.width * i.height / 8 + 2);
data[] = 0;
int bitOffset = 0;
foreach(c; i.getAsTrueColorImage().imageData.colors) { // FIXME inefficient unnecessary conversion in palette cases
ubyte v = c.a > 128 ? 1 : 0;
data[bitOffset / 8] |= v << (bitOffset%8);
bitOffset++;
}
auto handle = XCreateBitmapFromData(XDisplayConnection.get, cast(Drawable) window, data.ptr, i.width, i.height);
return handle;
}
// basic functions to make timers
/**
A timer that will trigger your function on a given interval.
You create a timer with an interval and a callback. It will continue
to fire on the interval until it is destroyed.
There are currently no one-off timers (instead, just create one and
destroy it when it is triggered) nor are there pause/resume functions -
the timer must again be destroyed and recreated if you want to pause it.
auto timer = new Timer(50, { it happened!; });
timer.destroy();
Timers can only be expected to fire when the event loop is running and only
once per iteration through the event loop.
History:
Prior to December 9, 2020, a timer pulse set too high with a handler too
slow could lock up the event loop. It now guarantees other things will
get a chance to run between timer calls, even if that means not keeping up
with the requested interval.
*/
version(with_timer) {
class Timer {
// FIXME: needs pause and unpause
// FIXME: I might add overloads for ones that take a count of
// how many elapsed since last time (on Windows, it will divide
// the ticks thing given, on Linux it is just available) and
// maybe one that takes an instance of the Timer itself too
/// Create a timer with a callback when it triggers.
this(int intervalInMilliseconds, void delegate() onPulse) {
assert(onPulse !is null);
this.intervalInMilliseconds = intervalInMilliseconds;
this.onPulse = onPulse;
version(Windows) {
/*
handle = SetTimer(null, handle, intervalInMilliseconds, &timerCallback);
if(handle == 0)
throw new Exception("SetTimer fail");
*/
// thanks to Archival 998 for the WaitableTimer blocks
handle = CreateWaitableTimer(null, false, null);
long initialTime = -intervalInMilliseconds;
if(handle is null || !SetWaitableTimer(handle, cast(LARGE_INTEGER*)&initialTime, intervalInMilliseconds, &timerCallback, handle, false))
throw new Exception("SetWaitableTimer Failed");
mapping[handle] = this;
} else version(linux) {
static import ep = core.sys.linux.epoll;
import core.sys.linux.timerfd;
fd = timerfd_create(CLOCK_MONOTONIC, 0);
if(fd == -1)
throw new Exception("timer create failed");
mapping[fd] = this;
itimerspec value;
value.it_value.tv_sec = cast(int) (intervalInMilliseconds / 1000);
value.it_value.tv_nsec = (intervalInMilliseconds % 1000) * 1000_000;
value.it_interval.tv_sec = cast(int) (intervalInMilliseconds / 1000);
value.it_interval.tv_nsec = (intervalInMilliseconds % 1000) * 1000_000;
if(timerfd_settime(fd, 0, &value, null) == -1)
throw new Exception("couldn't make pulse timer");
version(with_eventloop) {
import arsd.eventloop;
addFileEventListeners(fd, &trigger, null, null);
} else {
prepareEventLoop();
ep.epoll_event ev = void;
ev.events = ep.EPOLLIN;
ev.data.fd = fd;
ep.epoll_ctl(epollFd, ep.EPOLL_CTL_ADD, fd, &ev);
}
} else featureNotImplemented();
}
private int intervalInMilliseconds;
// just cuz I sometimes call it this.
alias dispose = destroy;
/// Stop and destroy the timer object.
void destroy() {
version(Windows) {
if(handle) {
// KillTimer(null, handle);
CancelWaitableTimer(cast(void*)handle);
mapping.remove(handle);
CloseHandle(handle);
handle = null;
}
} else version(linux) {
if(fd != -1) {
import unix = core.sys.posix.unistd;
static import ep = core.sys.linux.epoll;
version(with_eventloop) {
import arsd.eventloop;
removeFileEventListeners(fd);
} else {
ep.epoll_event ev = void;
ev.events = ep.EPOLLIN;
ev.data.fd = fd;
ep.epoll_ctl(epollFd, ep.EPOLL_CTL_DEL, fd, &ev);
}
unix.close(fd);
mapping.remove(fd);
fd = -1;
}
} else featureNotImplemented();
}
~this() {
destroy();
}
void changeTime(int intervalInMilliseconds)
{
this.intervalInMilliseconds = intervalInMilliseconds;
version(Windows)
{
if(handle)
{
//handle = SetTimer(null, handle, intervalInMilliseconds, &timerCallback);
long initialTime = -intervalInMilliseconds;
if(handle is null || !SetWaitableTimer(handle, cast(LARGE_INTEGER*)&initialTime, intervalInMilliseconds, &timerCallback, handle, false))
throw new Exception("couldn't change pulse timer");
}
}
}
private:
void delegate() onPulse;
int lastEventLoopRoundTriggered;
void trigger() {
version(linux) {
import unix = core.sys.posix.unistd;
long val;
unix.read(fd, &val, val.sizeof); // gotta clear the pipe
} else version(Windows) {
if(this.lastEventLoopRoundTriggered == eventLoopRound)
return; // never try to actually run faster than the event loop
lastEventLoopRoundTriggered = eventLoopRound;
} else featureNotImplemented();
onPulse();
}
version(Windows)
void rearm() {
}
version(Windows)
extern(Windows)
//static void timerCallback(HWND, UINT, UINT_PTR timer, DWORD dwTime) nothrow {
static void timerCallback(HANDLE timer, DWORD lowTime, DWORD hiTime) nothrow {
if(Timer* t = timer in mapping) {
try
(*t).trigger();
catch(Exception e) { sdpy_abort(e); assert(0); }
}
}
version(Windows) {
//UINT_PTR handle;
//static Timer[UINT_PTR] mapping;
HANDLE handle;
__gshared Timer[HANDLE] mapping;
} else version(linux) {
int fd = -1;
__gshared Timer[int] mapping;
} else static assert(0, "timer not supported");
}
}
version(Windows)
private int eventLoopRound;
version(Windows)
/// Lets you add HANDLEs to the event loop. Not meant to be used for async I/O per se, but for other handles (it can only handle a few handles at a time.) Only works on certain types of handles! See: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-msgwaitformultipleobjectsex
class WindowsHandleReader {
///
this(void delegate() onReady, HANDLE handle) {
this.onReady = onReady;
this.handle = handle;
mapping[handle] = this;
enable();
}
///
void enable() {
auto el = EventLoop.get().impl;
el.handles ~= handle;
}
///
void disable() {
auto el = EventLoop.get().impl;
for(int i = 0; i < el.handles.length; i++) {
if(el.handles[i] is handle) {
el.handles[i] = el.handles[$-1];
el.handles = el.handles[0 .. $-1];
return;
}
}
}
void dispose() {
disable();
if(handle)
mapping.remove(handle);
handle = null;
}
void ready() {
if(onReady)
onReady();
}
HANDLE handle;
void delegate() onReady;
__gshared WindowsHandleReader[HANDLE] mapping;
}
version(Posix)
/// Lets you add files to the event loop for reading. Use at your own risk.
class PosixFdReader {
///
this(void delegate() onReady, int fd, bool captureReads = true, bool captureWrites = false) {
this((int, bool, bool) { onReady(); }, fd, captureReads, captureWrites);
}
///
this(void delegate(int) onReady, int fd, bool captureReads = true, bool captureWrites = false) {
this((int fd, bool, bool) { onReady(fd); }, fd, captureReads, captureWrites);
}
///
this(void delegate(int fd, bool read, bool write) onReady, int fd, bool captureReads = true, bool captureWrites = false) {
this.onReady = onReady;
this.fd = fd;
this.captureWrites = captureWrites;
this.captureReads = captureReads;
mapping[fd] = this;
version(with_eventloop) {
import arsd.eventloop;
addFileEventListeners(fd, &readyel);
} else {
enable();
}
}
bool captureReads;
bool captureWrites;
version(with_eventloop) {} else
///
void enable() {
prepareEventLoop();
enabled = true;
version(linux) {
static import ep = core.sys.linux.epoll;
ep.epoll_event ev = void;
ev.events = (captureReads ? ep.EPOLLIN : 0) | (captureWrites ? ep.EPOLLOUT : 0);
//import std.stdio; writeln("enable ", fd, " ", captureReads, " ", captureWrites);
ev.data.fd = fd;
ep.epoll_ctl(epollFd, ep.EPOLL_CTL_ADD, fd, &ev);
} else {
}
}
version(with_eventloop) {} else
///
void disable() {
prepareEventLoop();
enabled = false;
version(linux) {
static import ep = core.sys.linux.epoll;
ep.epoll_event ev = void;
ev.events = (captureReads ? ep.EPOLLIN : 0) | (captureWrites ? ep.EPOLLOUT : 0);
//import std.stdio; writeln("disable ", fd, " ", captureReads, " ", captureWrites);
ev.data.fd = fd;
ep.epoll_ctl(epollFd, ep.EPOLL_CTL_DEL, fd, &ev);
}
}
version(with_eventloop) {} else
///
void dispose() {
if(enabled)
disable();
if(fd != -1)
mapping.remove(fd);
fd = -1;
}
void delegate(int, bool, bool) onReady;
version(with_eventloop)
void readyel() {
onReady(fd, true, true);
}
void ready(uint flags) {
version(linux) {
static import ep = core.sys.linux.epoll;
onReady(fd, (flags & ep.EPOLLIN) ? true : false, (flags & ep.EPOLLOUT) ? true : false);
} else {
import core.sys.posix.poll;
onReady(fd, (flags & POLLIN) ? true : false, (flags & POLLOUT) ? true : false);
}
}
void hup(uint flags) {
if(onHup)
onHup();
}
void delegate() onHup;
int fd = -1;
private bool enabled;
__gshared PosixFdReader[int] mapping;
}
// basic functions to access the clipboard
/+
http://msdn.microsoft.com/en-us/library/windows/desktop/ff729168%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms649039%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms649035%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms649051%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms649037%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms649035%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms649016%28v=vs.85%29.aspx
+/
/++
this does a delegate because it is actually an async call on X...
the receiver may never be called if the clipboard is empty or unavailable
gets plain text from the clipboard.
+/
void getClipboardText(SimpleWindow clipboardOwner, void delegate(in char[]) receiver) {
version(Windows) {
HWND hwndOwner = clipboardOwner ? clipboardOwner.impl.hwnd : null;
if(OpenClipboard(hwndOwner) == 0)
throw new Exception("OpenClipboard");
scope(exit)
CloseClipboard();
// see: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getpriorityclipboardformat
if(auto dataHandle = GetClipboardData(CF_UNICODETEXT)) {
if(auto data = cast(wchar*) GlobalLock(dataHandle)) {
scope(exit)
GlobalUnlock(dataHandle);
// FIXME: CR/LF conversions
// FIXME: I might not have to copy it now that the receiver is in char[] instead of string
int len = 0;
auto d = data;
while(*d) {
d++;
len++;
}
string s;
s.reserve(len);
foreach(dchar ch; data[0 .. len]) {
s ~= ch;
}
receiver(s);
}
}
} else version(X11) {
getX11Selection!"CLIPBOARD"(clipboardOwner, receiver);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
// FIXME: a clipboard listener might be cool btw
/++
this does a delegate because it is actually an async call on X...
the receiver may never be called if the clipboard is empty or unavailable
gets image from the clipboard.
templated because it introduces an optional dependency on arsd.bmp
+/
void getClipboardImage()(SimpleWindow clipboardOwner, void delegate(MemoryImage) receiver) {
version(Windows) {
HWND hwndOwner = clipboardOwner ? clipboardOwner.impl.hwnd : null;
if(OpenClipboard(hwndOwner) == 0)
throw new Exception("OpenClipboard");
scope(exit)
CloseClipboard();
if(auto dataHandle = GetClipboardData(CF_DIBV5)) {
if(auto data = cast(ubyte*) GlobalLock(dataHandle)) {
scope(exit)
GlobalUnlock(dataHandle);
auto len = GlobalSize(dataHandle);
import arsd.bmp;
auto img = readBmp(data[0 .. len], false);
receiver(img);
}
}
} else version(X11) {
getX11Selection!"CLIPBOARD"(clipboardOwner, receiver);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
version(Windows)
struct WCharzBuffer {
wchar[] buffer;
wchar[256] staticBuffer = void;
size_t length() {
return buffer.length;
}
wchar* ptr() {
return buffer.ptr;
}
wchar[] slice() {
return buffer;
}
void copyInto(R)(ref R r) {
static if(is(R == wchar[N], size_t N)) {
r[0 .. this.length] = slice[];
r[this.length] = 0;
} else static assert(0, "can only copy into wchar[n], not " ~ R.stringof);
}
/++
conversionFlags = [WindowsStringConversionFlags]
+/
this(in char[] data, int conversionFlags = 0) {
conversionFlags |= WindowsStringConversionFlags.zeroTerminate; // this ALWAYS zero terminates cuz of its name
auto sz = sizeOfConvertedWstring(data, conversionFlags);
if(sz > staticBuffer.length)
buffer = new wchar[](sz);
else
buffer = staticBuffer[];
buffer = makeWindowsString(data, buffer, conversionFlags);
}
}
version(Windows)
int sizeOfConvertedWstring(in char[] s, int conversionFlags) {
int size = 0;
if(conversionFlags & WindowsStringConversionFlags.convertNewLines) {
// need to convert line endings, which means the length will get bigger.
// BTW I betcha this could be faster with some simd stuff.
char last;
foreach(char ch; s) {
if(ch == 10 && last != 13)
size++; // will add a 13 before it...
size++;
last = ch;
}
} else {
// no conversion necessary, just estimate based on length
/*
I don't think there's any string with a longer length
in code units when encoded in UTF-16 than it has in UTF-8.
This will probably over allocate, but that's OK.
*/
size = cast(int) s.length;
}
if(conversionFlags & WindowsStringConversionFlags.zeroTerminate)
size++;
return size;
}
version(Windows)
enum WindowsStringConversionFlags : int {
zeroTerminate = 1,
convertNewLines = 2,
}
version(Windows)
class WindowsApiException : Exception {
char[256] buffer;
this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) {
assert(msg.length < 100);
auto error = GetLastError();
buffer[0 .. msg.length] = msg;
buffer[msg.length] = ' ';
int pos = cast(int) msg.length + 1;
if(error == 0)
buffer[pos++] = '0';
else {
auto ec = error;
auto init = pos;
while(ec) {
buffer[pos++] = (ec % 10) + '0';
ec /= 10;
}
buffer[pos++] = ' ';
size_t size = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, null, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &(buffer[pos]), cast(DWORD) buffer.length - pos, null);
pos += size;
}
super(cast(string) buffer[0 .. pos], file, line, next);
}
}
class ErrnoApiException : Exception {
char[256] buffer;
this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) {
assert(msg.length < 100);
import core.stdc.errno;
auto error = errno;
buffer[0 .. msg.length] = msg;
buffer[msg.length] = ' ';
int pos = cast(int) msg.length + 1;
if(error == 0)
buffer[pos++] = '0';
else {
auto init = pos;
while(error) {
buffer[pos++] = (error % 10) + '0';
error /= 10;
}
for(int i = 0; i < (pos - init) / 2; i++) {
char c = buffer[i + init];
buffer[i + init] = buffer[pos - (i + init) - 1];
buffer[pos - (i + init) - 1] = c;
}
}
super(cast(string) buffer[0 .. pos], file, line, next);
}
}
version(Windows)
wchar[] makeWindowsString(in char[] str, wchar[] buffer, int conversionFlags = WindowsStringConversionFlags.zeroTerminate) {
if(str.length == 0)
return null;
int pos = 0;
dchar last;
foreach(dchar c; str) {
if(c <= 0xFFFF) {
if((conversionFlags & WindowsStringConversionFlags.convertNewLines) && c == 10 && last != 13)
buffer[pos++] = 13;
buffer[pos++] = cast(wchar) c;
} else if(c <= 0x10FFFF) {
buffer[pos++] = cast(wchar)((((c - 0x10000) >> 10) & 0x3FF) + 0xD800);
buffer[pos++] = cast(wchar)(((c - 0x10000) & 0x3FF) + 0xDC00);
}
last = c;
}
if(conversionFlags & WindowsStringConversionFlags.zeroTerminate) {
buffer[pos] = 0;
}
return buffer[0 .. pos];
}
version(Windows)
char[] makeUtf8StringFromWindowsString(in wchar[] str, char[] buffer) {
if(str.length == 0)
return null;
auto got = WideCharToMultiByte(CP_UTF8, 0, str.ptr, cast(int) str.length, buffer.ptr, cast(int) buffer.length, null, null);
if(got == 0) {
if(GetLastError() == ERROR_INSUFFICIENT_BUFFER)
throw new Exception("not enough buffer");
else
throw new Exception("conversion"); // FIXME: GetLastError
}
return buffer[0 .. got];
}
version(Windows)
string makeUtf8StringFromWindowsString(in wchar[] str) {
char[] buffer;
auto got = WideCharToMultiByte(CP_UTF8, 0, str.ptr, cast(int) str.length, null, 0, null, null);
buffer.length = got;
// it is unique because we just allocated it above!
return cast(string) makeUtf8StringFromWindowsString(str, buffer);
}
version(Windows)
string makeUtf8StringFromWindowsString(wchar* str) {
char[] buffer;
auto got = WideCharToMultiByte(CP_UTF8, 0, str, -1, null, 0, null, null);
buffer.length = got;
got = WideCharToMultiByte(CP_UTF8, 0, str, -1, buffer.ptr, cast(int) buffer.length, null, null);
if(got == 0) {
if(GetLastError() == ERROR_INSUFFICIENT_BUFFER)
throw new Exception("not enough buffer");
else
throw new Exception("conversion"); // FIXME: GetLastError
}
return cast(string) buffer[0 .. got];
}
int findIndexOfZero(in wchar[] str) {
foreach(idx, wchar ch; str)
if(ch == 0)
return cast(int) idx;
return cast(int) str.length;
}
int findIndexOfZero(in char[] str) {
foreach(idx, char ch; str)
if(ch == 0)
return cast(int) idx;
return cast(int) str.length;
}
/// Copies some text to the clipboard.
void setClipboardText(SimpleWindow clipboardOwner, string text) {
assert(clipboardOwner !is null);
version(Windows) {
if(OpenClipboard(clipboardOwner.impl.hwnd) == 0)
throw new Exception("OpenClipboard");
scope(exit)
CloseClipboard();
EmptyClipboard();
auto sz = sizeOfConvertedWstring(text, WindowsStringConversionFlags.convertNewLines | WindowsStringConversionFlags.zeroTerminate);
auto handle = GlobalAlloc(GMEM_MOVEABLE, sz * 2); // zero terminated wchars
if(handle is null) throw new Exception("GlobalAlloc");
if(auto data = cast(wchar*) GlobalLock(handle)) {
auto slice = data[0 .. sz];
scope(failure)
GlobalUnlock(handle);
auto str = makeWindowsString(text, slice, WindowsStringConversionFlags.convertNewLines | WindowsStringConversionFlags.zeroTerminate);
GlobalUnlock(handle);
SetClipboardData(CF_UNICODETEXT, handle);
}
} else version(X11) {
setX11Selection!"CLIPBOARD"(clipboardOwner, text);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
void setClipboardImage()(SimpleWindow clipboardOwner, MemoryImage img) {
assert(clipboardOwner !is null);
version(Windows) {
if(OpenClipboard(clipboardOwner.impl.hwnd) == 0)
throw new Exception("OpenClipboard");
scope(exit)
CloseClipboard();
EmptyClipboard();
import arsd.bmp;
ubyte[] mdata;
mdata.reserve(img.width * img.height);
void sink(ubyte b) {
mdata ~= b;
}
writeBmpIndirect(img, &sink, false);
auto handle = GlobalAlloc(GMEM_MOVEABLE, mdata.length);
if(handle is null) throw new Exception("GlobalAlloc");
if(auto data = cast(ubyte*) GlobalLock(handle)) {
auto slice = data[0 .. mdata.length];
scope(failure)
GlobalUnlock(handle);
slice[] = mdata[];
GlobalUnlock(handle);
SetClipboardData(CF_DIB, handle);
}
} else version(X11) {
static class X11SetSelectionHandler_Image : X11SetSelectionHandler {
mixin X11SetSelectionHandler_Basics;
private const(ubyte)[] mdata;
private const(ubyte)[] mdata_original;
this(MemoryImage img) {
import arsd.bmp;
mdata.reserve(img.width * img.height);
void sink(ubyte b) {
mdata ~= b;
}
writeBmpIndirect(img, &sink, true);
mdata_original = mdata;
}
Atom[] availableFormats() {
auto display = XDisplayConnection.get;
return [
GetAtom!"image/bmp"(display),
GetAtom!"TARGETS"(display)
];
}
ubyte[] getData(Atom format, return scope ubyte[] data) {
if(mdata.length < data.length) {
data[0 .. mdata.length] = mdata[];
auto ret = data[0 .. mdata.length];
mdata = mdata[$..$];
return ret;
} else {
data[] = mdata[0 .. data.length];
mdata = mdata[data.length .. $];
return data[];
}
}
void done() {
mdata = mdata_original;
}
}
setX11Selection!"CLIPBOARD"(clipboardOwner, new X11SetSelectionHandler_Image(img));
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
version(X11) {
// and the PRIMARY on X, be sure to put these in static if(UsingSimpledisplayX11)
private Atom*[] interredAtoms; // for discardAndRecreate
// FIXME: do a GetAtomUpfront too that just queues all at CT and combines it all.
/// Platform-specific for X11.
/// History: On February 21, 2021, I changed the default value of `create` to be true.
@property Atom GetAtom(string name, bool create = true)(Display* display) {
static Atom a;
if(!a) {
a = XInternAtom(display, name, !create);
interredAtoms ~= &a;
}
if(a == None)
throw new Exception("XInternAtom " ~ name ~ " " ~ (create ? "true":"false"));
return a;
}
/// Platform-specific for X11 - gets atom names as a string.
string getAtomName(Atom atom, Display* display) {
auto got = XGetAtomName(display, atom);
scope(exit) XFree(got);
import core.stdc.string;
string s = got[0 .. strlen(got)].idup;
return s;
}
/// Asserts ownership of PRIMARY and copies the text into a buffer that clients can request later.
void setPrimarySelection(SimpleWindow window, string text) {
setX11Selection!"PRIMARY"(window, text);
}
/// Asserts ownership of SECONDARY and copies the text into a buffer that clients can request later.
void setSecondarySelection(SimpleWindow window, string text) {
setX11Selection!"SECONDARY"(window, text);
}
interface X11SetSelectionHandler {
// should include TARGETS right now
Atom[] availableFormats();
// Return the slice of data you filled, empty slice if done.
// this is to support the incremental thing
ubyte[] getData(Atom format, return scope ubyte[] data);
void done();
void handleRequest(XEvent);
bool matchesIncr(Window, Atom);
void sendMoreIncr(XPropertyEvent*);
}
mixin template X11SetSelectionHandler_Basics() {
Window incrWindow;
Atom incrAtom;
Atom selectionAtom;
Atom formatAtom;
ubyte[] toSend;
bool matchesIncr(Window w, Atom a) {
return incrAtom && incrAtom == a && w == incrWindow;
}
void sendMoreIncr(XPropertyEvent* event) {
auto display = XDisplayConnection.get;
XChangeProperty (display,
incrWindow,
incrAtom,
formatAtom,
8 /* bits */, PropModeReplace,
toSend.ptr, cast(int) toSend.length);
if(toSend.length != 0) {
toSend = this.getData(formatAtom, toSend[]);
} else {
this.done();
incrWindow = None;
incrAtom = None;
selectionAtom = None;
formatAtom = None;
toSend = null;
}
}
void handleRequest(XEvent ev) {
auto display = XDisplayConnection.get;
XSelectionRequestEvent* event = &ev.xselectionrequest;
XSelectionEvent selectionEvent;
selectionEvent.type = EventType.SelectionNotify;
selectionEvent.display = event.display;
selectionEvent.requestor = event.requestor;
selectionEvent.selection = event.selection;
selectionEvent.time = event.time;
selectionEvent.target = event.target;
bool supportedType() {
foreach(t; this.availableFormats())
if(t == event.target)
return true;
return false;
}
if(event.property == None) {
selectionEvent.property = event.target;
XSendEvent(display, selectionEvent.requestor, false, 0, cast(XEvent*) &selectionEvent);
XFlush(display);
} if(event.target == GetAtom!"TARGETS"(display)) {
/* respond with the supported types */
auto tlist = this.availableFormats();
XChangeProperty(display, event.requestor, event.property, XA_ATOM, 32, PropModeReplace, cast(void*)tlist.ptr, cast(int) tlist.length);
selectionEvent.property = event.property;
XSendEvent(display, selectionEvent.requestor, false, 0, cast(XEvent*) &selectionEvent);
XFlush(display);
} else if(supportedType()) {
auto buffer = new ubyte[](1024 * 64);
auto toSend = this.getData(event.target, buffer[]);
if(toSend.length < 32 * 1024) {
// small enough to send directly...
selectionEvent.property = event.property;
XChangeProperty (display,
selectionEvent.requestor,
selectionEvent.property,
event.target,
8 /* bits */, 0 /* PropModeReplace */,
toSend.ptr, cast(int) toSend.length);
XSendEvent(display, selectionEvent.requestor, false, 0, cast(XEvent*) &selectionEvent);
XFlush(display);
} else {
// large, let's send incrementally
arch_ulong l = toSend.length;
// if I wanted other events from this window don't want to clear that out....
XWindowAttributes xwa;
XGetWindowAttributes(display, selectionEvent.requestor, &xwa);
XSelectInput(display, selectionEvent.requestor, cast(EventMask) (xwa.your_event_mask | EventMask.PropertyChangeMask));
incrWindow = event.requestor;
incrAtom = event.property;
formatAtom = event.target;
selectionAtom = event.selection;
this.toSend = toSend;
selectionEvent.property = event.property;
XChangeProperty (display,
selectionEvent.requestor,
selectionEvent.property,
GetAtom!"INCR"(display),
32 /* bits */, PropModeReplace,
&l, 1);
XSendEvent(display, selectionEvent.requestor, false, 0, cast(XEvent*) &selectionEvent);
XFlush(display);
}
//if(after)
//after();
} else {
debug(sdpy_clip) {
import std.stdio; writeln("Unsupported data ", getAtomName(event.target, display));
}
selectionEvent.property = None; // I don't know how to handle this type...
XSendEvent(display, selectionEvent.requestor, false, EventMask.NoEventMask, cast(XEvent*) &selectionEvent);
XFlush(display);
}
}
}
class X11SetSelectionHandler_Text : X11SetSelectionHandler {
mixin X11SetSelectionHandler_Basics;
private const(ubyte)[] text;
private const(ubyte)[] text_original;
this(string text) {
this.text = cast(const ubyte[]) text;
this.text_original = this.text;
}
Atom[] availableFormats() {
auto display = XDisplayConnection.get;
return [
GetAtom!"UTF8_STRING"(display),
GetAtom!"text/plain"(display),
XA_STRING,
GetAtom!"TARGETS"(display)
];
}
ubyte[] getData(Atom format, return scope ubyte[] data) {
if(text.length < data.length) {
data[0 .. text.length] = text[];
return data[0 .. text.length];
} else {
data[] = text[0 .. data.length];
text = text[data.length .. $];
return data[];
}
}
void done() {
text = text_original;
}
}
/// The `after` delegate is called after a client requests the UTF8_STRING thing. it is a mega-hack right now! (note to self july 2020... why did i do that?!)
void setX11Selection(string atomName)(SimpleWindow window, string text, void delegate() after = null) {
setX11Selection!atomName(window, new X11SetSelectionHandler_Text(text), after);
}
void setX11Selection(string atomName)(SimpleWindow window, X11SetSelectionHandler data, void delegate() after = null) {
assert(window !is null);
auto display = XDisplayConnection.get();
static if (atomName == "PRIMARY") Atom a = XA_PRIMARY;
else static if (atomName == "SECONDARY") Atom a = XA_SECONDARY;
else Atom a = GetAtom!atomName(display);
XSetSelectionOwner(display, a, window.impl.window, 0 /* CurrentTime */);
window.impl.setSelectionHandlers[a] = data;
}
///
void getPrimarySelection(SimpleWindow window, void delegate(in char[]) handler) {
getX11Selection!"PRIMARY"(window, handler);
}
// added July 28, 2020
// undocumented as experimental tho
interface X11GetSelectionHandler {
void handleData(Atom target, in ubyte[] data);
Atom findBestFormat(Atom[] answer);
void prepareIncremental(Window, Atom);
bool matchesIncr(Window, Atom);
void handleIncrData(Atom, in ubyte[] data);
}
mixin template X11GetSelectionHandler_Basics() {
Window incrWindow;
Atom incrAtom;
void prepareIncremental(Window w, Atom a) {
incrWindow = w;
incrAtom = a;
}
bool matchesIncr(Window w, Atom a) {
return incrWindow == w && incrAtom == a;
}
Atom incrFormatAtom;
ubyte[] incrData;
void handleIncrData(Atom format, in ubyte[] data) {
incrFormatAtom = format;
if(data.length)
incrData ~= data;
else
handleData(incrFormatAtom, incrData);
}
}
///
void getX11Selection(string atomName)(SimpleWindow window, void delegate(in char[]) handler, Time timestamp = 0 /* CurrentTime */) {
assert(window !is null);
auto display = XDisplayConnection.get();
auto atom = GetAtom!atomName(display);
static class X11GetSelectionHandler_Text : X11GetSelectionHandler {
this(void delegate(in char[]) handler) {
this.handler = handler;
}
mixin X11GetSelectionHandler_Basics;
void delegate(in char[]) handler;
void handleData(Atom target, in ubyte[] data) {
if(target == GetAtom!"UTF8_STRING"(XDisplayConnection.get) || target == XA_STRING || target == GetAtom!"text/plain"(XDisplayConnection.get))
handler(cast(const char[]) data);
}
Atom findBestFormat(Atom[] answer) {
Atom best = None;
foreach(option; answer) {
if(option == GetAtom!"UTF8_STRING"(XDisplayConnection.get)) {
best = option;
break;
} else if(option == XA_STRING) {
best = option;
} else if(option == GetAtom!"text/plain"(XDisplayConnection.get)) {
best = option;
}
}
return best;
}
}
window.impl.getSelectionHandlers[atom] = new X11GetSelectionHandler_Text(handler);
auto target = GetAtom!"TARGETS"(display);
// SDD_DATA is "simpledisplay.d data"
XConvertSelection(display, atom, target, GetAtom!("SDD_DATA", true)(display), window.impl.window, timestamp);
}
/// Gets the image on the clipboard, if there is one. Added July 2020.
void getX11Selection(string atomName)(SimpleWindow window, void delegate(MemoryImage) handler) {
assert(window !is null);
auto display = XDisplayConnection.get();
auto atom = GetAtom!atomName(display);
static class X11GetSelectionHandler_Image : X11GetSelectionHandler {
this(void delegate(MemoryImage) handler) {
this.handler = handler;
}
mixin X11GetSelectionHandler_Basics;
void delegate(MemoryImage) handler;
void handleData(Atom target, in ubyte[] data) {
if(target == GetAtom!"image/bmp"(XDisplayConnection.get)) {
import arsd.bmp;
handler(readBmp(data));
}
}
Atom findBestFormat(Atom[] answer) {
Atom best = None;
foreach(option; answer) {
if(option == GetAtom!"image/bmp"(XDisplayConnection.get)) {
best = option;
}
}
return best;
}
}
window.impl.getSelectionHandlers[atom] = new X11GetSelectionHandler_Image(handler);
auto target = GetAtom!"TARGETS"(display);
// SDD_DATA is "simpledisplay.d data"
XConvertSelection(display, atom, target, GetAtom!("SDD_DATA", true)(display), window.impl.window, 0 /*CurrentTime*/);
}
///
void[] getX11PropertyData(Window window, Atom property, Atom type = AnyPropertyType) {
Atom actualType;
int actualFormat;
arch_ulong actualItems;
arch_ulong bytesRemaining;
void* data;
auto display = XDisplayConnection.get();
if(XGetWindowProperty(display, window, property, 0, 0x7fffffff, false, type, &actualType, &actualFormat, &actualItems, &bytesRemaining, &data) == Success) {
if(actualFormat == 0)
return null;
else {
int byteLength;
if(actualFormat == 32) {
// 32 means it is a C long... which is variable length
actualFormat = cast(int) arch_long.sizeof * 8;
}
// then it is just a bit count
byteLength = cast(int) (actualItems * actualFormat / 8);
auto d = new ubyte[](byteLength);
d[] = cast(ubyte[]) data[0 .. byteLength];
XFree(data);
return d;
}
}
return null;
}
/* defined in the systray spec */
enum SYSTEM_TRAY_REQUEST_DOCK = 0;
enum SYSTEM_TRAY_BEGIN_MESSAGE = 1;
enum SYSTEM_TRAY_CANCEL_MESSAGE = 2;
/** Global hotkey handler. Simpledisplay will usually create one for you, but if you want to use subclassing
* instead of delegates, you can subclass this, and override `doHandle()` method. */
public class GlobalHotkey {
KeyEvent key;
void delegate () handler;
void doHandle () { if (handler !is null) handler(); } /// this will be called by hotkey manager
/// Create from initialzed KeyEvent object
this (KeyEvent akey, void delegate () ahandler=null) {
if (akey.key == 0 || !GlobalHotkeyManager.isGoodModifierMask(akey.modifierState)) throw new Exception("invalid global hotkey");
key = akey;
handler = ahandler;
}
/// Create from emacs-like key name ("C-M-Y", etc.)
this (const(char)[] akey, void delegate () ahandler=null) {
key = KeyEvent.parse(akey);
if (key.key == 0 || !GlobalHotkeyManager.isGoodModifierMask(key.modifierState)) throw new Exception("invalid global hotkey");
handler = ahandler;
}
}
private extern(C) int XGrabErrorHandler (Display* dpy, XErrorEvent* evt) nothrow @nogc {
//conwriteln("failed to grab key");
GlobalHotkeyManager.ghfailed = true;
return 0;
}
private extern(C) int XShmErrorHandler (Display* dpy, XErrorEvent* evt) nothrow @nogc {
Image.impl.xshmfailed = true;
return 0;
}
private extern(C) int adrlogger (Display* dpy, XErrorEvent* evt) nothrow @nogc {
import core.stdc.stdio;
char[265] buffer;
XGetErrorText(dpy, evt.error_code, buffer.ptr, cast(int) buffer.length);
debug printf("X Error %d: %s / Serial: %lld, Opcode: %d.%d, XID: 0x%llx\n", evt.error_code, buffer.ptr, evt.serial, evt.request_code, evt.minor_code, evt.resourceid);
return 0;
}
/++
Global hotkey manager. It contains static methods to manage global hotkeys.
---
try {
GlobalHotkeyManager.register("M-H-A", delegate () { hideShowWindows(); });
} catch (Exception e) {
conwriteln("ERROR registering hotkey!");
}
---
The key strings are based on Emacs. In practical terms,
`M` means `alt` and `H` means the Windows logo key. `C`
is `ctrl`.
$(WARNING
This is X-specific right now. If you are on
Windows, try [registerHotKey] instead.
We will probably merge these into a single
interface later.
)
+/
public class GlobalHotkeyManager : CapableOfHandlingNativeEvent {
version(X11) {
void recreateAfterDisconnect() {
throw new Exception("NOT IMPLEMENTED");
}
void discardConnectionState() {
throw new Exception("NOT IMPLEMENTED");
}
}
private static immutable uint[8] masklist = [ 0,
KeyOrButtonMask.LockMask,
KeyOrButtonMask.Mod2Mask,
KeyOrButtonMask.Mod3Mask,
KeyOrButtonMask.LockMask|KeyOrButtonMask.Mod2Mask,
KeyOrButtonMask.LockMask|KeyOrButtonMask.Mod3Mask,
KeyOrButtonMask.LockMask|KeyOrButtonMask.Mod2Mask|KeyOrButtonMask.Mod3Mask,
KeyOrButtonMask.Mod2Mask|KeyOrButtonMask.Mod3Mask,
];
private __gshared GlobalHotkeyManager ghmanager;
private __gshared bool ghfailed = false;
private static bool isGoodModifierMask (uint modmask) pure nothrow @safe @nogc {
if (modmask == 0) return false;
if (modmask&(KeyOrButtonMask.LockMask|KeyOrButtonMask.Mod2Mask|KeyOrButtonMask.Mod3Mask)) return false;
if (modmask&~(KeyOrButtonMask.Mod5Mask-1)) return false;
return true;
}
private static uint cleanupModifiers (uint modmask) pure nothrow @safe @nogc {
modmask &= ~(KeyOrButtonMask.LockMask|KeyOrButtonMask.Mod2Mask|KeyOrButtonMask.Mod3Mask); // remove caps, num, scroll
modmask &= (KeyOrButtonMask.Mod5Mask-1); // and other modifiers
return modmask;
}
private static uint keyEvent2KeyCode() (in auto ref KeyEvent ke) {
uint keycode = cast(uint)ke.key;
auto dpy = XDisplayConnection.get;
return XKeysymToKeycode(dpy, keycode);
}
private static ulong keyCode2Hash() (uint keycode, uint modstate) pure nothrow @safe @nogc { return ((cast(ulong)modstate)<<32)|keycode; }
private __gshared GlobalHotkey[ulong] globalHotkeyList;
NativeEventHandler getNativeEventHandler () {
return delegate int (XEvent e) {
if (e.type != EventType.KeyPress) return 1;
auto kev = cast(const(XKeyEvent)*)&e;
auto hash = keyCode2Hash(e.xkey.keycode, cleanupModifiers(e.xkey.state));
if (auto ghkp = hash in globalHotkeyList) {
try {
ghkp.doHandle();
} catch (Exception e) {
import core.stdc.stdio : stderr, fprintf;
stderr.fprintf("HOTKEY HANDLER EXCEPTION: %.*s", cast(uint)e.msg.length, e.msg.ptr);
}
}
return 1;
};
}
private this () {
auto dpy = XDisplayConnection.get;
auto root = RootWindow(dpy, DefaultScreen(dpy));
CapableOfHandlingNativeEvent.nativeHandleMapping[root] = this;
XDisplayConnection.addRootInput(EventMask.KeyPressMask);
}
/// Register new global hotkey with initialized `GlobalHotkey` object.
/// This function will throw if it failed to register hotkey (i.e. hotkey is invalid or already taken).
static void register (GlobalHotkey gh) {
if (gh is null) return;
if (gh.key.key == 0 || !isGoodModifierMask(gh.key.modifierState)) throw new Exception("invalid global hotkey");
auto dpy = XDisplayConnection.get;
immutable keycode = keyEvent2KeyCode(gh.key);
auto hash = keyCode2Hash(keycode, gh.key.modifierState);
if (hash in globalHotkeyList) throw new Exception("duplicate global hotkey");
if (ghmanager is null) ghmanager = new GlobalHotkeyManager();
XSync(dpy, 0/*False*/);
Window root = RootWindow(dpy, DefaultScreen(dpy));
XErrorHandler savedErrorHandler = XSetErrorHandler(&XGrabErrorHandler);
ghfailed = false;
foreach (immutable uint ormask; masklist[]) {
XGrabKey(dpy, keycode, gh.key.modifierState|ormask, /*grab_window*/root, /*owner_events*/0/*False*/, GrabMode.GrabModeAsync, GrabMode.GrabModeAsync);
}
XSync(dpy, 0/*False*/);
XSetErrorHandler(savedErrorHandler);
if (ghfailed) {
savedErrorHandler = XSetErrorHandler(&XGrabErrorHandler);
foreach (immutable uint ormask; masklist[]) XUngrabKey(dpy, keycode, gh.key.modifierState|ormask, /*grab_window*/root);
XSync(dpy, 0/*False*/);
XSetErrorHandler(savedErrorHandler);
throw new Exception("cannot register global hotkey");
}
globalHotkeyList[hash] = gh;
}
/// Ditto
static void register (const(char)[] akey, void delegate () ahandler) {
register(new GlobalHotkey(akey, ahandler));
}
private static void removeByHash (ulong hash) {
if (auto ghp = hash in globalHotkeyList) {
auto dpy = XDisplayConnection.get;
immutable keycode = keyEvent2KeyCode(ghp.key);
Window root = RootWindow(dpy, DefaultScreen(dpy));
XSync(dpy, 0/*False*/);
XErrorHandler savedErrorHandler = XSetErrorHandler(&XGrabErrorHandler);
foreach (immutable uint ormask; masklist[]) XUngrabKey(dpy, keycode, ghp.key.modifierState|ormask, /*grab_window*/root);
XSync(dpy, 0/*False*/);
XSetErrorHandler(savedErrorHandler);
globalHotkeyList.remove(hash);
}
}
/// Register new global hotkey with previously used `GlobalHotkey` object.
/// It is safe to unregister unknown or invalid hotkey.
static void unregister (GlobalHotkey gh) {
//TODO: add second AA for faster search? prolly doesn't worth it.
if (gh is null) return;
foreach (const ref kv; globalHotkeyList.byKeyValue) {
if (kv.value is gh) {
removeByHash(kv.key);
return;
}
}
}
/// Ditto.
static void unregister (const(char)[] key) {
auto kev = KeyEvent.parse(key);
immutable keycode = keyEvent2KeyCode(kev);
removeByHash(keyCode2Hash(keycode, kev.modifierState));
}
}
}
version(Windows) {
/// Platform-specific for Windows. Sends a string as key press and release events to the actively focused window (not necessarily your application).
void sendSyntheticInput(wstring s) {
INPUT[] inputs;
inputs.reserve(s.length * 2);
foreach(wchar c; s) {
INPUT input;
input.type = INPUT_KEYBOARD;
input.ki.wScan = c;
input.ki.dwFlags = KEYEVENTF_UNICODE;
inputs ~= input;
input.ki.dwFlags |= KEYEVENTF_KEYUP;
inputs ~= input;
}
if(SendInput(cast(int) inputs.length, inputs.ptr, INPUT.sizeof) != inputs.length) {
throw new Exception("SendInput failed");
}
}
// global hotkey helper function
/// Platform-specific for Windows. Registers a global hotkey. Returns a registration ID.
int registerHotKey(SimpleWindow window, UINT modifiers, UINT vk, void delegate() handler) {
__gshared int hotkeyId = 0;
int id = ++hotkeyId;
if(!RegisterHotKey(window.impl.hwnd, id, modifiers, vk))
throw new Exception("RegisterHotKey failed");
__gshared void delegate()[WPARAM][HWND] handlers;
handlers[window.impl.hwnd][id] = handler;
int delegate(HWND, UINT, WPARAM, LPARAM, out int) oldHandler;
auto nativeEventHandler = delegate int(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, out int mustReturn) {
switch(msg) {
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms646279%28v=vs.85%29.aspx
case WM_HOTKEY:
if(auto list = hwnd in handlers) {
if(auto h = wParam in *list) {
(*h)();
return 0;
}
}
goto default;
default:
}
if(oldHandler)
return oldHandler(hwnd, msg, wParam, lParam, mustReturn);
return 1; // pass it on
};
if(window.handleNativeEvent.funcptr !is nativeEventHandler.funcptr) {
oldHandler = window.handleNativeEvent;
window.handleNativeEvent = nativeEventHandler;
}
return id;
}
/// Platform-specific for Windows. Unregisters a key. The id is the value returned by [registerHotKey].
void unregisterHotKey(SimpleWindow window, int id) {
if(!UnregisterHotKey(window.impl.hwnd, id))
throw new Exception("UnregisterHotKey");
}
}
version (X11) {
pragma(lib, "dl");
import core.sys.posix.dlfcn;
/++
Allows for sending synthetic input to the X server via the Xtst
extension.
Please remember user input is meant to be user - don't use this
if you have some other alternative!
If you need this on Windows btw, the top-level [sendSyntheticInput] shows
the Win32 api to start it, but I only did basics there, PR welcome if you like,
it is an easy enough function to use.
History: Added May 17, 2020.
+/
struct SyntheticInput {
@disable this();
private void* lib;
private int* refcount;
private extern(C) {
void function(Display*, uint keycode, bool press, arch_ulong delay) XTestFakeKeyEvent;
void function(Display*, uint button, bool press, arch_ulong delay) XTestFakeButtonEvent;
}
/// The dummy param must be 0.
this(int dummy) {
lib = dlopen("libXtst.so", RTLD_NOW);
if(lib is null)
throw new Exception("cannot load xtest lib extension");
scope(failure)
dlclose(lib);
XTestFakeButtonEvent = cast(typeof(XTestFakeButtonEvent)) dlsym(lib, "XTestFakeButtonEvent");
XTestFakeKeyEvent = cast(typeof(XTestFakeKeyEvent)) dlsym(lib, "XTestFakeKeyEvent");
if(XTestFakeKeyEvent is null)
throw new Exception("No XTestFakeKeyEvent");
if(XTestFakeButtonEvent is null)
throw new Exception("No XTestFakeButtonEvent");
refcount = new int;
*refcount = 1;
}
this(this) {
if(refcount)
*refcount += 1;
}
~this() {
if(refcount) {
*refcount -= 1;
if(*refcount == 0)
// I commented this because if I close the lib before
// XCloseDisplay, it is liable to segfault... so just
// gonna keep it loaded if it is loaded, no big deal
// anyway.
{} // dlclose(lib);
}
}
/// This ONLY works with basic ascii!
void sendSyntheticInput(string s) {
int delay = 0;
foreach(ch; s) {
pressKey(cast(Key) ch, true, delay);
pressKey(cast(Key) ch, false, delay);
delay += 5;
}
}
/++
Sends a fake press key event.
Please note you need to call [flushGui] or return to the event loop for this to actually be sent.
+/
void pressKey(Key key, bool pressed, int delay = 0) {
XTestFakeKeyEvent(XDisplayConnection.get, XKeysymToKeycode(XDisplayConnection.get, key), pressed, delay + pressed ? 0 : 5);
}
///
void pressMouseButton(MouseButton button, bool pressed, int delay = 0) {
int btn;
switch(button) {
case MouseButton.left: btn = 1; break;
case MouseButton.middle: btn = 2; break;
case MouseButton.right: btn = 3; break;
case MouseButton.wheelUp: btn = 4; break;
case MouseButton.wheelDown: btn = 5; break;
case MouseButton.backButton: btn = 8; break;
case MouseButton.forwardButton: btn = 9; break;
default:
}
assert(btn);
XTestFakeButtonEvent(XDisplayConnection.get, btn, pressed, delay);
}
///
static void moveMouseArrowBy(int dx, int dy) {
auto disp = XDisplayConnection.get();
XWarpPointer(disp, None, None, 0, 0, 0, 0, dx, dy);
XFlush(disp);
}
///
static void moveMouseArrowTo(int x, int y) {
auto disp = XDisplayConnection.get();
auto root = RootWindow(disp, DefaultScreen(disp));
XWarpPointer(disp, None, root, 0, 0, 0, 0, x, y);
XFlush(disp);
}
}
}
/++
[ScreenPainter] operations can use different operations to combine the color with the color on screen.
See_Also:
$(LIST
*[ScreenPainter]
*[ScreenPainter.rasterOp]
)
+/
enum RasterOp {
normal, /// Replaces the pixel.
xor, /// Uses bitwise xor to draw.
}
// being phobos-free keeps the size WAY down
private const(char)* toStringz(string s) { return (s ~ '\0').ptr; }
package(arsd) const(wchar)* toWStringz(wstring s) { return (s ~ '\0').ptr; }
package(arsd) const(wchar)* toWStringz(string s) {
wstring r;
foreach(dchar c; s)
r ~= c;
r ~= '\0';
return r.ptr;
}
private string[] split(in void[] a, char c) {
string[] ret;
size_t previous = 0;
foreach(i, char ch; cast(ubyte[]) a) {
if(ch == c) {
ret ~= cast(string) a[previous .. i];
previous = i + 1;
}
}
if(previous != a.length)
ret ~= cast(string) a[previous .. $];
return ret;
}
version(without_opengl) {
enum OpenGlOptions {
no,
}
} else {
/++
Determines if you want an OpenGL context created on the new window.
See more: [#topics-3d|in the 3d topic].
---
import arsd.simpledisplay;
void main() {
auto window = new SimpleWindow(500, 500, "OpenGL Test", OpenGlOptions.yes);
// Set up the matrix
window.setAsCurrentOpenGlContext(); // make this window active
// This is called on each frame, we will draw our scene
window.redrawOpenGlScene = delegate() {
};
window.eventLoop(0);
}
---
+/
enum OpenGlOptions {
no, /// No OpenGL context is created
yes, /// Yes, create an OpenGL context
}
version(X11) {
static if (!SdpyIsUsingIVGLBinds) {
struct __GLXFBConfigRec {}
alias GLXFBConfig = __GLXFBConfigRec*;
//pragma(lib, "GL");
//pragma(lib, "GLU");
interface GLX {
extern(C) nothrow @nogc {
XVisualInfo* glXChooseVisual(Display *dpy, int screen,
const int *attrib_list);
void glXCopyContext(Display *dpy, GLXContext src,
GLXContext dst, arch_ulong mask);
GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis,
GLXContext share_list, Bool direct);
GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis,
Pixmap pixmap);
void glXDestroyContext(Display *dpy, GLXContext ctx);
void glXDestroyGLXPixmap(Display *dpy, GLXPixmap pix);
int glXGetConfig(Display *dpy, XVisualInfo *vis,
int attrib, int *value);
GLXContext glXGetCurrentContext();
GLXDrawable glXGetCurrentDrawable();
Bool glXIsDirect(Display *dpy, GLXContext ctx);
Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable,
GLXContext ctx);
Bool glXQueryExtension(Display *dpy, int *error_base, int *event_base);
Bool glXQueryVersion(Display *dpy, int *major, int *minor);
void glXSwapBuffers(Display *dpy, GLXDrawable drawable);
void glXUseXFont(Font font, int first, int count, int list_base);
void glXWaitGL();
void glXWaitX();
GLXFBConfig* glXChooseFBConfig (Display*, int, int*, int*);
int glXGetFBConfigAttrib (Display*, GLXFBConfig, int, int*);
XVisualInfo* glXGetVisualFromFBConfig (Display*, GLXFBConfig);
char* glXQueryExtensionsString (Display*, int);
void* glXGetProcAddress (const(char)*);
}
}
version(OSX)
mixin DynamicLoad!(GLX, "GL", 0, openGlLibrariesSuccessfullyLoaded) glx;
else
mixin DynamicLoad!(GLX, "GLX", 0, openGlLibrariesSuccessfullyLoaded) glx;
shared static this() {
glx.loadDynamicLibrary();
}
alias glbindGetProcAddress = glXGetProcAddress;
}
} else version(Windows) {
/* it is done below by interface GL */
} else
static assert(0, "OpenGL not supported on your system yet. Try -version=X11 if you have X Windows available, or -version=without_opengl to go without.");
}
deprecated("Sorry, I misspelled it in the first version! Use `Resizability` instead.")
alias Resizablity = Resizability;
/// When you create a SimpleWindow, you can see its resizability to be one of these via the constructor...
enum Resizability {
fixedSize, /// the window cannot be resized
allowResizing, /// the window can be resized. The buffer (if there is one) will automatically adjust size, but not stretch the contents. the windowResized delegate will be called so you can respond to the new size yourself.
automaticallyScaleIfPossible, /// if possible, your drawing buffer will remain the same size and simply be automatically scaled to the new window size. If this is impossible, it will not allow the user to resize the window at all. Note: window.width and window.height WILL be adjusted, which might throw you off if you draw based on them, so keep track of your expected width and height separately. That way, when it is scaled, things won't be thrown off.
// FIXME: automaticallyScaleIfPossible should adjust the OpenGL viewport on resize events
}
/++
Alignment for [ScreenPainter.drawText]. Left, Center, or Right may be combined with VerticalTop, VerticalCenter, or VerticalBottom via bitwise or.
+/
enum TextAlignment : uint {
Left = 0, ///
Center = 1, ///
Right = 2, ///
VerticalTop = 0, ///
VerticalCenter = 4, ///
VerticalBottom = 8, ///
}
public import arsd.color; // no longer stand alone... :-( but i need a common type for this to work with images easily.
alias Rectangle = arsd.color.Rectangle;
/++
Keyboard press and release events.
+/
struct KeyEvent {
/// see table below. Always use the symbolic names, even for ASCII characters, since the actual numbers vary across platforms. See [Key]
Key key;
ubyte hardwareCode; /// A platform and hardware specific code for the key
bool pressed; /// true if the key was just pressed, false if it was just released. note: released events aren't always sent...
deprecated("This never actually worked anyway, you should do a character event handler instead.") dchar character;
uint modifierState; /// see enum [ModifierState]. They are bitwise combined together.
SimpleWindow window; /// associated Window
/++
A view into the upcoming buffer holding coming character events that are sent if and only if neither
the alt or super modifier keys are pressed (check this with `!(modifierState & (ModifierState.window | ModifierState.alt))`
to predict if char events are actually coming..
Only available on X systems since this information is not given ahead of time elsewhere.
(Well, you COULD probably dig it up, but as far as I know right now, it isn't terribly pretty.)
I'm adding this because it is useful to the terminal emulator, but given its platform specificness
and potential quirks I'd recommend avoiding it.
History:
Added April 26, 2021 (dub v9.5)
+/
version(X11)
dchar[] charsPossible;
// convert key event to simplified string representation a-la emacs
const(char)[] toStrBuf(bool growdest=false) (char[] dest) const nothrow @trusted {
uint dpos = 0;
void put (const(char)[] s...) nothrow @trusted {
static if (growdest) {
foreach (char ch; s) if (dpos < dest.length) dest.ptr[dpos++] = ch; else { dest ~= ch; ++dpos; }
} else {
foreach (char ch; s) if (dpos < dest.length) dest.ptr[dpos++] = ch;
}
}
void putMod (ModifierState mod, Key key, string text) nothrow @trusted {
if ((this.modifierState&mod) != 0 && (this.pressed || this.key != key)) put(text);
}
if (!this.key && !(this.modifierState&(ModifierState.ctrl|ModifierState.alt|ModifierState.shift|ModifierState.windows))) return null;
// put modifiers
// releasing modifier keys can produce bizarre things like "Ctrl+Ctrl", so hack around it
putMod(ModifierState.ctrl, Key.Ctrl, "Ctrl+");
putMod(ModifierState.alt, Key.Alt, "Alt+");
putMod(ModifierState.windows, Key.Shift, "Windows+");
putMod(ModifierState.shift, Key.Shift, "Shift+");
if (this.key) {
foreach (string kn; __traits(allMembers, Key)) {
if (this.key == __traits(getMember, Key, kn)) {
// HACK!
static if (kn == "N0") put("0");
else static if (kn == "N1") put("1");
else static if (kn == "N2") put("2");
else static if (kn == "N3") put("3");
else static if (kn == "N4") put("4");
else static if (kn == "N5") put("5");
else static if (kn == "N6") put("6");
else static if (kn == "N7") put("7");
else static if (kn == "N8") put("8");
else static if (kn == "N9") put("9");
else put(kn);
return dest[0..dpos];
}
}
put("Unknown");
} else {
if (dpos && dest[dpos-1] == '+') --dpos;
}
return dest[0..dpos];
}
string toStr() () { return cast(string)toStrBuf!true(null); } // it is safe to cast here
/** Parse string into key name with modifiers. It accepts things like:
*
* C-H-1 -- emacs style (ctrl, and windows, and 1)
*
* Ctrl+Win+1 -- windows style
*
* Ctrl-Win-1 -- '-' is a valid delimiter too
*
* Ctrl Win 1 -- and space
*
* and even "Win + 1 + Ctrl".
*/
static KeyEvent parse (const(char)[] name, bool* ignoreModsOut=null, int* updown=null) nothrow @trusted @nogc {
auto nanchor = name; // keep it anchored, 'cause `name` may have NO_INTERIOR set
// remove trailing spaces
while (name.length && name[$-1] <= ' ') name = name[0..$-1];
// tokens delimited by blank, '+', or '-'
// null on eol
const(char)[] getToken () nothrow @trusted @nogc {
// remove leading spaces and delimiters
while (name.length && (name[0] <= ' ' || name[0] == '+' || name[0] == '-')) name = name[1..$];
if (name.length == 0) return null; // oops, no more tokens
// get token
size_t epos = 0;
while (epos < name.length && name[epos] > ' ' && name[epos] != '+' && name[epos] != '-') ++epos;
assert(epos > 0 && epos <= name.length);
auto res = name[0..epos];
name = name[epos..$];
return res;
}
static bool strEquCI (const(char)[] s0, const(char)[] s1) pure nothrow @trusted @nogc {
if (s0.length != s1.length) return false;
foreach (immutable ci, char c0; s0) {
if (c0 >= 'A' && c0 <= 'Z') c0 += 32; // poor man's tolower
char c1 = s1[ci];
if (c1 >= 'A' && c1 <= 'Z') c1 += 32; // poor man's tolower
if (c0 != c1) return false;
}
return true;
}
if (ignoreModsOut !is null) *ignoreModsOut = false;
if (updown !is null) *updown = -1;
KeyEvent res;
res.key = cast(Key)0; // just in case
const(char)[] tk, tkn; // last token
bool allowEmascStyle = true;
bool ignoreModifiers = false;
tokenloop: for (;;) {
tk = tkn;
tkn = getToken();
//k8: yay, i took "Bloody Mess" trait from Fallout!
if (tkn.length != 0 && tk.length == 0) { tk = tkn; continue tokenloop; }
if (tkn.length == 0 && tk.length == 0) break; // no more tokens
if (allowEmascStyle && tkn.length != 0) {
if (tk.length == 1) {
char mdc = tk[0];
if (mdc >= 'a' && mdc <= 'z') mdc -= 32; // poor man's toupper()
if (mdc == 'C' && (res.modifierState&ModifierState.ctrl) == 0) {res.modifierState |= ModifierState.ctrl; continue tokenloop; }
if (mdc == 'M' && (res.modifierState&ModifierState.alt) == 0) { res.modifierState |= ModifierState.alt; continue tokenloop; }
if (mdc == 'H' && (res.modifierState&ModifierState.windows) == 0) { res.modifierState |= ModifierState.windows; continue tokenloop; }
if (mdc == 'S' && (res.modifierState&ModifierState.shift) == 0) { res.modifierState |= ModifierState.shift; continue tokenloop; }
if (mdc == '*') { ignoreModifiers = true; continue tokenloop; }
if (mdc == 'U' || mdc == 'R') { if (updown !is null) *updown = 0; continue tokenloop; }
if (mdc == 'D' || mdc == 'P') { if (updown !is null) *updown = 1; continue tokenloop; }
}
}
allowEmascStyle = false;
if (strEquCI(tk, "Ctrl")) { res.modifierState |= ModifierState.ctrl; continue tokenloop; }
if (strEquCI(tk, "Alt")) { res.modifierState |= ModifierState.alt; continue tokenloop; }
if (strEquCI(tk, "Win") || strEquCI(tk, "Windows")) { res.modifierState |= ModifierState.windows; continue tokenloop; }
if (strEquCI(tk, "Shift")) { res.modifierState |= ModifierState.shift; continue tokenloop; }
if (strEquCI(tk, "Release")) { if (updown !is null) *updown = 0; continue tokenloop; }
if (strEquCI(tk, "Press")) { if (updown !is null) *updown = 1; continue tokenloop; }
if (tk == "*") { ignoreModifiers = true; continue tokenloop; }
if (tk.length == 0) continue;
// try key name
if (res.key == 0) {
// little hack
if (tk.length == 1 && tk[0] >= '0' && tk[0] <= '9') {
final switch (tk[0]) {
case '0': tk = "N0"; break;
case '1': tk = "N1"; break;
case '2': tk = "N2"; break;
case '3': tk = "N3"; break;
case '4': tk = "N4"; break;
case '5': tk = "N5"; break;
case '6': tk = "N6"; break;
case '7': tk = "N7"; break;
case '8': tk = "N8"; break;
case '9': tk = "N9"; break;
}
}
foreach (string kn; __traits(allMembers, Key)) {
if (strEquCI(tk, kn)) { res.key = __traits(getMember, Key, kn); continue tokenloop; }
}
}
// unknown or duplicate key name, get out of here
break;
}
if (ignoreModsOut !is null) *ignoreModsOut = ignoreModifiers;
return res; // something
}
bool opEquals() (const(char)[] name) const nothrow @trusted @nogc {
enum modmask = (ModifierState.ctrl|ModifierState.alt|ModifierState.shift|ModifierState.windows);
void doModKey (ref uint mask, ref Key kk, Key k, ModifierState mst) {
if (kk == k) { mask |= mst; kk = cast(Key)0; }
}
bool ignoreMods;
int updown;
auto ke = KeyEvent.parse(name, &ignoreMods, &updown);
if ((updown == 0 && this.pressed) || (updown == 1 && !this.pressed)) return false;
if (this.key != ke.key) {
// things like "ctrl+alt" are complicated
uint tkm = this.modifierState&modmask;
uint kkm = ke.modifierState&modmask;
Key tk = this.key;
// ke
doModKey(kkm, ke.key, Key.Ctrl, ModifierState.ctrl);
doModKey(kkm, ke.key, Key.Alt, ModifierState.alt);
doModKey(kkm, ke.key, Key.Windows, ModifierState.windows);
doModKey(kkm, ke.key, Key.Shift, ModifierState.shift);
// this
doModKey(tkm, tk, Key.Ctrl, ModifierState.ctrl);
doModKey(tkm, tk, Key.Alt, ModifierState.alt);
doModKey(tkm, tk, Key.Windows, ModifierState.windows);
doModKey(tkm, tk, Key.Shift, ModifierState.shift);
return (tk == ke.key && tkm == kkm);
}
return (ignoreMods || ((this.modifierState&modmask) == (ke.modifierState&modmask)));
}
}
/// Sets the application name.
@property string ApplicationName(string name) {
return _applicationName = name;
}
string _applicationName;
/// ditto
@property string ApplicationName() {
if(_applicationName is null) {
import core.runtime;
return Runtime.args[0];
}
return _applicationName;
}
/// Type of a [MouseEvent].
enum MouseEventType : int {
motion = 0, /// The mouse moved inside the window
buttonPressed = 1, /// A mouse button was pressed or the wheel was spun
buttonReleased = 2, /// A mouse button was released
}
// FIXME: mouse move should be distinct from presses+releases, so we can avoid subscribing to those events in X unnecessarily
/++
Listen for this on your event listeners if you are interested in mouse action.
Note that [button] is used on mouse press and release events. If you are curious about which button is being held in during motion, use [modifierState] and check the bitmask for [ModifierState.leftButtonDown], etc.
Examples:
This will draw boxes on the window with the mouse as you hold the left button.
---
import arsd.simpledisplay;
void main() {
auto window = new SimpleWindow();
window.eventLoop(0,
(MouseEvent ev) {
if(ev.modifierState & ModifierState.leftButtonDown) {
auto painter = window.draw();
painter.fillColor = Color.red;
painter.outlineColor = Color.black;
painter.drawRectangle(Point(ev.x / 16 * 16, ev.y / 16 * 16), 16, 16);
}
}
);
}
---
+/
struct MouseEvent {
MouseEventType type; /// movement, press, release, double click. See [MouseEventType]
int x; /// Current X position of the cursor when the event fired, relative to the upper-left corner of the window, reported in pixels. (0, 0) is the upper left, (window.width - 1, window.height - 1) is the lower right corner of the window.
int y; /// Current Y position of the cursor when the event fired.
int dx; /// Change in X position since last report
int dy; /// Change in Y position since last report
MouseButton button; /// See [MouseButton]
int modifierState; /// See [ModifierState]
version(X11)
private Time timestamp;
/// Returns a linear representation of mouse button,
/// for use with static arrays. Guaranteed to be >= 0 && <= 15
///
/// Its implementation is based on range-limiting `core.bitop.bsf(button) + 1`.
@property ubyte buttonLinear() const {
import core.bitop;
if(button == 0)
return 0;
return (bsf(button) + 1) & 0b1111;
}
bool doubleClick; /// was it a double click? Only set on type == [MouseEventType.buttonPressed]
SimpleWindow window; /// The window in which the event happened.
Point globalCoordinates() {
Point p;
if(window is null)
throw new Exception("wtf");
static if(UsingSimpledisplayX11) {
Window child;
XTranslateCoordinates(
XDisplayConnection.get,
window.impl.window,
RootWindow(XDisplayConnection.get, DefaultScreen(XDisplayConnection.get)),
x, y, &p.x, &p.y, &child);
return p;
} else version(Windows) {
POINT[1] points;
points[0].x = x;
points[0].y = y;
MapWindowPoints(
window.impl.hwnd,
null,
points.ptr,
points.length
);
p.x = points[0].x;
p.y = points[0].y;
return p;
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
bool opEquals() (const(char)[] str) pure nothrow @trusted @nogc { return equStr(this, str); }
/**
can contain emacs-like modifier prefix
case-insensitive names:
lmbX/leftX
rmbX/rightX
mmbX/middleX
wheelX
motion (no prefix allowed)
'X' is either "up" or "down" (or "-up"/"-down"); if omited, means "down"
*/
static bool equStr() (in auto ref MouseEvent event, const(char)[] str) pure nothrow @trusted @nogc {
if (str.length == 0) return false; // just in case
debug(arsd_mevent_strcmp) { import iv.cmdcon; conwriteln("str=<", str, ">"); }
enum Flag : uint { Up = 0x8000_0000U, Down = 0x4000_0000U, Any = 0x1000_0000U }
auto anchor = str;
uint mods = 0; // uint.max == any
// interesting bits in kmod
uint kmodmask =
ModifierState.shift|
ModifierState.ctrl|
ModifierState.alt|
ModifierState.windows|
ModifierState.leftButtonDown|
ModifierState.middleButtonDown|
ModifierState.rightButtonDown|
0;
uint lastButt = uint.max; // otherwise, bit 31 means "down"
bool wasButtons = false;
while (str.length) {
if (str.ptr[0] <= ' ') {
while (str.length && str.ptr[0] <= ' ') str = str[1..$];
continue;
}
// one-letter modifier?
if (str.length >= 2 && str.ptr[1] == '-') {
switch (str.ptr[0]) {
case '*': // "any" modifier (cannot be undone)
mods = mods.max;
break;
case 'C': case 'c': // emacs "ctrl"
if (mods != mods.max) mods |= ModifierState.ctrl;
break;
case 'M': case 'm': // emacs "meta"
if (mods != mods.max) mods |= ModifierState.alt;
break;
case 'S': case 's': // emacs "shift"
if (mods != mods.max) mods |= ModifierState.shift;
break;
case 'H': case 'h': // emacs "hyper" (aka winkey)
if (mods != mods.max) mods |= ModifierState.windows;
break;
default:
return false; // unknown modifier
}
str = str[2..$];
continue;
}
// word
char[16] buf = void; // locased
auto wep = 0;
while (str.length) {
immutable char ch = str.ptr[0];
if (ch <= ' ' || ch == '-') break;
str = str[1..$];
if (wep > buf.length) return false; // too long
if (ch >= 'A' && ch <= 'Z') buf.ptr[wep++] = cast(char)(ch+32); // poor man tolower
else if (ch >= 'a' && ch <= 'z') buf.ptr[wep++] = ch;
else return false; // invalid char
}
if (wep == 0) return false; // just in case
uint bnum;
enum UpDown { None = -1, Up, Down, Any }
auto updown = UpDown.None; // 0: up; 1: down
switch (buf[0..wep]) {
// left button
case "lmbup": case "leftup": updown = UpDown.Up; goto case "lmb";
case "lmbdown": case "leftdown": updown = UpDown.Down; goto case "lmb";
case "lmbany": case "leftany": updown = UpDown.Any; goto case "lmb";
case "lmb": case "left": bnum = 0; break;
// middle button
case "mmbup": case "middleup": updown = UpDown.Up; goto case "mmb";
case "mmbdown": case "middledown": updown = UpDown.Down; goto case "mmb";
case "mmbany": case "middleany": updown = UpDown.Any; goto case "mmb";
case "mmb": case "middle": bnum = 1; break;
// right button
case "rmbup": case "rightup": updown = UpDown.Up; goto case "rmb";
case "rmbdown": case "rightdown": updown = UpDown.Down; goto case "rmb";
case "rmbany": case "rightany": updown = UpDown.Any; goto case "rmb";
case "rmb": case "right": bnum = 2; break;
// wheel
case "wheelup": updown = UpDown.Up; goto case "wheel";
case "wheeldown": updown = UpDown.Down; goto case "wheel";
case "wheelany": updown = UpDown.Any; goto case "wheel";
case "wheel": bnum = 3; break;
// motion
case "motion": bnum = 7; break;
// unknown
default: return false;
}
debug(arsd_mevent_strcmp) { import iv.cmdcon; conprintfln(" 0: mods=0x%08x; bnum=%u; updown=%s [%s]", mods, bnum, updown, str); }
// parse possible "-up" or "-down"
if (updown == UpDown.None && bnum < 7 && str.length > 0 && str.ptr[0] == '-') {
wep = 0;
foreach (immutable idx, immutable char ch; str[1..$]) {
if (ch <= ' ' || ch == '-') break;
assert(idx == wep); // for now; trick
if (wep > buf.length) { wep = 0; break; } // too long
if (ch >= 'A' && ch <= 'Z') buf.ptr[wep++] = cast(char)(ch+32); // poor man tolower
else if (ch >= 'a' && ch <= 'z') buf.ptr[wep++] = ch;
else { wep = 0; break; } // invalid char
}
if (wep == 2 && buf[0..wep] == "up") updown = UpDown.Up;
else if (wep == 4 && buf[0..wep] == "down") updown = UpDown.Down;
else if (wep == 3 && buf[0..wep] == "any") updown = UpDown.Any;
// remove parsed part
if (updown != UpDown.None) str = str[wep+1..$];
}
if (updown == UpDown.None) {
updown = UpDown.Down;
}
wasButtons = wasButtons || (bnum <= 2);
//assert(updown != UpDown.None);
debug(arsd_mevent_strcmp) { import iv.cmdcon; conprintfln(" 1: mods=0x%08x; bnum=%u; updown=%s [%s]", mods, bnum, updown, str); }
// if we have a previous button, it goes to modifiers (unless it is a wheel or motion)
if (lastButt != lastButt.max) {
if ((lastButt&0xff) >= 3) return false; // wheel or motion
if (mods != mods.max) {
uint butbit = 0;
final switch (lastButt&0x03) {
case 0: butbit = ModifierState.leftButtonDown; break;
case 1: butbit = ModifierState.middleButtonDown; break;
case 2: butbit = ModifierState.rightButtonDown; break;
}
if (lastButt&Flag.Down) mods |= butbit;
else if (lastButt&Flag.Up) mods &= ~butbit;
else if (lastButt&Flag.Any) kmodmask &= ~butbit;
}
}
// remember last button
lastButt = bnum|(updown == UpDown.Up ? Flag.Up : updown == UpDown.Any ? Flag.Any : Flag.Down);
}
// no button -- nothing to do
if (lastButt == lastButt.max) return false;
// done parsing, check if something's left
foreach (immutable char ch; str) if (ch > ' ') return false; // oops
// remove action button from mask
if ((lastButt&0xff) < 3) {
final switch (lastButt&0x03) {
case 0: kmodmask &= ~cast(uint)ModifierState.leftButtonDown; break;
case 1: kmodmask &= ~cast(uint)ModifierState.middleButtonDown; break;
case 2: kmodmask &= ~cast(uint)ModifierState.rightButtonDown; break;
}
}
// special case: "Motion" means "ignore buttons"
if ((lastButt&0xff) == 7 && !wasButtons) {
debug(arsd_mevent_strcmp) { import iv.cmdcon; conwriteln(" *: special motion"); }
kmodmask &= ~cast(uint)(ModifierState.leftButtonDown|ModifierState.middleButtonDown|ModifierState.rightButtonDown);
}
uint kmod = event.modifierState&kmodmask;
debug(arsd_mevent_strcmp) { import iv.cmdcon; conprintfln(" *: mods=0x%08x; lastButt=0x%08x; kmod=0x%08x; type=%s", mods, lastButt, kmod, event.type); }
// check modifier state
if (mods != mods.max) {
if (kmod != mods) return false;
}
// now check type
if ((lastButt&0xff) == 7) {
// motion
if (event.type != MouseEventType.motion) return false;
} else if ((lastButt&0xff) == 3) {
// wheel
if (lastButt&Flag.Up) return (event.type == MouseEventType.buttonPressed && event.button == MouseButton.wheelUp);
if (lastButt&Flag.Down) return (event.type == MouseEventType.buttonPressed && event.button == MouseButton.wheelDown);
if (lastButt&Flag.Any) return (event.type == MouseEventType.buttonPressed && (event.button == MouseButton.wheelUp || event.button == MouseButton.wheelUp));
return false;
} else {
// buttons
if (((lastButt&Flag.Down) != 0 && event.type != MouseEventType.buttonPressed) ||
((lastButt&Flag.Up) != 0 && event.type != MouseEventType.buttonReleased))
{
return false;
}
// button number
switch (lastButt&0x03) {
case 0: if (event.button != MouseButton.left) return false; break;
case 1: if (event.button != MouseButton.middle) return false; break;
case 2: if (event.button != MouseButton.right) return false; break;
default: return false;
}
}
return true;
}
}
version(arsd_mevent_strcmp_test) unittest {
MouseEvent event;
event.type = MouseEventType.buttonPressed;
event.button = MouseButton.left;
event.modifierState = ModifierState.ctrl;
assert(event == "C-LMB");
assert(event != "C-LMBUP");
assert(event != "C-LMB-UP");
assert(event != "C-S-LMB");
assert(event == "*-LMB");
assert(event != "*-LMB-UP");
event.type = MouseEventType.buttonReleased;
assert(event != "C-LMB");
assert(event == "C-LMBUP");
assert(event == "C-LMB-UP");
assert(event != "C-S-LMB");
assert(event != "*-LMB");
assert(event == "*-LMB-UP");
event.button = MouseButton.right;
event.modifierState |= ModifierState.shift;
event.type = MouseEventType.buttonPressed;
assert(event != "C-LMB");
assert(event != "C-LMBUP");
assert(event != "C-LMB-UP");
assert(event != "C-S-LMB");
assert(event != "*-LMB");
assert(event != "*-LMB-UP");
assert(event != "C-RMB");
assert(event != "C-RMBUP");
assert(event != "C-RMB-UP");
assert(event == "C-S-RMB");
assert(event == "*-RMB");
assert(event != "*-RMB-UP");
}
/// This gives a few more options to drawing lines and such
struct Pen {
Color color; /// the foreground color
int width = 1; /// width of the line. please note that on X, wide lines are drawn centered on the coordinates, so you may have to offset things.
Style style; /// See [Style]
/+
// From X.h
#define LineSolid 0
#define LineOnOffDash 1
#define LineDoubleDash 2
LineDou- The full path of the line is drawn, but the
bleDash even dashes are filled differently from the
odd dashes (see fill-style) with CapButt
style used where even and odd dashes meet.
/* capStyle */
#define CapNotLast 0
#define CapButt 1
#define CapRound 2
#define CapProjecting 3
/* joinStyle */
#define JoinMiter 0
#define JoinRound 1
#define JoinBevel 2
/* fillStyle */
#define FillSolid 0
#define FillTiled 1
#define FillStippled 2
#define FillOpaqueStippled 3
+/
/// Style of lines drawn
enum Style {
Solid, /// a solid line
Dashed, /// a dashed line
Dotted, /// a dotted line
}
}
/++
Represents an in-memory image in the format that the GUI expects, but with its raw data available to your program.
On Windows, this means a device-independent bitmap. On X11, it is an XImage.
$(NOTE If you are writing platform-aware code and need to know low-level details, uou may check `if(Image.impl.xshmAvailable)` to see if MIT-SHM is used on X11 targets to draw `Image`s and `Sprite`s. Use `static if(UsingSimpledisplayX11)` to determine if you are compiling for an X11 target.)
Drawing an image to screen is not necessarily fast, but applying algorithms to draw to the image itself should be fast. An `Image` is also the first step in loading and displaying images loaded from files.
If you intend to draw an image to screen several times, you will want to convert it into a [Sprite].
$(PITFALL `Image` may represent a scarce, shared resource that persists across process termination, and should be disposed of properly. On X11, it uses the MIT-SHM extension, if available, which uses shared memory handles with the X server, which is a long-lived process that holds onto them after your program terminates if you don't free it.
It is possible for your user's system to run out of these handles over time, forcing them to clean it up with extraordinary measures - their GUI is liable to stop working!
Be sure these are cleaned up properly. simpledisplay will do its best to do the right thing, including cleaning them up in garbage collection sweeps (one of which is run at most normal program terminations) and catching some deadly signals. It will almost always do the right thing. But, this is no substitute for you managing the resource properly yourself. (And try not to segfault, as recovery from them is alway dicey!)
Please call `destroy(image);` when you are done with it. The easiest way to do this is with scope:
---
auto image = new Image(256, 256);
scope(exit) destroy(image);
---
As long as you don't hold on to it outside the scope.
I might change it to be an owned pointer at some point in the future.
)
Drawing pixels on the image may be simple, using the `opIndexAssign` function, but
you can also often get a fair amount of speedup by getting the raw data format and
writing some custom code.
FIXME INSERT EXAMPLES HERE
+/
final class Image {
///
this(int width, int height, bool forcexshm=false, bool enableAlpha = false) {
this.width = width;
this.height = height;
this.enableAlpha = enableAlpha;
impl.createImage(width, height, forcexshm, enableAlpha);
}
///
this(Size size, bool forcexshm=false, bool enableAlpha = false) {
this(size.width, size.height, forcexshm, enableAlpha);
}
private bool suppressDestruction;
version(X11)
this(XImage* handle) {
this.handle = handle;
this.rawData = cast(ubyte*) handle.data;
this.width = handle.width;
this.height = handle.height;
this.enableAlpha = handle.depth == 32;
suppressDestruction = true;
}
~this() {
if(suppressDestruction) return;
impl.dispose();
}
// these numbers are used for working with rawData itself, skipping putPixel and getPixel
/// if you do the math yourself you might be able to optimize it. Call these functions only once and cache the value.
pure const @system nothrow {
/*
To use these to draw a blue rectangle with size WxH at position X,Y...
// make certain that it will fit before we proceed
enforce(X + W <= img.width && Y + H <= img.height); // you could also adjust the size to clip it, but be sure not to run off since this here will do raw pointers with no bounds checks!
// gather all the values you'll need up front. These can be kept until the image changes size if you want
// (though calculating them isn't really that expensive).
auto nextLineAdjustment = img.adjustmentForNextLine();
auto offR = img.redByteOffset();
auto offB = img.blueByteOffset();
auto offG = img.greenByteOffset();
auto bpp = img.bytesPerPixel();
auto data = img.getDataPointer();
// figure out the starting byte offset
auto offset = img.offsetForTopLeftPixel() + nextLineAdjustment*Y + bpp * X;
auto startOfLine = data + offset; // get our pointer lined up on the first pixel
// and now our drawing loop for the rectangle
foreach(y; 0 .. H) {
auto data = startOfLine; // we keep the start of line separately so moving to the next line is simple and portable
foreach(x; 0 .. W) {
// write our color
data[offR] = 0;
data[offG] = 0;
data[offB] = 255;
data += bpp; // moving to the next pixel is just an addition...
}
startOfLine += nextLineAdjustment;
}
As you can see, the loop itself was very simple thanks to the calculations being moved outside.
FIXME: I wonder if I can make the pixel formats consistently 32 bit across platforms, so the color offsets
can be made into a bitmask or something so we can write them as *uint...
*/
///
int offsetForTopLeftPixel() {
version(X11) {
return 0;
} else version(Windows) {
if(enableAlpha) {
return (width * 4) * (height - 1);
} else {
return (((cast(int) width * 3 + 3) / 4) * 4) * (height - 1);
}
} else version(OSXCocoa) {
return 0 ; //throw new NotYetImplementedException();
} else static assert(0, "fill in this info for other OSes");
}
///
int offsetForPixel(int x, int y) {
version(X11) {
auto offset = (y * width + x) * 4;
return offset;
} else version(Windows) {
if(enableAlpha) {
auto itemsPerLine = width * 4;
// remember, bmps are upside down
auto offset = itemsPerLine * (height - y - 1) + x * 4;
return offset;
} else {
auto itemsPerLine = ((cast(int) width * 3 + 3) / 4) * 4;
// remember, bmps are upside down
auto offset = itemsPerLine * (height - y - 1) + x * 3;
return offset;
}
} else version(OSXCocoa) {
return 0 ; //throw new NotYetImplementedException();
} else static assert(0, "fill in this info for other OSes");
}
///
int adjustmentForNextLine() {
version(X11) {
return width * 4;
} else version(Windows) {
// windows bmps are upside down, so the adjustment is actually negative
if(enableAlpha)
return - (cast(int) width * 4);
else
return -((cast(int) width * 3 + 3) / 4) * 4;
} else version(OSXCocoa) {
return 0 ; //throw new NotYetImplementedException();
} else static assert(0, "fill in this info for other OSes");
}
/// once you have the position of a pixel, use these to get to the proper color
int redByteOffset() {
version(X11) {
return 2;
} else version(Windows) {
return 2;
} else version(OSXCocoa) {
return 0 ; //throw new NotYetImplementedException();
} else static assert(0, "fill in this info for other OSes");
}
///
int greenByteOffset() {
version(X11) {
return 1;
} else version(Windows) {
return 1;
} else version(OSXCocoa) {
return 0 ; //throw new NotYetImplementedException();
} else static assert(0, "fill in this info for other OSes");
}
///
int blueByteOffset() {
version(X11) {
return 0;
} else version(Windows) {
return 0;
} else version(OSXCocoa) {
return 0 ; //throw new NotYetImplementedException();
} else static assert(0, "fill in this info for other OSes");
}
/// Only valid if [enableAlpha] is true
int alphaByteOffset() {
version(X11) {
return 3;
} else version(Windows) {
return 3;
} else version(OSXCocoa) {
return 3; //throw new NotYetImplementedException();
} else static assert(0, "fill in this info for other OSes");
}
}
///
final void putPixel(int x, int y, Color c) {
if(x < 0 || x >= width)
return;
if(y < 0 || y >= height)
return;
impl.setPixel(x, y, c);
}
///
final Color getPixel(int x, int y) {
if(x < 0 || x >= width)
return Color.transparent;
if(y < 0 || y >= height)
return Color.transparent;
version(OSXCocoa) throw new NotYetImplementedException(); else
return impl.getPixel(x, y);
}
///
final void opIndexAssign(Color c, int x, int y) {
putPixel(x, y, c);
}
///
TrueColorImage toTrueColorImage() {
auto tci = new TrueColorImage(width, height);
convertToRgbaBytes(tci.imageData.bytes);
return tci;
}
///
static Image fromMemoryImage(MemoryImage i, bool enableAlpha = false) {
auto tci = i.getAsTrueColorImage();
auto img = new Image(tci.width, tci.height, false, enableAlpha);
img.setRgbaBytes(tci.imageData.bytes);
return img;
}
/// this is here for interop with arsd.image. where can be a TrueColorImage's data member
/// if you pass in a buffer, it will put it right there. length must be width*height*4 already
/// if you pass null, it will allocate a new one.
ubyte[] getRgbaBytes(ubyte[] where = null) {
if(where is null)
where = new ubyte[this.width*this.height*4];
convertToRgbaBytes(where);
return where;
}
/// this is here for interop with arsd.image. from can be a TrueColorImage's data member
void setRgbaBytes(in ubyte[] from ) {
assert(from.length == this.width * this.height * 4);
setFromRgbaBytes(from);
}
// FIXME: make properly cross platform by getting rgba right
/// warning: this is not portable across platforms because the data format can change
ubyte* getDataPointer() {
return impl.rawData;
}
/// for use with getDataPointer
final int bytesPerLine() const pure @safe nothrow {
version(Windows)
return enableAlpha ? (width * 4) : (((cast(int) width * 3 + 3) / 4) * 4);
else version(X11)
return 4 * width;
else version(OSXCocoa)
return 4 * width;
else static assert(0);
}
/// for use with getDataPointer
final int bytesPerPixel() const pure @safe nothrow {
version(Windows)
return enableAlpha ? 4 : 3;
else version(X11)
return 4;
else version(OSXCocoa)
return 4;
else static assert(0);
}
///
immutable int width;
///
immutable int height;
///
immutable bool enableAlpha;
//private:
mixin NativeImageImplementation!() impl;
}
/++
A convenience function to pop up a window displaying the image.
If you pass a win, it will draw the image in it. Otherwise, it will
create a window with the size of the image and run its event loop, closing
when a key is pressed.
History:
`BlockingMode` parameter added on December 8, 2021. Previously, it would
always block until the application quit which could cause bizarre behavior
inside a more complex application. Now, the default is to block until
this window closes if it is the only event loop running, and otherwise,
not to block at all and just pop up the display window asynchronously.
+/
void displayImage(Image image, SimpleWindow win = null, BlockingMode bm = BlockingMode.untilWindowCloses | BlockingMode.onlyIfNotNested) {
if(win is null) {
win = new SimpleWindow(image);
{
auto p = win.draw;
p.drawImage(Point(0, 0), image);
}
win.eventLoopWithBlockingMode(
bm, 0,
(KeyEvent ev) {
if (ev.pressed && (ev.key == Key.Escape || ev.key == Key.Space)) win.close();
} );
} else {
win.image = image;
}
}
enum FontWeight : int {
dontcare = 0,
thin = 100,
extralight = 200,
light = 300,
regular = 400,
medium = 500,
semibold = 600,
bold = 700,
extrabold = 800,
heavy = 900
}
// FIXME: i need a font cache and it needs to handle disconnects.
/++
Represents a font loaded off the operating system or the X server.
While the api here is unified cross platform, the fonts are not necessarily
available, even across machines of the same platform, so be sure to always check
for null (using [isNull]) and have a fallback plan.
When you have a font you like, use [ScreenPainter.setFont] to load it for drawing.
Worst case, a null font will automatically fall back to the default font loaded
for your system.
+/
class OperatingSystemFont {
// FIXME: when the X Connection is lost, these need to be invalidated!
// that means I need to store the original stuff again to reconstruct it too.
version(X11) {
XFontStruct* font;
XFontSet fontset;
version(with_xft) {
XftFont* xftFont;
bool isXft;
}
} else version(Windows) {
HFONT font;
int width_;
int height_;
} else version(OSXCocoa) {
// FIXME
} else static assert(0);
/++
Constructs the class and immediately calls [load].
+/
this(string name, int size = 0, FontWeight weight = FontWeight.dontcare, bool italic = false) {
load(name, size, weight, italic);
}
/++
Constructs the object, but does nothing. Call one of [load] or [loadDefault] to populate the object.
You can also call the platform-specific [loadXft], [loadCoreX], or [loadWin32] functions if appropriate for you.
History:
Added January 24, 2021.
+/
this() {
// this space intentionally left blank
}
/++
Loads specifically with the Xft library - a freetype font from a fontconfig string.
History:
Added November 13, 2020.
+/
version(with_xft)
bool loadXft(string name, int size = 0, FontWeight weight = FontWeight.dontcare, bool italic = false) {
unload();
if(!XftLibrary.attempted) {
XftLibrary.loadDynamicLibrary();
}
if(!XftLibrary.loadSuccessful)
return false;
auto display = XDisplayConnection.get;
char[256] nameBuffer = void;
int nbp = 0;
void add(in char[] a) {
nameBuffer[nbp .. nbp + a.length] = a[];
nbp += a.length;
}
add(name);
if(size) {
add(":size=");
add(toInternal!string(size));
}
if(weight != FontWeight.dontcare) {
add(":weight=");
add(weightToString(weight));
}
if(italic)
add(":slant=100");
nameBuffer[nbp] = 0;
this.xftFont = XftFontOpenName(
display,
DefaultScreen(display),
nameBuffer.ptr
);
this.isXft = true;
if(xftFont !is null) {
isMonospace_ = stringWidth("x") == stringWidth("M");
ascent_ = xftFont.ascent;
descent_ = xftFont.descent;
}
return !isNull();
}
/++
Lists available fonts from the system that match the given pattern, finding names that are suitable for passing to [OperatingSystemFont]'s constructor.
Fonts will be fed to you (possibly! it is platform and implementation dependent on if it is called immediately or later) asynchronously through the given delegate. It should return `true` if you want more, `false` if you are done. The delegate will be called once after finishing with a `init` value to let you know it is done and you can do final processing.
If `pattern` is null, it returns all available font families.
Please note that you may also receive fonts that do not match your given pattern. You should still filter them in the handler; the pattern is really just an optimization hint rather than a formal guarantee.
The format of the pattern is platform-specific.
History:
Added May 1, 2021 (dub v9.5)
+/
static void listFonts(string pattern, bool delegate(in char[] name) handler) {
version(Windows) {
auto hdc = GetDC(null);
scope(exit) ReleaseDC(null, hdc);
LOGFONT logfont;
static extern(Windows) int proc(const LOGFONT* lf, const TEXTMETRIC* tm, DWORD type, LPARAM p) {
auto localHandler = *(cast(typeof(handler)*) p);
return localHandler(lf.lfFaceName[].sliceCString) ? 1 : 0;
}
EnumFontFamiliesEx(hdc, &logfont, &proc, cast(LPARAM) &handler, 0);
} else version(X11) {
//import core.stdc.stdio;
bool done = false;
version(with_xft) {
if(!XftLibrary.attempted) {
XftLibrary.loadDynamicLibrary();
}
if(!XftLibrary.loadSuccessful)
goto skipXft;
if(!FontConfigLibrary.attempted)
FontConfigLibrary.loadDynamicLibrary();
if(!FontConfigLibrary.loadSuccessful)
goto skipXft;
{
auto got = XftListFonts(XDisplayConnection.get, 0, null, "family".ptr, "style".ptr, null);
if(got is null)
goto skipXft;
scope(exit) FcFontSetDestroy(got);
auto fontPatterns = got.fonts[0 .. got.nfont];
foreach(candidate; fontPatterns) {
char* where, whereStyle;
char* pmg = FcNameUnparse(candidate);
//FcPatternGetString(candidate, "family", 0, &where);
//FcPatternGetString(candidate, "style", 0, &whereStyle);
//if(where && whereStyle) {
if(pmg) {
if(!handler(pmg.sliceCString))
return;
//printf("%s || %s %s\n", pmg, where, whereStyle);
}
}
}
}
skipXft:
if(pattern is null)
pattern = "*";
int count;
auto coreFontsRaw = XListFonts(XDisplayConnection.get, pattern.toStringz, 10000 /* max return */, &count);
scope(exit) XFreeFontNames(coreFontsRaw);
auto coreFonts = coreFontsRaw[0 .. count];
foreach(font; coreFonts) {
char[128] tmp;
tmp[0 ..5] = "core:";
auto cf = font.sliceCString;
if(5 + cf.length > tmp.length)
assert(0, "a font name was too long, sorry i didn't bother implementing a fallback");
tmp[5 .. 5 + cf.length] = cf;
if(!handler(tmp[0 .. 5 + cf.length]))
return;
}
}
}
/++
Returns the raw content of the ttf file, if possible. This allows you to use OperatingSystemFont
to look up fonts that you then pass to things like [arsd.game.OpenGlLimitedFont] or [arsd.nanovega].
Returns null if impossible. It is impossible if the loaded font is not a local TTF file or if the
underlying system doesn't support returning the raw bytes.
History:
Added September 10, 2021 (dub v10.3)
+/
ubyte[] getTtfBytes() {
if(isNull)
return null;
version(Windows) {
auto dc = GetDC(null);
auto orig = SelectObject(dc, font);
scope(exit) {
SelectObject(dc, orig);
ReleaseDC(null, dc);
}
auto res = GetFontData(dc, 0 /* whole file */, 0 /* offset */, null, 0);
if(res == GDI_ERROR)
return null;
ubyte[] buffer = new ubyte[](res);
res = GetFontData(dc, 0 /* whole file */, 0 /* offset */, buffer.ptr, cast(DWORD) buffer.length);
if(res == GDI_ERROR)
return null; // wtf really tbh
return buffer;
} else version(with_xft) {
if(isXft && xftFont) {
if(!FontConfigLibrary.attempted)
FontConfigLibrary.loadDynamicLibrary();
if(!FontConfigLibrary.loadSuccessful)
return null;
char* file;
if (FcPatternGetString(xftFont.pattern, "file", 0, &file) == 0 /*FcResultMatch*/) {
if (file !is null && file[0]) {
import core.stdc.stdio;
auto fp = fopen(file, "rb");
if(fp is null)
return null;
scope(exit)
fclose(fp);
fseek(fp, 0, SEEK_END);
ubyte[] buffer = new ubyte[](ftell(fp));
fseek(fp, 0, SEEK_SET);
auto got = fread(buffer.ptr, 1, buffer.length, fp);
if(got != buffer.length)
return null;
return buffer;
}
}
}
return null;
}
}
// see also: XftLockFace(font) which gives a FT_Face. from /usr/include/X11/Xft/Xft.h line 352
private string weightToString(FontWeight weight) {
with(FontWeight)
final switch(weight) {
case dontcare: return "*";
case thin: return "extralight";
case extralight: return "extralight";
case light: return "light";
case regular: return "regular";
case medium: return "medium";
case semibold: return "demibold";
case bold: return "bold";
case extrabold: return "demibold";
case heavy: return "black";
}
}
/++
Loads specifically a Core X font - rendered on the X server without antialiasing. Best performance.
History:
Added November 13, 2020. Before then, this code was integrated in the [load] function.
+/
version(X11)
bool loadCoreX(string name, int size = 0, FontWeight weight = FontWeight.dontcare, bool italic = false) {
unload();
string xfontstr;
if(name.length > 3 && name[0 .. 3] == "-*-") {
// this is kinda a disgusting hack but if the user sends an exact
// string I'd like to honor it...
xfontstr = name;
} else {
string weightstr = weightToString(weight);
string sizestr;
if(size == 0)
sizestr = "*";
else
sizestr = toInternal!string(size);
xfontstr = "-*-"~name~"-"~weightstr~"-"~(italic ? "i" : "r")~"-*-*-"~sizestr~"-*-*-*-*-*-*-*\0";
}
//import std.stdio; writeln(xfontstr);
auto display = XDisplayConnection.get;
font = XLoadQueryFont(display, xfontstr.ptr);
if(font is null)
return false;
char** lol;
int lol2;
char* lol3;
fontset = XCreateFontSet(display, xfontstr.ptr, &lol, &lol2, &lol3);
prepareFontInfo();
return !isNull();
}
version(X11)
private void prepareFontInfo() {
if(font !is null) {
isMonospace_ = stringWidth("l") == stringWidth("M");
ascent_ = font.max_bounds.ascent;
descent_ = font.max_bounds.descent;
}
}
/++
Loads a Windows font. You probably want to use [load] instead to be more generic.
History:
Added November 13, 2020. Before then, this code was integrated in the [load] function.
+/
version(Windows)
bool loadWin32(string name, int size = 0, FontWeight weight = FontWeight.dontcare, bool italic = false, HDC hdc = null) {
unload();
WCharzBuffer buffer = WCharzBuffer(name);
font = CreateFont(size, 0, 0, 0, cast(int) weight, italic, 0, 0, 0, 0, 0, 0, 0, buffer.ptr);
prepareFontInfo(hdc);
return !isNull();
}
version(Windows)
void prepareFontInfo(HDC hdc = null) {
if(font is null)
return;
TEXTMETRIC tm;
auto dc = hdc ? hdc : GetDC(null);
auto orig = SelectObject(dc, font);
GetTextMetrics(dc, &tm);
SelectObject(dc, orig);
if(hdc is null)
ReleaseDC(null, dc);
width_ = tm.tmAveCharWidth;
height_ = tm.tmHeight;
ascent_ = tm.tmAscent;
descent_ = tm.tmDescent;
// If this bit is set the font is a variable pitch font. If this bit is clear the font is a fixed pitch font. Note very carefully that those meanings are the opposite of what the constant name implies.
isMonospace_ = (tm.tmPitchAndFamily & TMPF_FIXED_PITCH) == 0;
}
/++
`name` is a font name, but it can also be a more complicated string parsed in an OS-specific way.
On X, you may prefix a name with `core:` to bypass the freetype engine causing this function to forward to [loadCoreX]. Otherwise,
it calls [loadXft] if the library is available. If the library or font is not available on Xft, it falls back on [loadCoreX].
On Windows, it forwards directly to [loadWin32].
Params:
name = font name. This is looked up by the operating system and may be interpreted differently across platforms or user machines and their preferences.
size = font size. This may be interpreted differently by different systems and different fonts. Size 0 means load a default, which may not exist and cause [isNull] to become true.
weight = approximate boldness, results may vary.
italic = try to get a slanted version of the given font.
History:
Xft support was added on November 13, 2020. It would only load core fonts. Xft inclusion changed font lookup and interpretation of the `size` parameter, requiring a major version bump. This caused release v9.0.
+/
bool load(string name, int size = 0, FontWeight weight = FontWeight.dontcare, bool italic = false) {
version(X11) {
version(with_xft) {
if(name.length > 5 && name[0 .. 5] == "core:") {
goto core;
}
if(loadXft(name, size, weight, italic))
return true;
// if xft fails, fallback to core to avoid breaking
// code that already depended on this.
}
core:
if(name.length > 5 && name[0 .. 5] == "core:") {
name = name[5 .. $];
}
return loadCoreX(name, size, weight, italic);
} else version(Windows) {
return loadWin32(name, size, weight, italic);
} else version(OSXCocoa) {
// FIXME
return false;
} else static assert(0);
}
///
void unload() {
if(isNull())
return;
version(X11) {
auto display = XDisplayConnection.display;
if(display is null)
return;
version(with_xft) {
if(isXft) {
if(xftFont)
XftFontClose(display, xftFont);
isXft = false;
xftFont = null;
return;
}
}
if(font && font !is ScreenPainterImplementation.defaultfont)
XFreeFont(display, font);
if(fontset && fontset !is ScreenPainterImplementation.defaultfontset)
XFreeFontSet(display, fontset);
font = null;
fontset = null;
} else version(Windows) {
DeleteObject(font);
font = null;
} else version(OSXCocoa) {
// FIXME
} else static assert(0);
}
private bool isMonospace_;
/++
History:
Added January 16, 2021
+/
bool isMonospace() {
return isMonospace_;
}
/++
Returns the average width of the font, conventionally defined as the width of the lowercase 'x' character.
History:
Added March 26, 2020
Documented January 16, 2021
+/
int averageWidth() {
version(X11) {
return stringWidth("x");
} else version(Windows)
return width_;
else assert(0);
}
/++
Returns the width of the string as drawn on the specified window, or the default screen if the window is null.
History:
Added January 16, 2021
+/
int stringWidth(scope const(char)[] s, SimpleWindow window = null) {
// FIXME: what about tab?
if(isNull)
return 0;
version(X11) {
version(with_xft)
if(isXft && xftFont !is null) {
//return xftFont.max_advance_width;
XGlyphInfo extents;
XftTextExtentsUtf8(XDisplayConnection.get, xftFont, s.ptr, cast(int) s.length, &extents);
//import std.stdio; writeln(extents);
return extents.xOff;
}
if(font is null)
return 0;
else if(fontset) {
XRectangle rect;
Xutf8TextExtents(fontset, s.ptr, cast(int) s.length, null, &rect);
return rect.width;
} else {
return XTextWidth(font, s.ptr, cast(int) s.length);
}
} else version(Windows) {
WCharzBuffer buffer = WCharzBuffer(s);
return stringWidth(buffer.slice, window);
}
else assert(0);
}
version(Windows)
/// ditto
int stringWidth(scope const(wchar)[] s, SimpleWindow window = null) {
if(isNull)
return 0;
version(Windows) {
SIZE size;
prepareContext(window);
scope(exit) releaseContext();
GetTextExtentPoint32W(dc, s.ptr, cast(int) s.length, &size);
return size.cx;
} else {
// std.conv can do this easily but it is slow to import and i don't think it is worth it
static assert(0, "not implemented yet");
//return stringWidth(s, window);
}
}
private {
int prepRefcount;
version(Windows) {
HDC dc;
HANDLE orig;
HWND hwnd;
}
}
/++
[stringWidth] can be slow. This helps speed it up if you are doing a lot of calculations. Just prepareContext when you start this work and releaseContext when you are done. Important to release before too long though as it can be a scarce system resource.
History:
Added January 23, 2021
+/
void prepareContext(SimpleWindow window = null) {
prepRefcount++;
if(prepRefcount == 1) {
version(Windows) {
hwnd = window is null ? null : window.impl.hwnd;
dc = GetDC(hwnd);
orig = SelectObject(dc, font);
}
}
}
/// ditto
void releaseContext() {
prepRefcount--;
if(prepRefcount == 0) {
version(Windows) {
SelectObject(dc, orig);
ReleaseDC(hwnd, dc);
hwnd = null;
dc = null;
orig = null;
}
}
}
/+
FIXME: I think I need advance and kerning pair
int advance(dchar from, dchar to) { } // use dchar.init for first item in string
+/
/++
Returns the height of the font.
History:
Added March 26, 2020
Documented January 16, 2021
+/
int height() {
version(X11) {
version(with_xft)
if(isXft && xftFont !is null) {
return xftFont.ascent + xftFont.descent; // i don't use height here because it doesn't include the baseline pixel
}
if(font is null)
return 0;
return font.max_bounds.ascent + font.max_bounds.descent;
} else version(Windows)
return height_;
else assert(0);
}
private int ascent_;
private int descent_;
/++
Max ascent above the baseline.
History:
Added January 22, 2021
+/
int ascent() {
return ascent_;
}
/++
Max descent below the baseline.
History:
Added January 22, 2021
+/
int descent() {
return descent_;
}
/++
Loads the default font used by [ScreenPainter] if none others are loaded.
Returns:
This method mutates the `this` object, but then returns `this` for
easy chaining like:
---
auto font = foo.isNull ? foo : foo.loadDefault
---
History:
Added previously, but left unimplemented until January 24, 2021.
+/
OperatingSystemFont loadDefault() {
unload();
version(X11) {
// another option would be https://tronche.com/gui/x/xlib/graphics/font-metrics/XQueryFont.html
// but meh since sdpy does its own thing, this should be ok too
ScreenPainterImplementation.ensureDefaultFontLoaded();
this.font = ScreenPainterImplementation.defaultfont;
this.fontset = ScreenPainterImplementation.defaultfontset;
prepareFontInfo();
} else version(Windows) {
ScreenPainterImplementation.ensureDefaultFontLoaded();
this.font = ScreenPainterImplementation.defaultGuiFont;
prepareFontInfo();
} else throw new NotYetImplementedException();
return this;
}
///
bool isNull() {
version(OSXCocoa) throw new NotYetImplementedException(); else {
version(with_xft)
if(isXft)
return xftFont is null;
return font is null;
}
}
/* Metrics */
/+
GetABCWidth
GetKerningPairs
if I do it right, I can size it all here, and match
what happens when I draw the full string with the OS functions.
subclasses might do the same thing while getting the glyphs on images
struct GlyphInfo {
int glyph;
size_t stringIdxStart;
size_t stringIdxEnd;
Rectangle boundingBox;
}
GlyphInfo[] getCharBoxes() {
// XftTextExtentsUtf8
return null;
}
+/
~this() {
unload();
}
}
version(Windows)
private string sliceCString(const(wchar)[] w) {
return makeUtf8StringFromWindowsString(cast(wchar*) w.ptr);
}
private inout(char)[] sliceCString(inout(char)* s) {
import core.stdc.string;
auto len = strlen(s);
return s[0 .. len];
}
/**
The 2D drawing proxy. You acquire one of these with [SimpleWindow.draw] rather
than constructing it directly. Then, it is reference counted so you can pass it
at around and when the last ref goes out of scope, the buffered drawing activities
are all carried out.
Most functions use the outlineColor instead of taking a color themselves.
ScreenPainter is reference counted and draws its buffer to the screen when its
final reference goes out of scope.
*/
struct ScreenPainter {
CapableOfBeingDrawnUpon window;
this(CapableOfBeingDrawnUpon window, NativeWindowHandle handle, bool manualInvalidations) {
this.window = window;
if(window.closed)
return; // null painter is now allowed so no need to throw anymore, this likely happens at the end of a program anyway
//currentClipRectangle = arsd.color.Rectangle(0, 0, window.width, window.height);
currentClipRectangle = arsd.color.Rectangle(short.min, short.min, short.max, short.max);
if(window.activeScreenPainter !is null) {
impl = window.activeScreenPainter;
if(impl.referenceCount == 0) {
impl.window = window;
impl.create(handle);
}
impl.manualInvalidations = manualInvalidations;
impl.referenceCount++;
// writeln("refcount ++ ", impl.referenceCount);
} else {
impl = new ScreenPainterImplementation;
impl.window = window;
impl.create(handle);
impl.referenceCount = 1;
impl.manualInvalidations = manualInvalidations;
window.activeScreenPainter = impl;
//import std.stdio; writeln("constructed");
}
copyActiveOriginals();
}
/++
If you are using manual invalidations, this informs the
window system that a section needs to be redrawn.
If you didn't opt into manual invalidation, you don't
have to call this.
History:
Added December 30, 2021 (dub v10.5)
+/
void invalidateRect(Rectangle rect) {
if(impl is null) return;
// transform(rect)
rect.left += _originX;
rect.right += _originX;
rect.top += _originY;
rect.bottom += _originY;
impl.invalidateRect(rect);
}
private Pen originalPen;
private Color originalFillColor;
private arsd.color.Rectangle originalClipRectangle;
void copyActiveOriginals() {
if(impl is null) return;
originalPen = impl._activePen;
originalFillColor = impl._fillColor;
originalClipRectangle = impl._clipRectangle;
}
~this() {
if(impl is null) return;
impl.referenceCount--;
//writeln("refcount -- ", impl.referenceCount);
if(impl.referenceCount == 0) {
//import std.stdio; writeln("destructed");
impl.dispose();
*window.activeScreenPainter = ScreenPainterImplementation.init;
//import std.stdio; writeln("paint finished");
} else {
// there is still an active reference, reset stuff so the
// next user doesn't get weirdness via the reference
this.rasterOp = RasterOp.normal;
pen = originalPen;
fillColor = originalFillColor;
impl.setClipRectangle(originalClipRectangle.left, originalClipRectangle.top, originalClipRectangle.width, originalClipRectangle.height);
}
}
this(this) {
if(impl is null) return;
impl.referenceCount++;
//writeln("refcount ++ ", impl.referenceCount);
copyActiveOriginals();
}
private int _originX;
private int _originY;
@property int originX() { return _originX; }
@property int originY() { return _originY; }
@property int originX(int a) {
_originX = a;
return _originX;
}
@property int originY(int a) {
_originY = a;
return _originY;
}
arsd.color.Rectangle currentClipRectangle; // set BEFORE doing any transformations
private void transform(ref Point p) {
if(impl is null) return;
p.x += _originX;
p.y += _originY;
}
// this needs to be checked BEFORE the originX/Y transformation
private bool isClipped(Point p) {
return !currentClipRectangle.contains(p);
}
private bool isClipped(Point p, int width, int height) {
return !currentClipRectangle.overlaps(arsd.color.Rectangle(p, Size(width + 1, height + 1)));
}
private bool isClipped(Point p, Size s) {
return !currentClipRectangle.overlaps(arsd.color.Rectangle(p, Size(s.width + 1, s.height + 1)));
}
private bool isClipped(Point p, Point p2) {
// need to ensure the end points are actually included inside, so the +1 does that
return !currentClipRectangle.overlaps(arsd.color.Rectangle(p, p2 + Point(1, 1)));
}
/++
Sets the clipping region for drawing. If width == 0 && height == 0, disabled clipping.
Returns:
The old clip rectangle.
History:
Return value was `void` prior to May 10, 2021.
+/
arsd.color.Rectangle setClipRectangle(Point pt, int width, int height) {
if(impl is null) return currentClipRectangle;
if(pt == currentClipRectangle.upperLeft && width == currentClipRectangle.width && height == currentClipRectangle.height)
return currentClipRectangle; // no need to do anything
auto old = currentClipRectangle;
currentClipRectangle = arsd.color.Rectangle(pt, Size(width, height));
transform(pt);
impl.setClipRectangle(pt.x, pt.y, width, height);
return old;
}
/// ditto
arsd.color.Rectangle setClipRectangle(arsd.color.Rectangle rect) {
if(impl is null) return currentClipRectangle;
return setClipRectangle(rect.upperLeft, rect.width, rect.height);
}
///
void setFont(OperatingSystemFont font) {
if(impl is null) return;
impl.setFont(font);
}
///
int fontHeight() {
if(impl is null) return 0;
return impl.fontHeight();
}
private Pen activePen;
///
@property void pen(Pen p) {
if(impl is null) return;
activePen = p;
impl.pen(p);
}
///
@scriptable
@property void outlineColor(Color c) {
if(impl is null) return;
if(activePen.color == c)
return;
activePen.color = c;
impl.pen(activePen);
}
///
@scriptable
@property void fillColor(Color c) {
if(impl is null) return;
impl.fillColor(c);
}
///
@property void rasterOp(RasterOp op) {
if(impl is null) return;
impl.rasterOp(op);
}
void updateDisplay() {
// FIXME this should do what the dtor does
}
/// Scrolls the contents in the bounding rectangle by dx, dy. Positive dx means scroll left (make space available at the right), positive dy means scroll up (make space available at the bottom)
void scrollArea(Point upperLeft, int width, int height, int dx, int dy) {
if(impl is null) return;
if(isClipped(upperLeft, width, height)) return;
transform(upperLeft);
version(Windows) {
// http://msdn.microsoft.com/en-us/library/windows/desktop/bb787589%28v=vs.85%29.aspx
RECT scroll = RECT(upperLeft.x, upperLeft.y, upperLeft.x + width, upperLeft.y + height);
RECT clip = scroll;
RECT uncovered;
HRGN hrgn;
if(!ScrollDC(impl.hdc, -dx, -dy, &scroll, &clip, hrgn, &uncovered))
throw new Exception("ScrollDC");
} else version(X11) {
// FIXME: clip stuff outside this rectangle
XCopyArea(impl.display, impl.d, impl.d, impl.gc, upperLeft.x, upperLeft.y, width, height, upperLeft.x - dx, upperLeft.y - dy);
} else version(OSXCocoa) {
throw new NotYetImplementedException();
} else static assert(0);
}
///
void clear(Color color = Color.white()) {
if(impl is null) return;
fillColor = color;
outlineColor = color;
drawRectangle(Point(0, 0), window.width, window.height);
}
/++
Draws a pixmap (represented by the [Sprite] class) on the drawable.
Params:
upperLeft = point on the window where the upper left corner of the image will be drawn
imageUpperLeft = point on the image to start the slice to draw
sliceSize = size of the slice of the image to draw on the window. If width or height is 0, it uses the entire width or height of the image.
History:
The `imageUpperLeft` and `sliceSize` parameters were added on March 11, 2021 (dub v9.3.0)
+/
version(OSXCocoa) {} else // NotYetImplementedException
void drawPixmap(Sprite s, Point upperLeft, Point imageUpperLeft = Point(0, 0), Size sliceSize = Size(0, 0)) {
if(impl is null) return;
if(isClipped(upperLeft, s.width, s.height)) return;
transform(upperLeft);
impl.drawPixmap(s, upperLeft.x, upperLeft.y, imageUpperLeft.x, imageUpperLeft.y, sliceSize.width, sliceSize.height);
}
///
void drawImage(Point upperLeft, Image i, Point upperLeftOfImage = Point(0, 0), int w = 0, int h = 0) {
if(impl is null) return;
//if(isClipped(upperLeft, w, h)) return; // FIXME
transform(upperLeft);
if(w == 0 || w > i.width)
w = i.width;
if(h == 0 || h > i.height)
h = i.height;
if(upperLeftOfImage.x < 0)
upperLeftOfImage.x = 0;
if(upperLeftOfImage.y < 0)
upperLeftOfImage.y = 0;
impl.drawImage(upperLeft.x, upperLeft.y, i, upperLeftOfImage.x, upperLeftOfImage.y, w, h);
}
///
Size textSize(in char[] text) {
if(impl is null) return Size(0, 0);
return impl.textSize(text);
}
/++
Draws a string in the window with the set font (see [setFont] to change it).
Params:
upperLeft = the upper left point of the bounding box of the text
text = the string to draw
lowerRight = the lower right point of the bounding box of the text. If 0, 0, there is no lower right bound.
alignment = A [arsd.docs.general_concepts#bitflags|combination] of [TextAlignment] flags
+/
@scriptable
void drawText(Point upperLeft, in char[] text, Point lowerRight = Point(0, 0), uint alignment = 0) {
if(impl is null) return;
if(lowerRight.x != 0 || lowerRight.y != 0) {
if(isClipped(upperLeft, lowerRight)) return;
transform(lowerRight);
} else {
if(isClipped(upperLeft, textSize(text))) return;
}
transform(upperLeft);
impl.drawText(upperLeft.x, upperLeft.y, lowerRight.x, lowerRight.y, text, alignment);
}
/++
Draws text using a custom font.
This is still MAJOR work in progress.
Creating a [DrawableFont] can be tricky and require additional dependencies.
+/
void drawText(DrawableFont font, Point upperLeft, in char[] text) {
if(impl is null) return;
if(isClipped(upperLeft, Point(int.max, int.max))) return;
transform(upperLeft);
font.drawString(this, upperLeft, text);
}
version(Windows)
void drawText(Point upperLeft, scope const(wchar)[] text) {
if(impl is null) return;
if(isClipped(upperLeft, Point(int.max, int.max))) return;
transform(upperLeft);
if(text.length && text[$-1] == '\n')
text = text[0 .. $-1]; // tailing newlines are weird on windows...
TextOutW(impl.hdc, upperLeft.x, upperLeft.y, text.ptr, cast(int) text.length);
}
static struct TextDrawingContext {
Point boundingBoxUpperLeft;
Point boundingBoxLowerRight;
Point currentLocation;
Point lastDrewUpperLeft;
Point lastDrewLowerRight;
// how do i do right aligned rich text?
// i kinda want to do a pre-made drawing then right align
// draw the whole block.
//
// That's exactly the diff: inline vs block stuff.
// I need to get coordinates of an inline section out too,
// not just a bounding box, but a series of bounding boxes
// should be ok. Consider what's needed to detect a click
// on a link in the middle of a paragraph breaking a line.
//
// Generally, we should be able to get the rectangles of
// any portion we draw.
//
// It also needs to tell what text is left if it overflows
// out of the box, so we can do stuff like float images around
// it. It should not attempt to draw a letter that would be
// clipped.
//
// I might also turn off word wrap stuff.
}
void drawText(TextDrawingContext context, in char[] text, uint alignment = 0) {
if(impl is null) return;
// FIXME
}
/// Drawing an individual pixel is slow. Avoid it if possible.
void drawPixel(Point where) {
if(impl is null) return;
if(isClipped(where)) return;
transform(where);
impl.drawPixel(where.x, where.y);
}
/// Draws a pen using the current pen / outlineColor
@scriptable
void drawLine(Point starting, Point ending) {
if(impl is null) return;
if(isClipped(starting, ending)) return;
transform(starting);
transform(ending);
impl.drawLine(starting.x, starting.y, ending.x, ending.y);
}
/// Draws a rectangle using the current pen/outline color for the border and brush/fill color for the insides
/// The outer lines, inclusive of x = 0, y = 0, x = width - 1, and y = height - 1 are drawn with the outlineColor
/// The rest of the pixels are drawn with the fillColor. If fillColor is transparent, those pixels are not drawn.
@scriptable
void drawRectangle(Point upperLeft, int width, int height) {
if(impl is null) return;
if(isClipped(upperLeft, width, height)) return;
transform(upperLeft);
impl.drawRectangle(upperLeft.x, upperLeft.y, width, height);
}
/// ditto
void drawRectangle(Point upperLeft, Size size) {
if(impl is null) return;
if(isClipped(upperLeft, size.width, size.height)) return;
transform(upperLeft);
impl.drawRectangle(upperLeft.x, upperLeft.y, size.width, size.height);
}
/// ditto
void drawRectangle(Point upperLeft, Point lowerRightInclusive) {
if(impl is null) return;
if(isClipped(upperLeft, lowerRightInclusive + Point(1, 1))) return;
transform(upperLeft);
transform(lowerRightInclusive);
impl.drawRectangle(upperLeft.x, upperLeft.y,
lowerRightInclusive.x - upperLeft.x + 1, lowerRightInclusive.y - upperLeft.y + 1);
}
// overload added on May 12, 2021
/// ditto
void drawRectangle(Rectangle rect) {
drawRectangle(rect.upperLeft, rect.size);
}
/// Arguments are the points of the bounding rectangle
void drawEllipse(Point upperLeft, Point lowerRight) {
if(impl is null) return;
if(isClipped(upperLeft, lowerRight)) return;
transform(upperLeft);
transform(lowerRight);
impl.drawEllipse(upperLeft.x, upperLeft.y, lowerRight.x, lowerRight.y);
}
/++
start and finish are units of degrees * 64
History:
The Windows implementation didn't match the Linux implementation until September 24, 2021.
They still don't exactly match in outlining the arc with straight lines (Windows does, Linux doesn't for now).
+/
void drawArc(Point upperLeft, int width, int height, int start, int finish) {
if(impl is null) return;
// FIXME: not actually implemented
if(isClipped(upperLeft, width, height)) return;
transform(upperLeft);
impl.drawArc(upperLeft.x, upperLeft.y, width, height, start, finish);
}
/// this function draws a circle with the drawEllipse() function above, it requires the upper left point and the radius
void drawCircle(Point upperLeft, int diameter) {
drawEllipse(upperLeft, Point(upperLeft.x + diameter, upperLeft.y + diameter));
}
/// .
void drawPolygon(Point[] vertexes) {
if(impl is null) return;
assert(vertexes.length);
int minX = int.max, minY = int.max, maxX = int.min, maxY = int.min;
foreach(ref vertex; vertexes) {
if(vertex.x < minX)
minX = vertex.x;
if(vertex.y < minY)
minY = vertex.y;
if(vertex.x > maxX)
maxX = vertex.x;
if(vertex.y > maxY)
maxY = vertex.y;
transform(vertex);
}
if(isClipped(Point(minX, maxY), Point(maxX + 1, maxY + 1))) return;
impl.drawPolygon(vertexes);
}
/// ditto
void drawPolygon(Point[] vertexes...) {
if(impl is null) return;
drawPolygon(vertexes);
}
// and do a draw/fill in a single call maybe. Windows can do it... but X can't, though it could do two calls.
//mixin NativeScreenPainterImplementation!() impl;
// HACK: if I mixin the impl directly, it won't let me override the copy
// constructor! The linker complains about there being multiple definitions.
// I'll make the best of it and reference count it though.
ScreenPainterImplementation* impl;
}
// HACK: I need a pointer to the implementation so it's separate
struct ScreenPainterImplementation {
CapableOfBeingDrawnUpon window;
int referenceCount;
mixin NativeScreenPainterImplementation!();
}
// FIXME: i haven't actually tested the sprite class on MS Windows
/**
Sprites are optimized for fast drawing on the screen, but slow for direct pixel
access. They are best for drawing a relatively unchanging image repeatedly on the screen.
On X11, this corresponds to an `XPixmap`. On Windows, it still uses a bitmap,
though I'm not sure that's ideal and the implementation might change.
You create one by giving a window and an image. It optimizes for that window,
and copies the image into it to use as the initial picture. Creating a sprite
can be quite slow (especially over a network connection) so you should do it
as little as possible and just hold on to your sprite handles after making them.
simpledisplay does try to do its best though, using the XSHM extension if available,
but you should still write your code as if it will always be slow.
Then you can use `sprite.drawAt(painter, point);` to draw it, which should be
a fast operation - much faster than drawing the Image itself every time.
`Sprite` represents a scarce resource which should be freed when you
are done with it. Use the `dispose` method to do this. Do not use a `Sprite`
after it has been disposed. If you are unsure about this, don't take chances,
just let the garbage collector do it for you. But ideally, you can manage its
lifetime more efficiently.
$(NOTE `Sprite`, like the rest of simpledisplay's `ScreenPainter`, does not
support alpha blending in its drawing at this time. That might change in the
future, but if you need alpha blending right now, use OpenGL instead. See
`gamehelpers.d` for a similar class to `Sprite` that uses OpenGL: `OpenGlTexture`.)
Update: on April 23, 2021, I finally added alpha blending support. You must opt
in by setting the enableAlpha = true in the constructor.
*/
version(OSXCocoa) {} else // NotYetImplementedException
class Sprite : CapableOfBeingDrawnUpon {
///
ScreenPainter draw() {
return ScreenPainter(this, handle, false);
}
/++
Copies the sprite's current state into a [TrueColorImage].
Be warned: this can be a very slow operation
History:
Actually implemented on March 14, 2021
+/
TrueColorImage takeScreenshot() {
return trueColorImageFromNativeHandle(handle, width, height);
}
void delegate() paintingFinishedDg() { return null; }
bool closed() { return false; }
ScreenPainterImplementation* activeScreenPainter_;
protected ScreenPainterImplementation* activeScreenPainter() { return activeScreenPainter_; }
protected void activeScreenPainter(ScreenPainterImplementation* i) { activeScreenPainter_ = i; }
version(Windows)
private ubyte* rawData;
// FIXME: sprites are lost when disconnecting from X! We need some way to invalidate them...
// ditto on the XPicture stuff
version(X11) {
private static XRenderPictFormat* RGB24;
private static XRenderPictFormat* ARGB32;
private Picture xrenderPicture;
}
version(X11)
private static void requireXRender() {
if(!XRenderLibrary.loadAttempted) {
XRenderLibrary.loadDynamicLibrary();
}
if(!XRenderLibrary.loadSuccessful)
throw new Exception("XRender library load failure");
auto display = XDisplayConnection.get;
// FIXME: if we migrate X displays, these need to be changed
if(RGB24 is null)
RGB24 = XRenderFindStandardFormat(display, PictStandardRGB24);
if(ARGB32 is null)
ARGB32 = XRenderFindStandardFormat(display, PictStandardARGB32);
}
protected this() {}
this(SimpleWindow win, int width, int height, bool enableAlpha = false) {
this._width = width;
this._height = height;
this.enableAlpha = enableAlpha;
version(X11) {
auto display = XDisplayConnection.get();
if(enableAlpha) {
requireXRender();
}
handle = XCreatePixmap(display, cast(Drawable) win.window, width, height, enableAlpha ? 32 : DefaultDepthOfDisplay(display));
if(enableAlpha) {
XRenderPictureAttributes attrs;
xrenderPicture = XRenderCreatePicture(display, handle, ARGB32, 0, &attrs);
}
} else version(Windows) {
version(CRuntime_DigitalMars) {
//if(enableAlpha)
//throw new Exception("Alpha support not available, try recompiling with -m32mscoff");
}
BITMAPINFO infoheader;
infoheader.bmiHeader.biSize = infoheader.bmiHeader.sizeof;
infoheader.bmiHeader.biWidth = width;
infoheader.bmiHeader.biHeight = height;
infoheader.bmiHeader.biPlanes = 1;
infoheader.bmiHeader.biBitCount = enableAlpha ? 32 : 24;
infoheader.bmiHeader.biCompression = BI_RGB;
// FIXME: this should prolly be a device dependent bitmap...
handle = CreateDIBSection(
null,
&infoheader,
DIB_RGB_COLORS,
cast(void**) &rawData,
null,
0);
if(handle is null)
throw new Exception("couldn't create pixmap");
}
}
/// Makes a sprite based on the image with the initial contents from the Image
this(SimpleWindow win, Image i) {
this(win, i.width, i.height, i.enableAlpha);
version(X11) {
auto display = XDisplayConnection.get();
auto gc = XCreateGC(display, this.handle, 0, null);
scope(exit) XFreeGC(display, gc);
if(i.usingXshm)
XShmPutImage(display, cast(Drawable) handle, gc, i.handle, 0, 0, 0, 0, i.width, i.height, false);
else
XPutImage(display, cast(Drawable) handle, gc, i.handle, 0, 0, 0, 0, i.width, i.height);
} else version(Windows) {
auto itemsPerLine = enableAlpha ? (4 * width) : (((cast(int) width * 3 + 3) / 4) * 4);
auto arrLength = itemsPerLine * height;
rawData[0..arrLength] = i.rawData[0..arrLength];
} else version(OSXCocoa) {
// FIXME: I have no idea if this is even any good
ubyte* rawData;
auto colorSpace = CGColorSpaceCreateDeviceRGB();
context = CGBitmapContextCreate(null, width, height, 8, 4*width,
colorSpace,
kCGImageAlphaPremultipliedLast
|kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colorSpace);
rawData = CGBitmapContextGetData(context);
auto rdl = (width * height * 4);
rawData[0 .. rdl] = i.rawData[0 .. rdl];
} else static assert(0);
}
/++
Draws the image on the specified painter at the specified point. The point is the upper-left point where the image will be drawn.
Params:
where = point on the window where the upper left corner of the image will be drawn
imageUpperLeft = point on the image to start the slice to draw
sliceSize = size of the slice of the image to draw on the window. If width or height is 0, it uses the entire width or height of the image.
History:
The `imageUpperLeft` and `sliceSize` parameters were added on March 11, 2021 (dub v9.3.0)
+/
void drawAt(ScreenPainter painter, Point where, Point imageUpperLeft = Point(0, 0), Size sliceSize = Size(0, 0)) {
painter.drawPixmap(this, where, imageUpperLeft, sliceSize);
}
/// Call this when you're ready to get rid of it
void dispose() {
version(X11) {
if(xrenderPicture) {
XRenderFreePicture(XDisplayConnection.get, xrenderPicture);
xrenderPicture = None;
}
if(handle)
XFreePixmap(XDisplayConnection.get(), handle);
handle = None;
} else version(Windows) {
if(handle)
DeleteObject(handle);
handle = null;
} else version(OSXCocoa) {
if(context)
CGContextRelease(context);
context = null;
} else static assert(0);
}
~this() {
dispose();
}
///
final @property int width() { return _width; }
///
final @property int height() { return _height; }
///
static Sprite fromMemoryImage(SimpleWindow win, MemoryImage img, bool enableAlpha = false) {
return new Sprite(win, Image.fromMemoryImage(img, enableAlpha));
}
auto nativeHandle() {
return handle;
}
private:
int _width;
int _height;
bool enableAlpha;
version(X11)
Pixmap handle;
else version(Windows)
HBITMAP handle;
else version(OSXCocoa)
CGContextRef context;
else static assert(0);
}
/++
Represents a display-side gradient pseudo-image. Actually construct it with [LinearGradient], [RadialGradient], or [ConicalGradient].
History:
Added November 20, 2021 (dub v10.4)
+/
abstract class Gradient : Sprite {
protected this(int w, int h) {
version(X11) {
Sprite.requireXRender();
super();
enableAlpha = true;
_width = w;
_height = h;
} else version(Windows) {
super(null, w, h, true); // on Windows i'm just making a bitmap myself
}
}
version(Windows)
final void forEachPixel(scope Color delegate(int x, int y) dg) {
auto ptr = rawData;
foreach(j; 0 .. _height)
foreach(i; 0 .. _width) {
auto color = dg(i, _height - j - 1); // cuz of upside down bitmap
*rawData = (color.a * color.b) / 255; rawData++;
*rawData = (color.a * color.g) / 255; rawData++;
*rawData = (color.a * color.r) / 255; rawData++;
*rawData = color.a; rawData++;
}
}
version(X11)
protected void helper(scope Stop[] stops, scope Picture delegate(scope XFixed[] stopsPositions, scope XRenderColor[] colors) dg) {
assert(stops.length > 0);
assert(stops.length <= 16, "I got lazy with buffers");
XFixed[16] stopsPositions = void;
XRenderColor[16] colors = void;
foreach(idx, stop; stops) {
stopsPositions[idx] = cast(int)(stop.percentage * ushort.max);
auto c = stop.c;
colors[idx] = XRenderColor(
cast(ushort)(c.r * ushort.max / 255),
cast(ushort)(c.g * ushort.max / 255),
cast(ushort)(c.b * ushort.max / 255),
cast(ushort)(c.a * ubyte.max) // max value here is fractional
);
}
xrenderPicture = dg(stopsPositions, colors);
}
///
static struct Stop {
float percentage; /// between 0 and 1.0
Color c;
}
}
/++
Creates a linear gradient between p1 and p2.
X ONLY RIGHT NOW
History:
Added November 20, 2021 (dub v10.4)
Bugs:
Not yet implemented on Windows.
+/
class LinearGradient : Gradient {
/++
+/
this(Point p1, Point p2, Stop[] stops...) {
super(p2.x, p2.y);
version(X11) {
XLinearGradient gradient;
gradient.p1 = XPointFixed(p1.x * ushort.max, p1.y * ushort.max);
gradient.p2 = XPointFixed(p2.x * ushort.max, p2.y * ushort.max);
helper(stops, (scope XFixed[] stopsPositions, scope XRenderColor[] colors) {
return XRenderCreateLinearGradient(
XDisplayConnection.get,
&gradient,
stopsPositions.ptr,
colors.ptr,
cast(int) stops.length);
});
} else version(Windows) {
// FIXME
forEachPixel((int x, int y) {
import core.stdc.math;
//sqrtf(
return Color.transparent;
// return Color(x * 2, y * 2, 0, 128); // this result is so beautiful
});
}
}
}
/++
A conical gradient goes from color to color around a circumference from a center point.
X ONLY RIGHT NOW
History:
Added November 20, 2021 (dub v10.4)
Bugs:
Not yet implemented on Windows.
+/
class ConicalGradient : Gradient {
/++
+/
this(Point center, float angleInDegrees, Stop[] stops...) {
super(center.x * 2, center.y * 2);
version(X11) {
XConicalGradient gradient;
gradient.center = XPointFixed(center.x * ushort.max, center.y * ushort.max);
gradient.angle = cast(int)(angleInDegrees * ushort.max);
helper(stops, (scope XFixed[] stopsPositions, scope XRenderColor[] colors) {
return XRenderCreateConicalGradient(
XDisplayConnection.get,
&gradient,
stopsPositions.ptr,
colors.ptr,
cast(int) stops.length);
});
} else version(Windows) {
// FIXME
forEachPixel((int x, int y) {
import core.stdc.math;
//sqrtf(
return Color.transparent;
// return Color(x * 2, y * 2, 0, 128); // this result is so beautiful
});
}
}
}
/++
A radial gradient goes from color to color based on distance from the center.
It is like rings of color.
X ONLY RIGHT NOW
More specifically, you create two circles: an inner circle and an outer circle.
The gradient is only drawn in the area outside the inner circle but inside the outer
circle. The closest line between those two circles forms the line for the gradient
and the stops are calculated the same as the [LinearGradient]. Then it just sweeps around.
History:
Added November 20, 2021 (dub v10.4)
Bugs:
Not yet implemented on Windows.
+/
class RadialGradient : Gradient {
/++
+/
this(Point innerCenter, float innerRadius, Point outerCenter, float outerRadius, Stop[] stops...) {
super(cast(int)(outerCenter.x + outerRadius + 0.5), cast(int)(outerCenter.y + outerRadius + 0.5));
version(X11) {
XRadialGradient gradient;
gradient.inner = XCircle(innerCenter.x * ushort.max, innerCenter.y * ushort.max, cast(int) (innerRadius * ushort.max));
gradient.outer = XCircle(outerCenter.x * ushort.max, outerCenter.y * ushort.max, cast(int) (outerRadius * ushort.max));
helper(stops, (scope XFixed[] stopsPositions, scope XRenderColor[] colors) {
return XRenderCreateRadialGradient(
XDisplayConnection.get,
&gradient,
stopsPositions.ptr,
colors.ptr,
cast(int) stops.length);
});
} else version(Windows) {
// FIXME
forEachPixel((int x, int y) {
import core.stdc.math;
//sqrtf(
return Color.transparent;
// return Color(x * 2, y * 2, 0, 128); // this result is so beautiful
});
}
}
}
/+
NOT IMPLEMENTED
A display-stored image optimized for relatively quick drawing, like
[Sprite], but this one supports alpha channel blending and does NOT
support direct drawing upon it with a [ScreenPainter].
You can think of it as an [arsd.game.OpenGlTexture] for usage with a
plain [ScreenPainter]... sort of.
On X11, it requires the Xrender extension and library. This is available
almost everywhere though.
History:
Added November 14, 2020 but NOT ACTUALLY IMPLEMENTED
+/
version(none)
class AlphaSprite {
/++
Copies the given image into it.
+/
this(MemoryImage img) {
if(!XRenderLibrary.loadAttempted) {
XRenderLibrary.loadDynamicLibrary();
// FIXME: this needs to be reconstructed when the X server changes
repopulateX();
}
if(!XRenderLibrary.loadSuccessful)
throw new Exception("XRender library load failure");
// I probably need to put the alpha mask in a separate Picture
// ugh
// maybe the Sprite itself can have an alpha bitmask anyway
auto display = XDisplayConnection.get();
pixmap = XCreatePixmap(display, cast(Drawable) win.window, width, height, DefaultDepthOfDisplay(display));
XRenderPictureAttributes attrs;
handle = XRenderCreatePicture(
XDisplayConnection.get,
pixmap,
RGBA,
0,
&attrs
);
}
// maybe i'll use the create gradient functions too with static factories..
void drawAt(ScreenPainter painter, Point where) {
//painter.drawPixmap(this, where);
XRenderPictureAttributes attrs;
auto pic = XRenderCreatePicture(
XDisplayConnection.get,
painter.impl.d,
RGB,
0,
&attrs
);
XRenderComposite(
XDisplayConnection.get,
3, // PictOpOver
handle,
None,
pic,
0, // src
0,
0, // mask
0,
10, // dest
10,
100, // width
100
);
/+
XRenderFreePicture(
XDisplayConnection.get,
pic
);
XRenderFreePicture(
XDisplayConnection.get,
fill
);
+/
// on Windows you can stretch but Xrender still can't :(
}
static XRenderPictFormat* RGB;
static XRenderPictFormat* RGBA;
static void repopulateX() {
auto display = XDisplayConnection.get;
RGB = XRenderFindStandardFormat(display, PictStandardRGB24);
RGBA = XRenderFindStandardFormat(display, PictStandardARGB32);
}
XPixmap pixmap;
Picture handle;
}
///
interface CapableOfBeingDrawnUpon {
///
ScreenPainter draw();
///
int width();
///
int height();
protected ScreenPainterImplementation* activeScreenPainter();
protected void activeScreenPainter(ScreenPainterImplementation*);
bool closed();
void delegate() paintingFinishedDg();
/// Be warned: this can be a very slow operation
TrueColorImage takeScreenshot();
}
/// Flushes any pending gui buffers. Necessary if you are using with_eventloop with X - flush after you create your windows but before you call [arsd.eventloop.loop].
void flushGui() {
version(X11) {
auto dpy = XDisplayConnection.get();
XLockDisplay(dpy);
scope(exit) XUnlockDisplay(dpy);
XFlush(dpy);
}
}
/++
Runs the given code in the GUI thread when its event loop
is available, blocking until it completes. This allows you
to create and manipulate windows from another thread without
invoking undefined behavior.
If this is the gui thread, it runs the code immediately.
If no gui thread exists yet, the current thread is assumed
to be it. Attempting to create windows or run the event loop
in any other thread will cause an assertion failure.
$(TIP
Did you know you can use UFCS on delegate literals?
() {
// code here
}.runInGuiThread;
)
Returns:
`true` if the function was called, `false` if it was not.
The function may not be called because the gui thread had
already terminated by the time you called this.
History:
Added April 10, 2020 (v7.2.0)
Return value added and implementation tweaked to avoid locking
at program termination on February 24, 2021 (v9.2.1).
+/
bool runInGuiThread(scope void delegate() dg) @trusted {
claimGuiThread();
if(thisIsGuiThread) {
dg();
return true;
}
if(guiThreadTerminating)
return false;
import core.sync.semaphore;
static Semaphore sc;
if(sc is null)
sc = new Semaphore();
static RunQueueMember* rqm;
if(rqm is null)
rqm = new RunQueueMember;
rqm.dg = cast(typeof(rqm.dg)) dg;
rqm.signal = sc;
rqm.thrown = null;
synchronized(runInGuiThreadLock) {
runInGuiThreadQueue ~= rqm;
}
if(!SimpleWindow.eventWakeUp())
throw new Error("runInGuiThread impossible; eventWakeUp failed");
rqm.signal.wait();
auto t = rqm.thrown;
if(t)
throw t;
return true;
}
void runInGuiThreadAsync(void delegate() dg, void delegate(Exception) nothrow handleError = null) nothrow {
claimGuiThread();
try {
if(thisIsGuiThread) {
dg();
return;
}
if(guiThreadTerminating)
return;
RunQueueMember* rqm = new RunQueueMember;
rqm.dg = cast(typeof(rqm.dg)) dg;
rqm.signal = null;
rqm.thrown = null;
synchronized(runInGuiThreadLock) {
runInGuiThreadQueue ~= rqm;
}
if(!SimpleWindow.eventWakeUp())
throw new Error("runInGuiThread impossible; eventWakeUp failed");
} catch(Exception e) {
if(handleError)
handleError(e);
}
}
private void runPendingRunInGuiThreadDelegates() {
more:
RunQueueMember* next;
synchronized(runInGuiThreadLock) {
if(runInGuiThreadQueue.length) {
next = runInGuiThreadQueue[0];
runInGuiThreadQueue = runInGuiThreadQueue[1 .. $];
} else {
next = null;
}
}
if(next) {
try {
next.dg();
next.thrown = null;
} catch(Throwable t) {
next.thrown = t;
}
if(next.signal)
next.signal.notify();
goto more;
}
}
private void claimGuiThread() nothrow {
import core.atomic;
if(cas(&guiThreadExists_, false, true))
thisIsGuiThread = true;
}
private struct RunQueueMember {
void delegate() dg;
import core.sync.semaphore;
Semaphore signal;
Throwable thrown;
}
private __gshared RunQueueMember*[] runInGuiThreadQueue;
private __gshared Object runInGuiThreadLock = new Object; // intentional CTFE
private bool thisIsGuiThread = false;
private shared bool guiThreadExists_ = false;
private shared bool guiThreadTerminating = false;
/++
Returns `true` if a gui thread exists, that is, a thread running the simpledisplay.d
event loop. All windows must be exclusively created and managed by a single thread.
If no gui thread exists, simpledisplay.d will automatically adopt the current thread
when you call one of its constructors.
If a gui thread exists, you should check [thisThreadRunningGui] to see if it is this
one. If so, you can run gui functions on it. If not, don't. The helper functions
[runInGuiThread] and [runInGuiThreadAsync] can be used to help you with this automatically.
The reason this function is available is in case you want to message pass between a gui
thread and your current thread. If no gui thread exists or if this is the gui thread,
you're liable to deadlock when trying to communicate since you'd end up talking to yourself.
History:
Added December 3, 2021 (dub v10.5)
+/
public bool guiThreadExists() {
return guiThreadExists_;
}
/++
Returns `true` if this thread is either running or set to be running the
simpledisplay.d gui core event loop because it owns windows.
It is important to keep gui-related functionality in the right thread, so you will
want to `runInGuiThread` when you call them (with some specific exceptions called
out in those specific functions' documentation). Notably, all windows must be
created and managed only from the gui thread.
Will return false if simpledisplay's other functions haven't been called
yet; check [guiThreadExists] in addition to this.
History:
Added December 3, 2021 (dub v10.5)
+/
public bool thisThreadRunningGui() {
return thisIsGuiThread;
}
/++
Function to help temporarily print debugging info. It will bypass any stdout/err redirection
and go to the controlling tty or console (attaching to the parent and/or allocating one as
needed on Windows. Please note it may overwrite output from other programs in the parent and the
allocated one will not survive if your program crashes. Use the `fileOverride` to print to a log
file instead if you are in one of those situations).
It does not support outputting very many types; just strings and ints are likely to actually work.
It will perform very slowly and swallows any errors that may occur. Moreover, the specific output
is unspecified meaning I can change it at any time. The only point of this function is to help
in temporary use for printf-style debugging. It is NOT nogc, but you can use the `debug` keyword
and the compiler will cheat for you. It is, however, formally nothrow and trusted to ease its use
in those contexts.
$(WARNING
I reserve the right to change this function at any time. You can use it if it helps you
but do not rely on it for anything permanent.
)
History:
Added December 3, 2021. Not formally supported under any stable tag.
+/
void sdpyPrintDebugString(string fileOverride = null, T...)(T t) nothrow @trusted {
try {
version(Windows) {
import core.sys.windows.wincon;
if(AttachConsole(ATTACH_PARENT_PROCESS))
AllocConsole();
const(char)* fn = "CONOUT$";
} else version(Posix) {
const(char)* fn = "/dev/tty";
} else static assert(0, "Function not implemented for your system");
if(fileOverride.length)
fn = fileOverride.ptr;
import core.stdc.stdio;
auto fp = fopen(fn, "wt");
if(fp is null) return;
scope(exit) fclose(fp);
string str;
foreach(item; t) {
static if(is(typeof(item) : const(char)[]))
str ~= item;
else
str ~= toInternal!string(item);
str ~= " ";
}
str ~= "\n";
fwrite(str.ptr, 1, str.length, fp);
} catch(Exception e) {
// sorry no hope
}
}
private void guiThreadFinalize() {
assert(thisIsGuiThread);
guiThreadTerminating = true; // don't add any more from this point on
runPendingRunInGuiThreadDelegates();
}
/+
interface IPromise {
void reportProgress(int current, int max, string message);
/+ // not formally in cuz of templates but still
IPromise Then();
IPromise Catch();
IPromise Finally();
+/
}
/+
auto promise = async({ ... });
promise.Then(whatever).
Then(whateverelse).
Catch((exception) { });
A promise is run inside a fiber and it looks something like:
try {
auto res = whatever();
auto res2 = whateverelse(res);
} catch(Exception e) {
{ }(e);
}
When a thing succeeds, it is passed as an arg to the next
+/
class Promise(T) : IPromise {
auto Then() { return null; }
auto Catch() { return null; }
auto Finally() { return null; }
// wait for it to resolve and return the value, or rethrow the error if that occurred.
// cannot be called from the gui thread, but this is caught at runtime instead of compile time.
T await();
}
interface Task {
}
interface Resolvable(T) : Task {
void run();
void resolve(T);
Resolvable!T then(void delegate(T)); // returns a new promise
Resolvable!T error(Throwable); // js catch
Resolvable!T completed(); // js finally
}
/++
Runs `work` in a helper thread and sends its return value back to the main gui
thread as the argument to `uponCompletion`. If `work` throws, the exception is
sent to the `uponThrown` if given, or if null, rethrown from the event loop to
kill the program.
You can call reportProgress(position, max, message) to update your parent window
on your progress.
I should also use `shared` methods. FIXME
History:
Added March 6, 2021 (dub version 9.3).
+/
void runInWorkerThread(T)(T delegate(Task) work, void delegate(T) uponCompletion) {
uponCompletion(work(null));
}
+/
/// Used internal to dispatch events to various classes.
interface CapableOfHandlingNativeEvent {
NativeEventHandler getNativeEventHandler();
/*private*//*protected*/ __gshared CapableOfHandlingNativeEvent[NativeWindowHandle] nativeHandleMapping;
version(X11) {
// if this is impossible, you are allowed to just throw from it
// Note: if you call it from another object, set a flag cuz the manger will call you again
void recreateAfterDisconnect();
// discard any *connection specific* state, but keep enough that you
// can be recreated if possible. discardConnectionState() is always called immediately
// before recreateAfterDisconnect(), so you can set a flag there to decide if
// you need initialization order
void discardConnectionState();
}
}
version(X11)
/++
State of keys on mouse events, especially motion.
Do not trust the actual integer values in this, they are platform-specific. Always use the names.
+/
enum ModifierState : uint {
shift = 1, ///
capsLock = 2, ///
ctrl = 4, ///
alt = 8, /// Not always available on Windows
windows = 64, /// ditto
numLock = 16, ///
leftButtonDown = 256, /// these aren't available on Windows for key events, so don't use them for that unless your app is X only.
middleButtonDown = 512, /// ditto
rightButtonDown = 1024, /// ditto
}
else version(Windows)
/// ditto
enum ModifierState : uint {
shift = 4, ///
ctrl = 8, ///
// i'm not sure if the next two are available
alt = 256, /// not always available on Windows
windows = 512, /// ditto
capsLock = 1024, ///
numLock = 2048, ///
leftButtonDown = 1, /// not available on key events
middleButtonDown = 16, /// ditto
rightButtonDown = 2, /// ditto
backButtonDown = 0x20, /// not available on X
forwardButtonDown = 0x40, /// ditto
}
else version(OSXCocoa)
// FIXME FIXME NotYetImplementedException
enum ModifierState : uint {
shift = 1, ///
capsLock = 2, ///
ctrl = 4, ///
alt = 8, /// Not always available on Windows
windows = 64, /// ditto
numLock = 16, ///
leftButtonDown = 256, /// these aren't available on Windows for key events, so don't use them for that unless your app is X only.
middleButtonDown = 512, /// ditto
rightButtonDown = 1024, /// ditto
}
/// The names assume a right-handed mouse. These are bitwise combined on the events that use them.
enum MouseButton : int {
none = 0,
left = 1, ///
right = 2, ///
middle = 4, ///
wheelUp = 8, ///
wheelDown = 16, ///
backButton = 32, /// often found on the thumb and used for back in browsers
forwardButton = 64, /// often found on the thumb and used for forward in browsers
}
version(X11) {
// FIXME: match ASCII whenever we can. Most of it is already there,
// but there's a few exceptions and mismatches with Windows
/// Do not trust the numeric values as they are platform-specific. Always use the symbolic name.
enum Key {
Escape = 0xff1b, ///
F1 = 0xffbe, ///
F2 = 0xffbf, ///
F3 = 0xffc0, ///
F4 = 0xffc1, ///
F5 = 0xffc2, ///
F6 = 0xffc3, ///
F7 = 0xffc4, ///
F8 = 0xffc5, ///
F9 = 0xffc6, ///
F10 = 0xffc7, ///
F11 = 0xffc8, ///
F12 = 0xffc9, ///
PrintScreen = 0xff61, ///
ScrollLock = 0xff14, ///
Pause = 0xff13, ///
Grave = 0x60, /// The $(BACKTICK) ~ key
// number keys across the top of the keyboard
N1 = 0x31, /// Number key atop the keyboard
N2 = 0x32, ///
N3 = 0x33, ///
N4 = 0x34, ///
N5 = 0x35, ///
N6 = 0x36, ///
N7 = 0x37, ///
N8 = 0x38, ///
N9 = 0x39, ///
N0 = 0x30, ///
Dash = 0x2d, ///
Equals = 0x3d, ///
Backslash = 0x5c, /// The \ | key
Backspace = 0xff08, ///
Insert = 0xff63, ///
Home = 0xff50, ///
PageUp = 0xff55, ///
Delete = 0xffff, ///
End = 0xff57, ///
PageDown = 0xff56, ///
Up = 0xff52, ///
Down = 0xff54, ///
Left = 0xff51, ///
Right = 0xff53, ///
Tab = 0xff09, ///
Q = 0x71, ///
W = 0x77, ///
E = 0x65, ///
R = 0x72, ///
T = 0x74, ///
Y = 0x79, ///
U = 0x75, ///
I = 0x69, ///
O = 0x6f, ///
P = 0x70, ///
LeftBracket = 0x5b, /// the [ { key
RightBracket = 0x5d, /// the ] } key
CapsLock = 0xffe5, ///
A = 0x61, ///
S = 0x73, ///
D = 0x64, ///
F = 0x66, ///
G = 0x67, ///
H = 0x68, ///
J = 0x6a, ///
K = 0x6b, ///
L = 0x6c, ///
Semicolon = 0x3b, ///
Apostrophe = 0x27, ///
Enter = 0xff0d, ///
Shift = 0xffe1, ///
Z = 0x7a, ///
X = 0x78, ///
C = 0x63, ///
V = 0x76, ///
B = 0x62, ///
N = 0x6e, ///
M = 0x6d, ///
Comma = 0x2c, ///
Period = 0x2e, ///
Slash = 0x2f, /// the / ? key
Shift_r = 0xffe2, /// Note: this isn't sent on all computers, sometimes it just sends Shift, so don't rely on it. If it is supported though, it is the right Shift key, as opposed to the left Shift key
Ctrl = 0xffe3, ///
Windows = 0xffeb, ///
Alt = 0xffe9, ///
Space = 0x20, ///
Alt_r = 0xffea, /// ditto of shift_r
Windows_r = 0xffec, ///
Menu = 0xff67, ///
Ctrl_r = 0xffe4, ///
NumLock = 0xff7f, ///
Divide = 0xffaf, /// The / key on the number pad
Multiply = 0xffaa, /// The * key on the number pad
Minus = 0xffad, /// The - key on the number pad
Plus = 0xffab, /// The + key on the number pad
PadEnter = 0xff8d, /// Numberpad enter key
Pad1 = 0xff9c, /// Numberpad keys
Pad2 = 0xff99, ///
Pad3 = 0xff9b, ///
Pad4 = 0xff96, ///
Pad5 = 0xff9d, ///
Pad6 = 0xff98, ///
Pad7 = 0xff95, ///
Pad8 = 0xff97, ///
Pad9 = 0xff9a, ///
Pad0 = 0xff9e, ///
PadDot = 0xff9f, ///
}
} else version(Windows) {
// the character here is for en-us layouts and for illustration only
// if you actually want to get characters, wait for character events
// (the argument to your event handler is simply a dchar)
// those will be converted by the OS for the right locale.
enum Key {
Escape = 0x1b,
F1 = 0x70,
F2 = 0x71,
F3 = 0x72,
F4 = 0x73,
F5 = 0x74,
F6 = 0x75,
F7 = 0x76,
F8 = 0x77,
F9 = 0x78,
F10 = 0x79,
F11 = 0x7a,
F12 = 0x7b,
PrintScreen = 0x2c,
ScrollLock = 0x91,
Pause = 0x13,
Grave = 0xc0,
// number keys across the top of the keyboard
N1 = 0x31,
N2 = 0x32,
N3 = 0x33,
N4 = 0x34,
N5 = 0x35,
N6 = 0x36,
N7 = 0x37,
N8 = 0x38,
N9 = 0x39,
N0 = 0x30,
Dash = 0xbd,
Equals = 0xbb,
Backslash = 0xdc,
Backspace = 0x08,
Insert = 0x2d,
Home = 0x24,
PageUp = 0x21,
Delete = 0x2e,
End = 0x23,
PageDown = 0x22,
Up = 0x26,
Down = 0x28,
Left = 0x25,
Right = 0x27,
Tab = 0x09,
Q = 0x51,
W = 0x57,
E = 0x45,
R = 0x52,
T = 0x54,
Y = 0x59,
U = 0x55,
I = 0x49,
O = 0x4f,
P = 0x50,
LeftBracket = 0xdb,
RightBracket = 0xdd,
CapsLock = 0x14,
A = 0x41,
S = 0x53,
D = 0x44,
F = 0x46,
G = 0x47,
H = 0x48,
J = 0x4a,
K = 0x4b,
L = 0x4c,
Semicolon = 0xba,
Apostrophe = 0xde,
Enter = 0x0d,
Shift = 0x10,
Z = 0x5a,
X = 0x58,
C = 0x43,
V = 0x56,
B = 0x42,
N = 0x4e,
M = 0x4d,
Comma = 0xbc,
Period = 0xbe,
Slash = 0xbf,
Shift_r = 0xa1, // FIXME Note: this isn't sent on all computers, sometimes it just sends Shift, so don't rely on it
Ctrl = 0x11,
Windows = 0x5b,
Alt = -5, // FIXME
Space = 0x20,
Alt_r = 0xffea, // ditto of shift_r
Windows_r = 0x5c, // ditto of shift_r
Menu = 0x5d,
Ctrl_r = 0xa3, // ditto of shift_r
NumLock = 0x90,
Divide = 0x6f,
Multiply = 0x6a,
Minus = 0x6d,
Plus = 0x6b,
PadEnter = -8, // FIXME
Pad1 = 0x61,
Pad2 = 0x62,
Pad3 = 0x63,
Pad4 = 0x64,
Pad5 = 0x65,
Pad6 = 0x66,
Pad7 = 0x67,
Pad8 = 0x68,
Pad9 = 0x69,
Pad0 = 0x60,
PadDot = 0x6e,
}
// I'm keeping this around for reference purposes
// ideally all these buttons will be listed for all platforms,
// but now now I'm just focusing on my US keyboard
version(none)
enum Key {
LBUTTON = 0x01,
RBUTTON = 0x02,
CANCEL = 0x03,
MBUTTON = 0x04,
//static if (_WIN32_WINNT > = 0x500) {
XBUTTON1 = 0x05,
XBUTTON2 = 0x06,
//}
BACK = 0x08,
TAB = 0x09,
CLEAR = 0x0C,
RETURN = 0x0D,
SHIFT = 0x10,
CONTROL = 0x11,
MENU = 0x12,
PAUSE = 0x13,
CAPITAL = 0x14,
KANA = 0x15,
HANGEUL = 0x15,
HANGUL = 0x15,
JUNJA = 0x17,
FINAL = 0x18,
HANJA = 0x19,
KANJI = 0x19,
ESCAPE = 0x1B,
CONVERT = 0x1C,
NONCONVERT = 0x1D,
ACCEPT = 0x1E,
MODECHANGE = 0x1F,
SPACE = 0x20,
PRIOR = 0x21,
NEXT = 0x22,
END = 0x23,
HOME = 0x24,
LEFT = 0x25,
UP = 0x26,
RIGHT = 0x27,
DOWN = 0x28,
SELECT = 0x29,
PRINT = 0x2A,
EXECUTE = 0x2B,
SNAPSHOT = 0x2C,
INSERT = 0x2D,
DELETE = 0x2E,
HELP = 0x2F,
LWIN = 0x5B,
RWIN = 0x5C,
APPS = 0x5D,
SLEEP = 0x5F,
NUMPAD0 = 0x60,
NUMPAD1 = 0x61,
NUMPAD2 = 0x62,
NUMPAD3 = 0x63,
NUMPAD4 = 0x64,
NUMPAD5 = 0x65,
NUMPAD6 = 0x66,
NUMPAD7 = 0x67,
NUMPAD8 = 0x68,
NUMPAD9 = 0x69,
MULTIPLY = 0x6A,
ADD = 0x6B,
SEPARATOR = 0x6C,
SUBTRACT = 0x6D,
DECIMAL = 0x6E,
DIVIDE = 0x6F,
F1 = 0x70,
F2 = 0x71,
F3 = 0x72,
F4 = 0x73,
F5 = 0x74,
F6 = 0x75,
F7 = 0x76,
F8 = 0x77,
F9 = 0x78,
F10 = 0x79,
F11 = 0x7A,
F12 = 0x7B,
F13 = 0x7C,
F14 = 0x7D,
F15 = 0x7E,
F16 = 0x7F,
F17 = 0x80,
F18 = 0x81,
F19 = 0x82,
F20 = 0x83,
F21 = 0x84,
F22 = 0x85,
F23 = 0x86,
F24 = 0x87,
NUMLOCK = 0x90,
SCROLL = 0x91,
LSHIFT = 0xA0,
RSHIFT = 0xA1,
LCONTROL = 0xA2,
RCONTROL = 0xA3,
LMENU = 0xA4,
RMENU = 0xA5,
//static if (_WIN32_WINNT > = 0x500) {
BROWSER_BACK = 0xA6,
BROWSER_FORWARD = 0xA7,
BROWSER_REFRESH = 0xA8,
BROWSER_STOP = 0xA9,
BROWSER_SEARCH = 0xAA,
BROWSER_FAVORITES = 0xAB,
BROWSER_HOME = 0xAC,
VOLUME_MUTE = 0xAD,
VOLUME_DOWN = 0xAE,
VOLUME_UP = 0xAF,
MEDIA_NEXT_TRACK = 0xB0,
MEDIA_PREV_TRACK = 0xB1,
MEDIA_STOP = 0xB2,
MEDIA_PLAY_PAUSE = 0xB3,
LAUNCH_MAIL = 0xB4,
LAUNCH_MEDIA_SELECT = 0xB5,
LAUNCH_APP1 = 0xB6,
LAUNCH_APP2 = 0xB7,
//}
OEM_1 = 0xBA,
//static if (_WIN32_WINNT > = 0x500) {
OEM_PLUS = 0xBB,
OEM_COMMA = 0xBC,
OEM_MINUS = 0xBD,
OEM_PERIOD = 0xBE,
//}
OEM_2 = 0xBF,
OEM_3 = 0xC0,
OEM_4 = 0xDB,
OEM_5 = 0xDC,
OEM_6 = 0xDD,
OEM_7 = 0xDE,
OEM_8 = 0xDF,
//static if (_WIN32_WINNT > = 0x500) {
OEM_102 = 0xE2,
//}
PROCESSKEY = 0xE5,
//static if (_WIN32_WINNT > = 0x500) {
PACKET = 0xE7,
//}
ATTN = 0xF6,
CRSEL = 0xF7,
EXSEL = 0xF8,
EREOF = 0xF9,
PLAY = 0xFA,
ZOOM = 0xFB,
NONAME = 0xFC,
PA1 = 0xFD,
OEM_CLEAR = 0xFE,
}
} else version(OSXCocoa) {
// FIXME
enum Key {
Escape = 0x1b,
F1 = 0x70,
F2 = 0x71,
F3 = 0x72,
F4 = 0x73,
F5 = 0x74,
F6 = 0x75,
F7 = 0x76,
F8 = 0x77,
F9 = 0x78,
F10 = 0x79,
F11 = 0x7a,
F12 = 0x7b,
PrintScreen = 0x2c,
ScrollLock = -2, // FIXME
Pause = -3, // FIXME
Grave = 0xc0,
// number keys across the top of the keyboard
N1 = 0x31,
N2 = 0x32,
N3 = 0x33,
N4 = 0x34,
N5 = 0x35,
N6 = 0x36,
N7 = 0x37,
N8 = 0x38,
N9 = 0x39,
N0 = 0x30,
Dash = 0xbd,
Equals = 0xbb,
Backslash = 0xdc,
Backspace = 0x08,
Insert = 0x2d,
Home = 0x24,
PageUp = 0x21,
Delete = 0x2e,
End = 0x23,
PageDown = 0x22,
Up = 0x26,
Down = 0x28,
Left = 0x25,
Right = 0x27,
Tab = 0x09,
Q = 0x51,
W = 0x57,
E = 0x45,
R = 0x52,
T = 0x54,
Y = 0x59,
U = 0x55,
I = 0x49,
O = 0x4f,
P = 0x50,
LeftBracket = 0xdb,
RightBracket = 0xdd,
CapsLock = 0x14,
A = 0x41,
S = 0x53,
D = 0x44,
F = 0x46,
G = 0x47,
H = 0x48,
J = 0x4a,
K = 0x4b,
L = 0x4c,
Semicolon = 0xba,
Apostrophe = 0xde,
Enter = 0x0d,
Shift = 0x10,
Z = 0x5a,
X = 0x58,
C = 0x43,
V = 0x56,
B = 0x42,
N = 0x4e,
M = 0x4d,
Comma = 0xbc,
Period = 0xbe,
Slash = 0xbf,
Shift_r = -4, // FIXME Note: this isn't sent on all computers, sometimes it just sends Shift, so don't rely on it
Ctrl = 0x11,
Windows = 0x5b,
Alt = -5, // FIXME
Space = 0x20,
Alt_r = 0xffea, // ditto of shift_r
Windows_r = -6, // FIXME
Menu = 0x5d,
Ctrl_r = -7, // FIXME
NumLock = 0x90,
Divide = 0x6f,
Multiply = 0x6a,
Minus = 0x6d,
Plus = 0x6b,
PadEnter = -8, // FIXME
// FIXME for the rest of these:
Pad1 = 0xff9c,
Pad2 = 0xff99,
Pad3 = 0xff9b,
Pad4 = 0xff96,
Pad5 = 0xff9d,
Pad6 = 0xff98,
Pad7 = 0xff95,
Pad8 = 0xff97,
Pad9 = 0xff9a,
Pad0 = 0xff9e,
PadDot = 0xff9f,
}
}
/* Additional utilities */
Color fromHsl(real h, real s, real l) {
return arsd.color.fromHsl([h,s,l]);
}
/* ********** What follows is the system-specific implementations *********/
version(Windows) {
// helpers for making HICONs from MemoryImages
class WindowsIcon {
struct Win32Icon(int colorCount) {
align(1):
uint biSize;
int biWidth;
int biHeight;
ushort biPlanes;
ushort biBitCount;
uint biCompression;
uint biSizeImage;
int biXPelsPerMeter;
int biYPelsPerMeter;
uint biClrUsed;
uint biClrImportant;
RGBQUAD[colorCount] biColors;
/* Pixels:
Uint8 pixels[]
*/
/* Mask:
Uint8 mask[]
*/
ubyte[4096] data;
void fromMemoryImage(MemoryImage mi, out int icon_len, out int width, out int height) {
width = mi.width;
height = mi.height;
auto indexedImage = cast(IndexedImage) mi;
if(indexedImage is null)
indexedImage = quantize(mi.getAsTrueColorImage());
assert(width %8 == 0); // i don't want padding nor do i want the and mask to get fancy
assert(height %4 == 0);
int icon_plen = height*((width+3)&~3);
int icon_mlen = height*((((width+7)/8)+3)&~3);
icon_len = 40+icon_plen+icon_mlen + cast(int) RGBQUAD.sizeof * colorCount;
biSize = 40;
biWidth = width;
biHeight = height*2;
biPlanes = 1;
biBitCount = 8;
biSizeImage = icon_plen+icon_mlen;
int offset = 0;
int andOff = icon_plen * 8; // the and offset is in bits
for(int y = height - 1; y >= 0; y--) {
int off2 = y * width;
foreach(x; 0 .. width) {
const b = indexedImage.data[off2 + x];
data[offset] = b;
offset++;
const andBit = andOff % 8;
const andIdx = andOff / 8;
assert(b < indexedImage.palette.length);
// this is anded to the destination, since and 0 means erase,
// we want that to be opaque, and 1 for transparent
auto transparent = (indexedImage.palette[b].a <= 127);
data[andIdx] |= (transparent ? (1 << (7-andBit)) : 0);
andOff++;
}
andOff += andOff % 32;
}
foreach(idx, entry; indexedImage.palette) {
if(entry.a > 127) {
biColors[idx].rgbBlue = entry.b;
biColors[idx].rgbGreen = entry.g;
biColors[idx].rgbRed = entry.r;
} else {
biColors[idx].rgbBlue = 255;
biColors[idx].rgbGreen = 255;
biColors[idx].rgbRed = 255;
}
}
/*
data[0..icon_plen] = getFlippedUnfilteredDatastream(png);
data[icon_plen..icon_plen+icon_mlen] = getANDMask(png);
//icon_win32.biColors[1] = Win32Icon.RGBQUAD(0,255,0,0);
auto pngMap = fetchPaletteWin32(png);
biColors[0..pngMap.length] = pngMap[];
*/
}
}
Win32Icon!(256) icon_win32;
this(MemoryImage mi) {
int icon_len, width, height;
icon_win32.fromMemoryImage(mi, icon_len, width, height);
/*
PNG* png = readPnpngData);
PNGHeader pngh = getHeader(png);
void* icon_win32;
if(pngh.depth == 4) {
auto i = new Win32Icon!(16);
i.fromPNG(png, pngh, icon_len, width, height);
icon_win32 = i;
}
else if(pngh.depth == 8) {
auto i = new Win32Icon!(256);
i.fromPNG(png, pngh, icon_len, width, height);
icon_win32 = i;
} else assert(0);
*/
hIcon = CreateIconFromResourceEx(cast(ubyte*) &icon_win32, icon_len, true, 0x00030000, width, height, 0);
if(hIcon is null) throw new Exception("CreateIconFromResourceEx");
}
~this() {
DestroyIcon(hIcon);
}
HICON hIcon;
}
alias int delegate(HWND, UINT, WPARAM, LPARAM, out int) NativeEventHandler;
alias HWND NativeWindowHandle;
extern(Windows)
LRESULT WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) nothrow {
try {
if(SimpleWindow.handleNativeGlobalEvent !is null) {
// it returns zero if the message is handled, so we won't do anything more there
// do I like that though?
int mustReturn;
auto ret = SimpleWindow.handleNativeGlobalEvent(hWnd, iMessage, wParam, lParam, mustReturn);
if(mustReturn)
return ret;
}
if(auto window = hWnd in CapableOfHandlingNativeEvent.nativeHandleMapping) {
if(window.getNativeEventHandler !is null) {
int mustReturn;
auto ret = window.getNativeEventHandler()(hWnd, iMessage, wParam, lParam, mustReturn);
if(mustReturn)
return ret;
}
if(auto w = cast(SimpleWindow) (*window))
return w.windowProcedure(hWnd, iMessage, wParam, lParam);
else
return DefWindowProc(hWnd, iMessage, wParam, lParam);
} else {
return DefWindowProc(hWnd, iMessage, wParam, lParam);
}
} catch (Exception e) {
try {
sdpy_abort(e);
return 0;
} catch(Exception e) { assert(0); }
}
}
void sdpy_abort(Throwable e) nothrow {
try
MessageBoxA(null, (e.toString() ~ "\0").ptr, "Exception caught in WndProc", 0);
catch(Exception e)
MessageBoxA(null, "Exception.toString threw too!", "Exception caught in WndProc", 0);
ExitProcess(1);
}
mixin template NativeScreenPainterImplementation() {
HDC hdc;
HWND hwnd;
//HDC windowHdc;
HBITMAP oldBmp;
void create(NativeWindowHandle window) {
hwnd = window;
if(auto sw = cast(SimpleWindow) this.window) {
// drawing on a window, double buffer
auto windowHdc = GetDC(hwnd);
auto buffer = sw.impl.buffer;
if(buffer is null) {
hdc = windowHdc;
windowDc = true;
} else {
hdc = CreateCompatibleDC(windowHdc);
ReleaseDC(hwnd, windowHdc);
oldBmp = SelectObject(hdc, buffer);
}
} else {
// drawing on something else, draw directly
hdc = CreateCompatibleDC(null);
SelectObject(hdc, window);
}
// X doesn't draw a text background, so neither should we
SetBkMode(hdc, TRANSPARENT);
ensureDefaultFontLoaded();
if(defaultGuiFont) {
SelectObject(hdc, defaultGuiFont);
// DeleteObject(defaultGuiFont);
}
}
static HFONT defaultGuiFont;
static void ensureDefaultFontLoaded() {
static bool triedDefaultGuiFont = false;
if(!triedDefaultGuiFont) {
NONCLIENTMETRICS params;
params.cbSize = params.sizeof;
if(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, params.sizeof, ¶ms, 0)) {
defaultGuiFont = CreateFontIndirect(¶ms.lfMessageFont);
}
triedDefaultGuiFont = true;
}
}
void setFont(OperatingSystemFont font) {
if(font && font.font) {
if(SelectObject(hdc, font.font) == HGDI_ERROR) {
// error... how to handle tho?
}
}
else if(defaultGuiFont)
SelectObject(hdc, defaultGuiFont);
}
arsd.color.Rectangle _clipRectangle;
void setClipRectangle(int x, int y, int width, int height) {
_clipRectangle = arsd.color.Rectangle(Point(x, y), Size(width, height));
if(width == 0 || height == 0) {
SelectClipRgn(hdc, null);
} else {
auto region = CreateRectRgn(x, y, x + width, y + height);
SelectClipRgn(hdc, region);
DeleteObject(region);
}
}
// just because we can on Windows...
//void create(Image image);
void invalidateRect(Rectangle invalidRect) {
RECT rect;
rect.left = invalidRect.left;
rect.right = invalidRect.right;
rect.top = invalidRect.top;
rect.bottom = invalidRect.bottom;
InvalidateRect(hwnd, &rect, false);
}
bool manualInvalidations;
void dispose() {
// FIXME: this.window.width/height is probably wrong
// BitBlt(windowHdc, 0, 0, this.window.width, this.window.height, hdc, 0, 0, SRCCOPY);
// ReleaseDC(hwnd, windowHdc);
// FIXME: it shouldn't invalidate the whole thing in all cases... it would be ideal to do this right
if(cast(SimpleWindow) this.window) {
if(!manualInvalidations)
InvalidateRect(hwnd, cast(RECT*)null, false); // no need to erase bg as the whole thing gets bitblt'd ove
}
if(originalPen !is null)
SelectObject(hdc, originalPen);
if(currentPen !is null)
DeleteObject(currentPen);
if(originalBrush !is null)
SelectObject(hdc, originalBrush);
if(currentBrush !is null)
DeleteObject(currentBrush);
SelectObject(hdc, oldBmp);
if(windowDc)
ReleaseDC(hwnd, hdc);
else
DeleteDC(hdc);
if(window.paintingFinishedDg !is null)
window.paintingFinishedDg()();
}
bool windowDc;
HPEN originalPen;
HPEN currentPen;
Pen _activePen;
@property void pen(Pen p) {
_activePen = p;
HPEN pen;
if(p.color.a == 0) {
pen = GetStockObject(NULL_PEN);
} else {
int style = PS_SOLID;
final switch(p.style) {
case Pen.Style.Solid:
style = PS_SOLID;
break;
case Pen.Style.Dashed:
style = PS_DASH;
break;
case Pen.Style.Dotted:
style = PS_DOT;
break;
}
pen = CreatePen(style, p.width, RGB(p.color.r, p.color.g, p.color.b));
}
auto orig = SelectObject(hdc, pen);
if(originalPen is null)
originalPen = orig;
if(currentPen !is null)
DeleteObject(currentPen);
currentPen = pen;
// the outline is like a foreground since it's done that way on X
SetTextColor(hdc, RGB(p.color.r, p.color.g, p.color.b));
}
@property void rasterOp(RasterOp op) {
int mode;
final switch(op) {
case RasterOp.normal:
mode = R2_COPYPEN;
break;
case RasterOp.xor:
mode = R2_XORPEN;
break;
}
SetROP2(hdc, mode);
}
HBRUSH originalBrush;
HBRUSH currentBrush;
Color _fillColor = Color(1, 1, 1, 1); // what are the odds that they'd set this??
@property void fillColor(Color c) {
if(c == _fillColor)
return;
_fillColor = c;
HBRUSH brush;
if(c.a == 0) {
brush = GetStockObject(HOLLOW_BRUSH);
} else {
brush = CreateSolidBrush(RGB(c.r, c.g, c.b));
}
auto orig = SelectObject(hdc, brush);
if(originalBrush is null)
originalBrush = orig;
if(currentBrush !is null)
DeleteObject(currentBrush);
currentBrush = brush;
// background color is NOT set because X doesn't draw text backgrounds
// SetBkColor(hdc, RGB(255, 255, 255));
}
void drawImage(int x, int y, Image i, int ix, int iy, int w, int h) {
BITMAP bm;
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = SelectObject(hdcMem, i.handle);
GetObject(i.handle, bm.sizeof, &bm);
// or should I AlphaBlend!??!?!
BitBlt(hdc, x, y, w /* bm.bmWidth */, /*bm.bmHeight*/ h, hdcMem, ix, iy, SRCCOPY);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
}
void drawPixmap(Sprite s, int x, int y, int ix, int iy, int w, int h) {
BITMAP bm;
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = SelectObject(hdcMem, s.handle);
GetObject(s.handle, bm.sizeof, &bm);
version(CRuntime_DigitalMars) goto noalpha;
// or should I AlphaBlend!??!?! note it is supposed to be premultiplied http://www.fengyuan.com/article/alphablend.html
if(s.enableAlpha) {
auto dw = w ? w : bm.bmWidth;
auto dh = h ? h : bm.bmHeight;
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.SourceConstantAlpha = 255;
bf.AlphaFormat = AC_SRC_ALPHA;
AlphaBlend(hdc, x, y, dw, dh, hdcMem, ix, iy, dw, dh, bf);
} else {
noalpha:
BitBlt(hdc, x, y, w ? w : bm.bmWidth, h ? h : bm.bmHeight, hdcMem, ix, iy, SRCCOPY);
}
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
}
Size textSize(scope const(char)[] text) {
bool dummyX;
if(text.length == 0) {
text = " ";
dummyX = true;
}
RECT rect;
WCharzBuffer buffer = WCharzBuffer(text);
DrawTextW(hdc, buffer.ptr, cast(int) buffer.length, &rect, DT_CALCRECT | DT_NOPREFIX);
return Size(dummyX ? 0 : rect.right, rect.bottom);
}
void drawText(int x, int y, int x2, int y2, scope const(char)[] text, uint alignment) {
if(text.length && text[$-1] == '\n')
text = text[0 .. $-1]; // tailing newlines are weird on windows...
if(text.length && text[$-1] == '\r')
text = text[0 .. $-1];
WCharzBuffer buffer = WCharzBuffer(text, WindowsStringConversionFlags.convertNewLines);
if(x2 == 0 && y2 == 0) {
TextOutW(hdc, x, y, buffer.ptr, cast(int) buffer.length);
} else {
RECT rect;
rect.left = x;
rect.top = y;
rect.right = x2;
rect.bottom = y2;
uint mode = DT_LEFT;
if(alignment & TextAlignment.Right)
mode = DT_RIGHT;
else if(alignment & TextAlignment.Center)
mode = DT_CENTER;
// FIXME: vcenter on windows only works with single line, but I want it to work in all cases
if(alignment & TextAlignment.VerticalCenter)
mode |= DT_VCENTER | DT_SINGLELINE;
DrawTextW(hdc, buffer.ptr, cast(int) buffer.length, &rect, mode | DT_NOPREFIX);
}
/*
uint mode;
if(alignment & TextAlignment.Center)
mode = TA_CENTER;
SetTextAlign(hdc, mode);
*/
}
int fontHeight() {
TEXTMETRIC metric;
if(GetTextMetricsW(hdc, &metric)) {
return metric.tmHeight;
}
return 16; // idk just guessing here, maybe we should throw
}
void drawPixel(int x, int y) {
SetPixel(hdc, x, y, RGB(_activePen.color.r, _activePen.color.g, _activePen.color.b));
}
// The basic shapes, outlined
void drawLine(int x1, int y1, int x2, int y2) {
MoveToEx(hdc, x1, y1, null);
LineTo(hdc, x2, y2);
}
void drawRectangle(int x, int y, int width, int height) {
// FIXME: with a wider pen this might not draw quite right. im not sure.
gdi.Rectangle(hdc, x, y, x + width, y + height);
}
/// Arguments are the points of the bounding rectangle
void drawEllipse(int x1, int y1, int x2, int y2) {
Ellipse(hdc, x1, y1, x2, y2);
}
void drawArc(int x1, int y1, int width, int height, int start, int finish) {
if((start % (360*64)) == (finish % (360*64)))
drawEllipse(x1, y1, x1 + width, y1 + height);
else {
import core.stdc.math;
float startAngle = cast(float) start / 64.0 / 180.0 * 3.14159265358979323;
float endAngle = cast(float) finish / 64.0 / 180.0 * 3.14159265358979323;
auto c1 = cast(int) roundf(cos(startAngle) * width / 2 + x1 + width / 2);
auto c2 = cast(int) roundf(-sin(startAngle) * height / 2 + y1 + height / 2);
auto c3 = cast(int) roundf(cos(endAngle) * width / 2 + x1 + width / 2);
auto c4 = cast(int) roundf(-sin(endAngle) * height / 2 + y1 + height / 2);
if(_activePen.color.a)
Arc(hdc, x1, y1, x1 + width + 1, y1 + height + 1, c1, c2, c3, c4);
if(_fillColor.a)
Pie(hdc, x1, y1, x1 + width + 1, y1 + height + 1, c1, c2, c3, c4);
}
}
void drawPolygon(Point[] vertexes) {
POINT[] points;
points.length = vertexes.length;
foreach(i, p; vertexes) {
points[i].x = p.x;
points[i].y = p.y;
}
Polygon(hdc, points.ptr, cast(int) points.length);
}
}
// Mix this into the SimpleWindow class
mixin template NativeSimpleWindowImplementation() {
int curHidden = 0; // counter
__gshared static bool[string] knownWinClasses;
static bool altPressed = false;
HANDLE oldCursor;
void hideCursor () {
if(curHidden == 0)
oldCursor = SetCursor(null);
++curHidden;
}
void showCursor () {
--curHidden;
if(curHidden == 0) {
SetCursor(currentCursor is null ? oldCursor : currentCursor); // show it immediately without waiting for mouse movement
}
}
int minWidth = 0, minHeight = 0, maxWidth = int.max, maxHeight = int.max;
void setMinSize (int minwidth, int minheight) {
minWidth = minwidth;
minHeight = minheight;
}
void setMaxSize (int maxwidth, int maxheight) {
maxWidth = maxwidth;
maxHeight = maxheight;
}
// FIXME i'm not sure that Windows has this functionality
// though it is nonessential anyway.
void setResizeGranularity (int granx, int grany) {}
ScreenPainter getPainter(bool manualInvalidations) {
return ScreenPainter(this, hwnd, manualInvalidations);
}
HBITMAP buffer;
void setTitle(string title) {
WCharzBuffer bfr = WCharzBuffer(title);
SetWindowTextW(hwnd, bfr.ptr);
}
string getTitle() {
auto len = GetWindowTextLengthW(hwnd);
if (!len)
return null;
wchar[256] tmpBuffer;
wchar[] buffer = (len <= tmpBuffer.length) ? tmpBuffer[] : new wchar[len];
auto len2 = GetWindowTextW(hwnd, buffer.ptr, cast(int) buffer.length);
auto str = buffer[0 .. len2];
return makeUtf8StringFromWindowsString(str);
}
void move(int x, int y) {
RECT rect;
GetWindowRect(hwnd, &rect);
// move it while maintaining the same size...
MoveWindow(hwnd, x, y, rect.right - rect.left, rect.bottom - rect.top, true);
}
void resize(int w, int h) {
RECT rect;
GetWindowRect(hwnd, &rect);
RECT client;
GetClientRect(hwnd, &client);
rect.right = rect.right - client.right + w;
rect.bottom = rect.bottom - client.bottom + h;
// same position, new size for the client rectangle
MoveWindow(hwnd, rect.left, rect.top, rect.right, rect.bottom, true);
version(without_opengl) {} else if (openglMode == OpenGlOptions.yes) glViewport(0, 0, w, h);
}
void moveResize (int x, int y, int w, int h) {
// what's given is the client rectangle, we need to adjust
RECT rect;
rect.left = x;
rect.top = y;
rect.right = w + x;
rect.bottom = h + y;
if(!AdjustWindowRect(&rect, GetWindowLong(hwnd, GWL_STYLE), GetMenu(hwnd) !is null))
throw new Exception("AdjustWindowRect");
MoveWindow(hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, true);
version(without_opengl) {} else if (openglMode == OpenGlOptions.yes) glViewport(0, 0, w, h);
if (windowResized !is null) windowResized(w, h);
}
version(without_opengl) {} else {
HGLRC ghRC;
HDC ghDC;
}
void createWindow(int width, int height, string title, OpenGlOptions opengl, SimpleWindow parent) {
string cnamec;
if (sdpyWindowClassStr is null) loadBinNameToWindowClassName();
if (sdpyWindowClassStr is null || sdpyWindowClassStr[0] == 0) {
cnamec = "DSimpleWindow";
} else {
cnamec = sdpyWindowClass;
}
WCharzBuffer cn = WCharzBuffer(cnamec);
HINSTANCE hInstance = cast(HINSTANCE) GetModuleHandle(null);
if(cnamec !in knownWinClasses) {
WNDCLASSEX wc;
// FIXME: I might be able to use cbWndExtra to hold the pointer back
// to the object. Maybe.
wc.cbSize = wc.sizeof;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = cast(HBRUSH) (COLOR_WINDOW+1); // GetStockObject(WHITE_BRUSH);
wc.hCursor = LoadCursorW(null, IDC_ARROW);
wc.hIcon = LoadIcon(hInstance, null);
wc.hInstance = hInstance;
wc.lpfnWndProc = &WndProc;
wc.lpszClassName = cn.ptr;
wc.hIconSm = null;
wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
if(!RegisterClassExW(&wc))
throw new WindowsApiException("RegisterClassExW");
knownWinClasses[cnamec] = true;
}
int style;
uint flags = WS_EX_ACCEPTFILES; // accept drag-drop files
// FIXME: windowType and customizationFlags
final switch(windowType) {
case WindowTypes.normal:
style = WS_OVERLAPPEDWINDOW;
break;
case WindowTypes.undecorated:
style = WS_POPUP | WS_SYSMENU;
break;
case WindowTypes.eventOnly:
_hidden = true;
break;
case WindowTypes.dropdownMenu:
case WindowTypes.popupMenu:
case WindowTypes.notification:
style = WS_POPUP;
flags |= WS_EX_NOACTIVATE;
break;
case WindowTypes.nestedChild:
style = WS_CHILD;
break;
}
if ((customizationFlags & WindowFlags.extraComposite) != 0)
flags |= WS_EX_LAYERED; // composite window for better performance and effects support
hwnd = CreateWindowEx(flags, cn.ptr, toWStringz(title), style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, // the clip children helps avoid flickering in minigui and doesn't seem to harm other use (mostly, sdpy is no child windows anyway) sooo i think it is ok
CW_USEDEFAULT, CW_USEDEFAULT, width, height,
parent is null ? null : parent.impl.hwnd, null, hInstance, null);
if ((customizationFlags & WindowFlags.extraComposite) != 0)
setOpacity(255);
SimpleWindow.nativeMapping[hwnd] = this;
CapableOfHandlingNativeEvent.nativeHandleMapping[hwnd] = this;
if(windowType == WindowTypes.eventOnly)
return;
HDC hdc = GetDC(hwnd);
version(without_opengl) {}
else {
if(opengl == OpenGlOptions.yes) {
if(!openGlLibrariesSuccessfullyLoaded) throw new Exception("OpenGL libraries did not load");
static if (SdpyIsUsingIVGLBinds) {if (glbindGetProcAddress("glHint") is null) assert(0, "GL: error loading OpenGL"); } // loads all necessary functions
static if (SdpyIsUsingIVGLBinds) import iv.glbinds; // override druntime windows imports
ghDC = hdc;
PIXELFORMATDESCRIPTOR pfd;
pfd.nSize = PIXELFORMATDESCRIPTOR.sizeof;
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.dwLayerMask = PFD_MAIN_PLANE;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 24;
pfd.cAccumBits = 0;
pfd.cStencilBits = 8; // any reasonable OpenGL implementation should support this anyway
auto pixelformat = ChoosePixelFormat(hdc, &pfd);
if (pixelformat == 0)
throw new WindowsApiException("ChoosePixelFormat");
if (SetPixelFormat(hdc, pixelformat, &pfd) == 0)
throw new WindowsApiException("SetPixelFormat");
if (sdpyOpenGLContextVersion && wglCreateContextAttribsARB is null) {
// windoze is idiotic: we have to have OpenGL context to get function addresses
// so we will create fake context to get that stupid address
auto tmpcc = wglCreateContext(ghDC);
if (tmpcc !is null) {
scope(exit) { wglMakeCurrent(ghDC, null); wglDeleteContext(tmpcc); }
wglMakeCurrent(ghDC, tmpcc);
wglInitOtherFunctions();
}
}
if (wglCreateContextAttribsARB !is null && sdpyOpenGLContextVersion) {
int[9] contextAttribs = [
WGL_CONTEXT_MAJOR_VERSION_ARB, (sdpyOpenGLContextVersion>>8),
WGL_CONTEXT_MINOR_VERSION_ARB, (sdpyOpenGLContextVersion&0xff),
WGL_CONTEXT_PROFILE_MASK_ARB, (sdpyOpenGLContextCompatible ? WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB : WGL_CONTEXT_CORE_PROFILE_BIT_ARB),
// for modern context, set "forward compatibility" flag too
(sdpyOpenGLContextCompatible ? 0/*None*/ : WGL_CONTEXT_FLAGS_ARB), WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
0/*None*/,
];
ghRC = wglCreateContextAttribsARB(ghDC, null, contextAttribs.ptr);
if (ghRC is null && sdpyOpenGLContextAllowFallback) {
// activate fallback mode
// sdpyOpenGLContextVeto-type focus management policy leads to race conditions because the window becoming unviewable may coincide with the window manager deciding to move the focus elsrsion = 0;
ghRC = wglCreateContext(ghDC);
}
if (ghRC is null)
throw new WindowsApiException("wglCreateContextAttribsARB");
} else {
// try to do at least something
if (sdpyOpenGLContextAllowFallback || sdpyOpenGLContextVersion == 0) {
sdpyOpenGLContextVersion = 0;
ghRC = wglCreateContext(ghDC);
}
if (ghRC is null)
throw new WindowsApiException("wglCreateContext");
}
}
}
if(opengl == OpenGlOptions.no) {
buffer = CreateCompatibleBitmap(hdc, width, height);
auto hdcBmp = CreateCompatibleDC(hdc);
// make sure it's filled with a blank slate
auto oldBmp = SelectObject(hdcBmp, buffer);
auto oldBrush = SelectObject(hdcBmp, GetStockObject(WHITE_BRUSH));
auto oldPen = SelectObject(hdcBmp, GetStockObject(WHITE_PEN));
gdi.Rectangle(hdcBmp, 0, 0, width, height);
SelectObject(hdcBmp, oldBmp);
SelectObject(hdcBmp, oldBrush);
SelectObject(hdcBmp, oldPen);
DeleteDC(hdcBmp);
bmpWidth = width;
bmpHeight = height;
ReleaseDC(hwnd, hdc); // we keep this in opengl mode since it is a class member now
}
// We want the window's client area to match the image size
RECT rcClient, rcWindow;
POINT ptDiff;
GetClientRect(hwnd, &rcClient);
GetWindowRect(hwnd, &rcWindow);
ptDiff.x = (rcWindow.right - rcWindow.left) - rcClient.right;
ptDiff.y = (rcWindow.bottom - rcWindow.top) - rcClient.bottom;
MoveWindow(hwnd,rcWindow.left, rcWindow.top, width + ptDiff.x, height + ptDiff.y, true);
if ((customizationFlags&WindowFlags.dontAutoShow) == 0) {
ShowWindow(hwnd, SW_SHOWNORMAL);
} else {
_hidden = true;
}
this._visibleForTheFirstTimeCalled = false; // hack!
}
void dispose() {
if(buffer)
DeleteObject(buffer);
}
void closeWindow() {
DestroyWindow(hwnd);
}
bool setOpacity(ubyte alpha) {
return SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA) == TRUE;
}
HANDLE currentCursor;
// returns zero if it recognized the event
static int triggerEvents(HWND hwnd, uint msg, WPARAM wParam, LPARAM lParam, int offsetX, int offsetY, SimpleWindow wind) {
MouseEvent mouse;
void mouseEvent(bool isScreen, ulong mods) {
auto x = LOWORD(lParam);
auto y = HIWORD(lParam);
if(isScreen) {
POINT p;
p.x = x;
p.y = y;
ScreenToClient(hwnd, &p);
x = cast(ushort) p.x;
y = cast(ushort) p.y;
}
mouse.x = x + offsetX;
mouse.y = y + offsetY;
wind.mdx(mouse);
mouse.modifierState = cast(int) mods;
mouse.window = wind;
if(wind.handleMouseEvent)
wind.handleMouseEvent(mouse);
}
switch(msg) {
case WM_GETMINMAXINFO:
MINMAXINFO* mmi = cast(MINMAXINFO*) lParam;
if(wind.minWidth > 0) {
RECT rect;
rect.left = 100;
rect.top = 100;
rect.right = wind.minWidth + 100;
rect.bottom = wind.minHeight + 100;
if(!AdjustWindowRect(&rect, GetWindowLong(wind.hwnd, GWL_STYLE), GetMenu(wind.hwnd) !is null))
throw new WindowsApiException("AdjustWindowRect");
mmi.ptMinTrackSize.x = rect.right - rect.left;
mmi.ptMinTrackSize.y = rect.bottom - rect.top;
}
if(wind.maxWidth < int.max) {
RECT rect;
rect.left = 100;
rect.top = 100;
rect.right = wind.maxWidth + 100;
rect.bottom = wind.maxHeight + 100;
if(!AdjustWindowRect(&rect, GetWindowLong(wind.hwnd, GWL_STYLE), GetMenu(wind.hwnd) !is null))
throw new WindowsApiException("AdjustWindowRect");
mmi.ptMaxTrackSize.x = rect.right - rect.left;
mmi.ptMaxTrackSize.y = rect.bottom - rect.top;
}
break;
case WM_CHAR:
wchar c = cast(wchar) wParam;
if(wind.handleCharEvent)
wind.handleCharEvent(cast(dchar) c);
break;
case WM_SETFOCUS:
case WM_KILLFOCUS:
wind._focused = (msg == WM_SETFOCUS);
if (msg == WM_SETFOCUS) altPressed = false; //k8: reset alt state on defocus (it is better than nothing...)
if(wind.onFocusChange)
wind.onFocusChange(msg == WM_SETFOCUS);
break;
case WM_SYSKEYDOWN:
goto case;
case WM_SYSKEYUP:
if(lParam & (1 << 29)) {
goto case;
} else {
// no window has keyboard focus
goto default;
}
case WM_KEYDOWN:
case WM_KEYUP:
KeyEvent ev;
ev.key = cast(Key) wParam;
ev.pressed = (msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN);
if (wParam == 0x12) ev.key = Key.Alt; // windows does it this way
ev.hardwareCode = (lParam & 0xff0000) >> 16;
if(GetKeyState(Key.Shift)&0x8000 || GetKeyState(Key.Shift_r)&0x8000)
ev.modifierState |= ModifierState.shift;
//k8: this doesn't work; thanks for nothing, windows
/*if(GetKeyState(Key.Alt)&0x8000 || GetKeyState(Key.Alt_r)&0x8000)
ev.modifierState |= ModifierState.alt;*/
if (wParam == 0x12) altPressed = (msg == WM_SYSKEYDOWN);
if (altPressed) ev.modifierState |= ModifierState.alt; else ev.modifierState &= ~ModifierState.alt;
if(GetKeyState(Key.Ctrl)&0x8000 || GetKeyState(Key.Ctrl_r)&0x8000)
ev.modifierState |= ModifierState.ctrl;
if(GetKeyState(Key.Windows)&0x8000 || GetKeyState(Key.Windows_r)&0x8000)
ev.modifierState |= ModifierState.windows;
if(GetKeyState(Key.NumLock))
ev.modifierState |= ModifierState.numLock;
if(GetKeyState(Key.CapsLock))
ev.modifierState |= ModifierState.capsLock;
/+
// we always want to send the character too, so let's convert it
ubyte[256] state;
wchar[16] buffer;
GetKeyboardState(state.ptr);
ToUnicodeEx(wParam, lParam, state.ptr, buffer.ptr, buffer.length, 0, null);
foreach(dchar d; buffer) {
ev.character = d;
break;
}
+/
ev.window = wind;
if(wind.handleKeyEvent)
wind.handleKeyEvent(ev);
break;
case 0x020a /*WM_MOUSEWHEEL*/:
// send click
mouse.type = cast(MouseEventType) 1;
mouse.button = ((GET_WHEEL_DELTA_WPARAM(wParam) > 0) ? MouseButton.wheelUp : MouseButton.wheelDown);
mouseEvent(true, LOWORD(wParam));
// also send release
mouse.type = cast(MouseEventType) 2;
mouse.button = ((GET_WHEEL_DELTA_WPARAM(wParam) > 0) ? MouseButton.wheelUp : MouseButton.wheelDown);
mouseEvent(true, LOWORD(wParam));
break;
case WM_MOUSEMOVE:
mouse.type = cast(MouseEventType) 0;
mouseEvent(false, wParam);
break;
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
mouse.type = cast(MouseEventType) 1;
mouse.button = MouseButton.left;
mouse.doubleClick = msg == WM_LBUTTONDBLCLK;
mouseEvent(false, wParam);
break;
case WM_LBUTTONUP:
mouse.type = cast(MouseEventType) 2;
mouse.button = MouseButton.left;
mouseEvent(false, wParam);
break;
case WM_RBUTTONDOWN:
case WM_RBUTTONDBLCLK:
mouse.type = cast(MouseEventType) 1;
mouse.button = MouseButton.right;
mouse.doubleClick = msg == WM_RBUTTONDBLCLK;
mouseEvent(false, wParam);
break;
case WM_RBUTTONUP:
mouse.type = cast(MouseEventType) 2;
mouse.button = MouseButton.right;
mouseEvent(false, wParam);
break;
case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
mouse.type = cast(MouseEventType) 1;
mouse.button = MouseButton.middle;
mouse.doubleClick = msg == WM_MBUTTONDBLCLK;
mouseEvent(false, wParam);
break;
case WM_MBUTTONUP:
mouse.type = cast(MouseEventType) 2;
mouse.button = MouseButton.middle;
mouseEvent(false, wParam);
break;
case WM_XBUTTONDOWN:
case WM_XBUTTONDBLCLK:
mouse.type = cast(MouseEventType) 1;
mouse.button = HIWORD(wParam) == 1 ? MouseButton.backButton : MouseButton.forwardButton;
mouse.doubleClick = msg == WM_XBUTTONDBLCLK;
mouseEvent(false, wParam);
return 1; // MSDN says special treatment here, return TRUE to bypass simulation programs
case WM_XBUTTONUP:
mouse.type = cast(MouseEventType) 2;
mouse.button = HIWORD(wParam) == 1 ? MouseButton.backButton : MouseButton.forwardButton;
mouseEvent(false, wParam);
return 1; // see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms646246(v=vs.85).aspx
default: return 1;
}
return 0;
}
HWND hwnd;
private int oldWidth;
private int oldHeight;
private bool inSizeMove;
/++
If this is true, the live resize events will trigger all the size things as they drag. If false, those events only come when the size is complete; when the user lets go of the mouse button.
History:
Added November 23, 2021
Not fully stable, may be moved out of the impl struct.
+/
bool doLiveResizing;
private int bmpWidth;
private int bmpHeight;
// the extern(Windows) wndproc should just forward to this
LRESULT windowProcedure(HWND hwnd, uint msg, WPARAM wParam, LPARAM lParam) {
assert(hwnd is this.hwnd);
if(triggerEvents(hwnd, msg, wParam, lParam, 0, 0, this))
switch(msg) {
case WM_SETCURSOR:
if(cast(HWND) wParam !is hwnd)
return 0; // further processing elsewhere
if(LOWORD(lParam) == HTCLIENT && (this.curHidden > 0 || currentCursor !is null)) {
SetCursor(this.curHidden > 0 ? null : currentCursor);
return 1;
} else {
return DefWindowProc(hwnd, msg, wParam, lParam);
}
//break;
case WM_CLOSE:
if (this.closeQuery !is null) this.closeQuery(); else this.close();
break;
case WM_DESTROY:
if (this.onDestroyed !is null) try { this.onDestroyed(); } catch (Exception e) {} // sorry
SimpleWindow.nativeMapping.remove(hwnd);
CapableOfHandlingNativeEvent.nativeHandleMapping.remove(hwnd);
bool anyImportant = false;
foreach(SimpleWindow w; SimpleWindow.nativeMapping)
if(w.beingOpenKeepsAppOpen) {
anyImportant = true;
break;
}
if(!anyImportant) {
PostQuitMessage(0);
}
break;
case 0x02E0 /*WM_DPICHANGED*/:
this.actualDpi_ = LOWORD(wParam); // hiword is the y param but it is the same per docs
RECT* prcNewWindow = cast(RECT*)lParam;
// docs say this is the recommended position and we should honor it
SetWindowPos(hwnd,
null,
prcNewWindow.left,
prcNewWindow.top,
prcNewWindow.right - prcNewWindow.left,
prcNewWindow.bottom - prcNewWindow.top,
SWP_NOZORDER | SWP_NOACTIVATE);
// doing this because of https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/DPIAwarenessPerWindow/client/DpiAwarenessContext.cpp
// im not sure it is completely correct
// but without it the tabs and such do look weird as things change.
if(SystemParametersInfoForDpi) {
LOGFONT lfText;
SystemParametersInfoForDpi(SPI_GETICONTITLELOGFONT, lfText.sizeof, &lfText, FALSE, this.actualDpi_);
HFONT hFontNew = CreateFontIndirect(&lfText);
if (hFontNew)
{
//DeleteObject(hFontOld);
static extern(Windows) BOOL helper(HWND hWnd, LPARAM lParam) {
SendMessage(hWnd, WM_SETFONT, cast(WPARAM)lParam, MAKELPARAM(TRUE, 0));
return TRUE;
}
EnumChildWindows(hwnd, &helper, cast(LPARAM) hFontNew);
}
}
if(this.onDpiChanged)
this.onDpiChanged();
break;
case WM_ENTERIDLE:
// when a menu is up, it stops normal event processing (modal message loop)
// but this at least gives us a chance to SOMETIMES catch up
// FIXME: I can use SetTimer while idle to keep working i think... but idk when i'd destroy it.
SimpleWindow.processAllCustomEvents;
SimpleWindow.processAllCustomEvents;
SleepEx(0, true);
break;
case WM_SIZE:
if(wParam == 1 /* SIZE_MINIMIZED */)
break;
_width = LOWORD(lParam);
_height = HIWORD(lParam);
// I want to avoid tearing in the windows (my code is inefficient
// so this is a hack around that) so while sizing, we don't trigger,
// but we do want to trigger on events like mazimize.
if(!inSizeMove || doLiveResizing)
goto size_changed;
break;
/+
case WM_SIZING:
import std.stdio; writeln("size");
break;
+/
// I don't like the tearing I get when redrawing on WM_SIZE
// (I know there's other ways to fix that but I don't like that behavior anyway)
// so instead it is going to redraw only at the end of a size.
case 0x0231: /* WM_ENTERSIZEMOVE */
oldWidth = this.width;
oldHeight = this.height;
inSizeMove = true;
break;
case 0x0232: /* WM_EXITSIZEMOVE */
inSizeMove = false;
size_changed:
// nothing relevant changed, don't bother redrawing
if(oldWidth == width && oldHeight == height)
break;
// note: OpenGL windows don't use a backing bmp, so no need to change them
// if resizability is anything other than allowResizing, it is meant to either stretch the one image or just do nothing
if(openglMode == OpenGlOptions.no) { // && resizability == Resizability.allowResizing) {
// gotta get the double buffer bmp to match the window
// FIXME: could this be more efficient? it never relinquishes a large bitmap
if(width > bmpWidth || height > bmpHeight) {
auto hdc = GetDC(hwnd);
auto oldBuffer = buffer;
buffer = CreateCompatibleBitmap(hdc, width, height);
auto hdcBmp = CreateCompatibleDC(hdc);
auto oldBmp = SelectObject(hdcBmp, buffer);
auto hdcOldBmp = CreateCompatibleDC(hdc);
auto oldOldBmp = SelectObject(hdcOldBmp, oldBmp);
BitBlt(hdcBmp, 0, 0, width, height, hdcOldBmp, oldWidth, oldHeight, SRCCOPY);
bmpWidth = width;
bmpHeight = height;
SelectObject(hdcOldBmp, oldOldBmp);
DeleteDC(hdcOldBmp);
SelectObject(hdcBmp, oldBmp);
DeleteDC(hdcBmp);
ReleaseDC(hwnd, hdc);
DeleteObject(oldBuffer);
}
}
version(without_opengl) {} else
if(openglMode == OpenGlOptions.yes && resizability == Resizability.automaticallyScaleIfPossible) {
glViewport(0, 0, width, height);
}
if(windowResized !is null)
windowResized(width, height);
if(inSizeMove)
SimpleWindow.processAllCustomEvents();
break;
case WM_ERASEBKGND:
// call `visibleForTheFirstTime` here, so we can do initialization as early as possible
if (!this._visibleForTheFirstTimeCalled) {
this._visibleForTheFirstTimeCalled = true;
if (this.visibleForTheFirstTime !is null) {
version(without_opengl) {} else {
if(openglMode == OpenGlOptions.yes) {
this.setAsCurrentOpenGlContextNT();
glViewport(0, 0, width, height);
}
}
this.visibleForTheFirstTime();
}
}
// block it in OpenGL mode, 'cause no sane person will (or should) draw windows controls over OpenGL scene
version(without_opengl) {} else {
if (openglMode == OpenGlOptions.yes) return 1;
}
// call windows default handler, so it can paint standard controls
goto default;
case WM_CTLCOLORBTN:
case WM_CTLCOLORSTATIC:
SetBkMode(cast(HDC) wParam, TRANSPARENT);
return cast(typeof(return)) //GetStockObject(NULL_BRUSH);
GetSysColorBrush(COLOR_3DFACE);
//break;
case WM_SHOWWINDOW:
this._visible = (wParam != 0);
if (!this._visibleForTheFirstTimeCalled && this._visible) {
this._visibleForTheFirstTimeCalled = true;
if (this.visibleForTheFirstTime !is null) {
version(without_opengl) {} else {
if(openglMode == OpenGlOptions.yes) {
this.setAsCurrentOpenGlContextNT();
glViewport(0, 0, width, height);
}
}
this.visibleForTheFirstTime();
}
}
if (this.visibilityChanged !is null) this.visibilityChanged(this._visible);
break;
case WM_PAINT: {
if (!this._visibleForTheFirstTimeCalled) {
this._visibleForTheFirstTimeCalled = true;
if (this.visibleForTheFirstTime !is null) {
version(without_opengl) {} else {
if(openglMode == OpenGlOptions.yes) {
this.setAsCurrentOpenGlContextNT();
glViewport(0, 0, width, height);
}
}
this.visibleForTheFirstTime();
}
}
BITMAP bm;
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
if(openglMode == OpenGlOptions.no) {
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = SelectObject(hdcMem, buffer);
GetObject(buffer, bm.sizeof, &bm);
// FIXME: only BitBlt the invalidated rectangle, not the whole thing
if(resizability == Resizability.automaticallyScaleIfPossible)
StretchBlt(hdc, 0, 0, this.width, this.height, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
else
BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
EndPaint(hwnd, &ps);
} else {
EndPaint(hwnd, &ps);
version(without_opengl) {} else
redrawOpenGlSceneNow();
}
} break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
}
mixin template NativeImageImplementation() {
HBITMAP handle;
ubyte* rawData;
final:
Color getPixel(int x, int y) {
auto itemsPerLine = ((cast(int) width * 3 + 3) / 4) * 4;
// remember, bmps are upside down
auto offset = itemsPerLine * (height - y - 1) + x * 3;
Color c;
if(enableAlpha)
c.a = rawData[offset + 3];
else
c.a = 255;
c.b = rawData[offset + 0];
c.g = rawData[offset + 1];
c.r = rawData[offset + 2];
c.unPremultiply();
return c;
}
void setPixel(int x, int y, Color c) {
auto itemsPerLine = ((cast(int) width * 3 + 3) / 4) * 4;
// remember, bmps are upside down
auto offset = itemsPerLine * (height - y - 1) + x * 3;
if(enableAlpha)
c.premultiply();
rawData[offset + 0] = c.b;
rawData[offset + 1] = c.g;
rawData[offset + 2] = c.r;
if(enableAlpha)
rawData[offset + 3] = c.a;
}
void convertToRgbaBytes(ubyte[] where) {
assert(where.length == this.width * this.height * 4);
auto itemsPerLine = ((cast(int) width * 3 + 3) / 4) * 4;
int idx = 0;
int offset = itemsPerLine * (height - 1);
// remember, bmps are upside down
for(int y = height - 1; y >= 0; y--) {
auto offsetStart = offset;
for(int x = 0; x < width; x++) {
where[idx + 0] = rawData[offset + 2]; // r
where[idx + 1] = rawData[offset + 1]; // g
where[idx + 2] = rawData[offset + 0]; // b
if(enableAlpha) {
where[idx + 3] = rawData[offset + 3]; // a
unPremultiplyRgba(where[idx .. idx + 4]);
offset++;
} else
where[idx + 3] = 255; // a
idx += 4;
offset += 3;
}
offset = offsetStart - itemsPerLine;
}
}
void setFromRgbaBytes(in ubyte[] what) {
assert(what.length == this.width * this.height * 4);
auto itemsPerLine = enableAlpha ? (width * 4) : (((cast(int) width * 3 + 3) / 4) * 4);
int idx = 0;
int offset = itemsPerLine * (height - 1);
// remember, bmps are upside down
for(int y = height - 1; y >= 0; y--) {
auto offsetStart = offset;
for(int x = 0; x < width; x++) {
if(enableAlpha) {
auto a = what[idx + 3];
rawData[offset + 2] = (a * what[idx + 0]) / 255; // r
rawData[offset + 1] = (a * what[idx + 1]) / 255; // g
rawData[offset + 0] = (a * what[idx + 2]) / 255; // b
rawData[offset + 3] = a; // a
//premultiplyBgra(rawData[offset .. offset + 4]);
offset++;
} else {
rawData[offset + 2] = what[idx + 0]; // r
rawData[offset + 1] = what[idx + 1]; // g
rawData[offset + 0] = what[idx + 2]; // b
}
idx += 4;
offset += 3;
}
offset = offsetStart - itemsPerLine;
}
}
void createImage(int width, int height, bool forcexshm=false, bool enableAlpha = false) {
BITMAPINFO infoheader;
infoheader.bmiHeader.biSize = infoheader.bmiHeader.sizeof;
infoheader.bmiHeader.biWidth = width;
infoheader.bmiHeader.biHeight = height;
infoheader.bmiHeader.biPlanes = 1;
infoheader.bmiHeader.biBitCount = enableAlpha ? 32: 24;
infoheader.bmiHeader.biCompression = BI_RGB;
handle = CreateDIBSection(
null,
&infoheader,
DIB_RGB_COLORS,
cast(void**) &rawData,
null,
0);
if(handle is null)
throw new WindowsApiException("create image failed");
}
void dispose() {
DeleteObject(handle);
}
}
enum KEY_ESCAPE = 27;
}
version(X11) {
/// This is the default font used. You might change this before doing anything else with
/// the library if you want to try something else. Surround that in `static if(UsingSimpledisplayX11)`
/// for cross-platform compatibility.
//__gshared string xfontstr = "-*-dejavu sans-medium-r-*-*-12-*-*-*-*-*-*-*";
//__gshared string xfontstr = "-*-dejavu sans-medium-r-*-*-12-*-*-*-*-*-*-*";
__gshared string xfontstr = "-*-lucida-medium-r-normal-sans-12-*-*-*-*-*-*-*";
//__gshared string xfontstr = "-*-fixed-medium-r-*-*-14-*-*-*-*-*-*-*";
alias int delegate(XEvent) NativeEventHandler;
alias Window NativeWindowHandle;
enum KEY_ESCAPE = 9;
mixin template NativeScreenPainterImplementation() {
Display* display;
Drawable d;
Drawable destiny;
// FIXME: should the gc be static too so it isn't recreated every time draw is called?
GC gc;
__gshared bool fontAttempted;
__gshared XFontStruct* defaultfont;
__gshared XFontSet defaultfontset;
XFontStruct* font;
XFontSet fontset;
void create(NativeWindowHandle window) {
this.display = XDisplayConnection.get();
Drawable buffer = None;
if(auto sw = cast(SimpleWindow) this.window) {
buffer = sw.impl.buffer;
this.destiny = cast(Drawable) window;
} else {
buffer = cast(Drawable) window;
this.destiny = None;
}
this.d = cast(Drawable) buffer;
auto dgc = DefaultGC(display, DefaultScreen(display));
this.gc = XCreateGC(display, d, 0, null);
XCopyGC(display, dgc, 0xffffffff, this.gc);
ensureDefaultFontLoaded();
font = defaultfont;
fontset = defaultfontset;
if(font) {
XSetFont(display, gc, font.fid);
}
}
static void ensureDefaultFontLoaded() {
if(!fontAttempted) {
auto display = XDisplayConnection.get;
auto font = XLoadQueryFont(display, xfontstr.ptr);
// if the user font choice fails, fixed is pretty reliable (required by X to start!) and not bad either
if(font is null) {
xfontstr = "-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*";
font = XLoadQueryFont(display, xfontstr.ptr);
}
char** lol;
int lol2;
char* lol3;
auto fontset = XCreateFontSet(display, xfontstr.ptr, &lol, &lol2, &lol3);
fontAttempted = true;
defaultfont = font;
defaultfontset = fontset;
}
}
arsd.color.Rectangle _clipRectangle;
void setClipRectangle(int x, int y, int width, int height) {
_clipRectangle = arsd.color.Rectangle(Point(x, y), Size(width, height));
if(width == 0 || height == 0) {
XSetClipMask(display, gc, None);
version(with_xft) {
if(xftFont is null || xftDraw is null)
return;
XftDrawSetClip(xftDraw, null);
}
} else {
XRectangle[1] rects;
rects[0] = XRectangle(cast(short)(x), cast(short)(y), cast(short) width, cast(short) height);
XSetClipRectangles(XDisplayConnection.get, gc, 0, 0, rects.ptr, 1, 0);
version(with_xft) {
if(xftFont is null || xftDraw is null)
return;
XftDrawSetClipRectangles(xftDraw, 0, 0, rects.ptr, 1);
}
}
}
version(with_xft) {
XftFont* xftFont;
XftDraw* xftDraw;
XftColor xftColor;
void updateXftColor() {
if(xftFont is null)
return;
// not bothering with XftColorFree since p sure i don't need it on 24 bit displays....
XRenderColor colorIn = XRenderColor(_outlineColor.r * 255, _outlineColor.g * 255, _outlineColor.b * 255, _outlineColor.a * 255);
XftColorAllocValue(
display,
DefaultVisual(display, DefaultScreen(display)),
DefaultColormap(display, 0),
&colorIn,
&xftColor
);
}
}
void setFont(OperatingSystemFont font) {
version(with_xft) {
if(font && font.isXft && font.xftFont)
this.xftFont = font.xftFont;
else
this.xftFont = null;
if(this.xftFont) {
if(xftDraw is null) {
xftDraw = XftDrawCreate(
display,
d,
DefaultVisual(display, DefaultScreen(display)),
DefaultColormap(display, 0)
);
updateXftColor();
}
return;
}
}
if(font && font.font) {
this.font = font.font;
this.fontset = font.fontset;
XSetFont(display, gc, font.font.fid);
} else {
this.font = defaultfont;
this.fontset = defaultfontset;
}
}
private Picture xrenderPicturePainter;
bool manualInvalidations;
void invalidateRect(Rectangle invalidRect) {
// FIXME if manualInvalidations
}
void dispose() {
this.rasterOp = RasterOp.normal;
if(xrenderPicturePainter) {
XRenderFreePicture(display, xrenderPicturePainter);
xrenderPicturePainter = None;
}
// FIXME: this.window.width/height is probably wrong
// src x,y then dest x, y
if(destiny != None) {
// FIXME: if manual invalidations we can actually only copy some of the area.
// if(manualInvalidations)
XSetClipMask(display, gc, None);
XCopyArea(display, d, destiny, gc, 0, 0, this.window.width, this.window.height, 0, 0);
}
XFreeGC(display, gc);
version(with_xft)
if(xftDraw) {
XftDrawDestroy(xftDraw);
xftDraw = null;
}
/+
// this should prolly legit never be used since if it destroys the font handle from a OperatingSystemFont, it also ruins a reusable resource.
if(font && font !is defaultfont) {
XFreeFont(display, font);
font = null;
}
if(fontset && fontset !is defaultfontset) {
XFreeFontSet(display, fontset);
fontset = null;
}
+/
XFlush(display);
if(window.paintingFinishedDg !is null)
window.paintingFinishedDg()();
}
bool backgroundIsNotTransparent = true;
bool foregroundIsNotTransparent = true;
bool _penInitialized = false;
Pen _activePen;
Color _outlineColor;
Color _fillColor;
@property void pen(Pen p) {
if(_penInitialized && p == _activePen) {
return;
}
_penInitialized = true;
_activePen = p;
_outlineColor = p.color;
int style;
byte dashLength;
final switch(p.style) {
case Pen.Style.Solid:
style = 0 /*LineSolid*/;
break;
case Pen.Style.Dashed:
style = 1 /*LineOnOffDash*/;
dashLength = 4;
break;
case Pen.Style.Dotted:
style = 1 /*LineOnOffDash*/;
dashLength = 1;
break;
}
XSetLineAttributes(display, gc, p.width, style, 0, 0);
if(dashLength)
XSetDashes(display, gc, 0, &dashLength, 1);
if(p.color.a == 0) {
foregroundIsNotTransparent = false;
return;
}
foregroundIsNotTransparent = true;
XSetForeground(display, gc, colorToX(p.color, display));
version(with_xft)
updateXftColor();
}
RasterOp _currentRasterOp;
bool _currentRasterOpInitialized = false;
@property void rasterOp(RasterOp op) {
if(_currentRasterOpInitialized && _currentRasterOp == op)
return;
_currentRasterOp = op;
_currentRasterOpInitialized = true;
int mode;
final switch(op) {
case RasterOp.normal:
mode = GXcopy;
break;
case RasterOp.xor:
mode = GXxor;
break;
}
XSetFunction(display, gc, mode);
}
bool _fillColorInitialized = false;
@property void fillColor(Color c) {
if(_fillColorInitialized && _fillColor == c)
return; // already good, no need to waste time calling it
_fillColor = c;
_fillColorInitialized = true;
if(c.a == 0) {
backgroundIsNotTransparent = false;
return;
}
backgroundIsNotTransparent = true;
XSetBackground(display, gc, colorToX(c, display));
}
void swapColors() {
auto tmp = _fillColor;
fillColor = _outlineColor;
auto newPen = _activePen;
newPen.color = tmp;
pen(newPen);
}
uint colorToX(Color c, Display* display) {
auto visual = DefaultVisual(display, DefaultScreen(display));
import core.bitop;
uint color = 0;
{
auto startBit = bsf(visual.red_mask);
auto lastBit = bsr(visual.red_mask);
auto r = cast(uint) c.r;
r >>= 7 - (lastBit - startBit);
r <<= startBit;
color |= r;
}
{
auto startBit = bsf(visual.green_mask);
auto lastBit = bsr(visual.green_mask);
auto g = cast(uint) c.g;
g >>= 7 - (lastBit - startBit);
g <<= startBit;
color |= g;
}
{
auto startBit = bsf(visual.blue_mask);
auto lastBit = bsr(visual.blue_mask);
auto b = cast(uint) c.b;
b >>= 7 - (lastBit - startBit);
b <<= startBit;
color |= b;
}
return color;
}
void drawImage(int x, int y, Image i, int ix, int iy, int w, int h) {
// source x, source y
if(ix >= i.width) return;
if(iy >= i.height) return;
if(ix + w > i.width) w = i.width - ix;
if(iy + h > i.height) h = i.height - iy;
if(i.usingXshm)
XShmPutImage(display, d, gc, i.handle, ix, iy, x, y, w, h, false);
else
XPutImage(display, d, gc, i.handle, ix, iy, x, y, w, h);
}
void drawPixmap(Sprite s, int x, int y, int ix, int iy, int w, int h) {
if(s.enableAlpha) {
// the Sprite must be created first, meaning if we're here, XRender is already loaded
if(this.xrenderPicturePainter == None) {
XRenderPictureAttributes attrs;
// FIXME: I can prolly reuse this as long as the pixmap itself is valid.
xrenderPicturePainter = XRenderCreatePicture(display, d, Sprite.RGB24, 0, &attrs);
}
XRenderComposite(
display,
3, // PicOpOver
s.xrenderPicture,
None,
this.xrenderPicturePainter,
ix,
iy,
0,
0,
x,
y,
w ? w : s.width,
h ? h : s.height
);
} else {
XCopyArea(display, s.handle, d, gc, ix, iy, w ? w : s.width, h ? h : s.height, x, y);
}
}
int fontHeight() {
version(with_xft)
if(xftFont !is null)
return xftFont.height;
if(font)
return font.max_bounds.ascent + font.max_bounds.descent;
return 12; // pretty common default...
}
int textWidth(in char[] line) {
version(with_xft)
if(xftFont) {
if(line.length == 0)
return 0;
XGlyphInfo extents;
XftTextExtentsUtf8(display, xftFont, line.ptr, cast(int) line.length, &extents);
return extents.width;
}
if(fontset) {
if(line.length == 0)
return 0;
XRectangle rect;
Xutf8TextExtents(fontset, line.ptr, cast(int) line.length, null, &rect);
return rect.width;
}
if(font)
// FIXME: unicode
return XTextWidth( font, line.ptr, cast(int) line.length);
else
return fontHeight / 2 * cast(int) line.length; // if no font is loaded, it is prolly Fixed, which is a 2:1 ratio
}
Size textSize(in char[] text) {
auto maxWidth = 0;
auto lineHeight = fontHeight;
int h = text.length ? 0 : lineHeight + 4; // if text is empty, it still gives the line height
foreach(line; text.split('\n')) {
int textWidth = this.textWidth(line);
if(textWidth > maxWidth)
maxWidth = textWidth;
h += lineHeight + 4;
}
return Size(maxWidth, h);
}
void drawText(in int x, in int y, in int x2, in int y2, in char[] originalText, in uint alignment) {
const(char)[] text;
version(with_xft)
if(xftFont) {
text = originalText;
goto loaded;
}
if(fontset)
text = originalText;
else {
text.reserve(originalText.length);
// the first 256 unicode codepoints are the same as ascii and latin-1, which is what X expects, so we can keep all those
// then strip the rest so there isn't garbage
foreach(dchar ch; originalText)
if(ch < 256)
text ~= cast(ubyte) ch;
else
text ~= 191; // FIXME: using a random character (upside down question mark) to fill the space
}
loaded:
if(text.length == 0)
return;
// FIXME: should we clip it to the bounding box?
int textHeight = fontHeight;
auto lines = text.split('\n');
const lineHeight = textHeight;
textHeight *= lines.length;
int cy = y;
if(alignment & TextAlignment.VerticalBottom) {
if(y2 <= 0)
return;
auto h = y2 - y;
if(h > textHeight) {
cy += h - textHeight;
cy -= lineHeight / 2;
}
} else if(alignment & TextAlignment.VerticalCenter) {
if(y2 <= 0)
return;
auto h = y2 - y;
if(textHeight < h) {
cy += (h - textHeight) / 2;
//cy -= lineHeight / 4;
}
}
foreach(line; text.split('\n')) {
int textWidth = this.textWidth(line);
int px = x, py = cy;
if(alignment & TextAlignment.Center) {
if(x2 <= 0)
return;
auto w = x2 - x;
if(w > textWidth)
px += (w - textWidth) / 2;
} else if(alignment & TextAlignment.Right) {
if(x2 <= 0)
return;
auto pos = x2 - textWidth;
if(pos > x)
px = pos;
}
version(with_xft)
if(xftFont) {
XftDrawStringUtf8(xftDraw, &xftColor, xftFont, px, py + xftFont.ascent, line.ptr, cast(int) line.length);
goto carry_on;
}
if(fontset)
Xutf8DrawString(display, d, fontset, gc, px, py + (font ? font.max_bounds.ascent : lineHeight), line.ptr, cast(int) line.length);
else
XDrawString(display, d, gc, px, py + (font ? font.max_bounds.ascent : lineHeight), line.ptr, cast(int) line.length);
carry_on:
cy += lineHeight + 4;
}
}
void drawPixel(int x, int y) {
XDrawPoint(display, d, gc, x, y);
}
// The basic shapes, outlined
void drawLine(int x1, int y1, int x2, int y2) {
if(foregroundIsNotTransparent)
XDrawLine(display, d, gc, x1, y1, x2, y2);
}
void drawRectangle(int x, int y, int width, int height) {
if(backgroundIsNotTransparent) {
swapColors();
XFillRectangle(display, d, gc, x+1, y+1, width-2, height-2); // Need to ensure pixels are only drawn once...
swapColors();
}
// since X centers the line on the coordinates, we try to undo that with the width/2 thing here so it is aligned in the rectangle's bounds
if(foregroundIsNotTransparent)
XDrawRectangle(display, d, gc, x + _activePen.width / 2, y + _activePen.width / 2, width - 1 - _activePen.width / 2, height - 1 - _activePen.width / 2);
}
/// Arguments are the points of the bounding rectangle
void drawEllipse(int x1, int y1, int x2, int y2) {
drawArc(x1, y1, x2 - x1, y2 - y1, 0, 360 * 64);
}
// NOTE: start and finish are in units of degrees * 64
void drawArc(int x1, int y1, int width, int height, int start, int finish) {
if(backgroundIsNotTransparent) {
swapColors();
XFillArc(display, d, gc, x1, y1, width, height, start, finish);
swapColors();
}
if(foregroundIsNotTransparent) {
XDrawArc(display, d, gc, x1, y1, width, height, start, finish);
// Windows draws the straight lines on the edges too so FIXME sort of
}
}
void drawPolygon(Point[] vertexes) {
XPoint[16] pointsBuffer;
XPoint[] points;
if(vertexes.length <= pointsBuffer.length)
points = pointsBuffer[0 .. vertexes.length];
else
points.length = vertexes.length;
foreach(i, p; vertexes) {
points[i].x = cast(short) p.x;
points[i].y = cast(short) p.y;
}
if(backgroundIsNotTransparent) {
swapColors();
XFillPolygon(display, d, gc, points.ptr, cast(int) points.length, PolygonShape.Complex, CoordMode.CoordModeOrigin);
swapColors();
}
if(foregroundIsNotTransparent) {
XDrawLines(display, d, gc, points.ptr, cast(int) points.length, CoordMode.CoordModeOrigin);
}
}
}
/* XRender { */
struct XRenderColor {
ushort red;
ushort green;
ushort blue;
ushort alpha;
}
alias Picture = XID;
alias PictFormat = XID;
struct XGlyphInfo {
ushort width;
ushort height;
short x;
short y;
short xOff;
short yOff;
}
struct XRenderDirectFormat {
short red;
short redMask;
short green;
short greenMask;
short blue;
short blueMask;
short alpha;
short alphaMask;
}
struct XRenderPictFormat {
PictFormat id;
int type;
int depth;
XRenderDirectFormat direct;
Colormap colormap;
}
enum PictFormatID = (1 << 0);
enum PictFormatType = (1 << 1);
enum PictFormatDepth = (1 << 2);
enum PictFormatRed = (1 << 3);
enum PictFormatRedMask =(1 << 4);
enum PictFormatGreen = (1 << 5);
enum PictFormatGreenMask=(1 << 6);
enum PictFormatBlue = (1 << 7);
enum PictFormatBlueMask =(1 << 8);
enum PictFormatAlpha = (1 << 9);
enum PictFormatAlphaMask=(1 << 10);
enum PictFormatColormap =(1 << 11);
struct XRenderPictureAttributes {
int repeat;
Picture alpha_map;
int alpha_x_origin;
int alpha_y_origin;
int clip_x_origin;
int clip_y_origin;
Pixmap clip_mask;
Bool graphics_exposures;
int subwindow_mode;
int poly_edge;
int poly_mode;
Atom dither;
Bool component_alpha;
}
alias int XFixed;
struct XPointFixed {
XFixed x, y;
}
struct XCircle {
XFixed x;
XFixed y;
XFixed radius;
}
struct XTransform {
XFixed[3][3] matrix;
}
struct XFilters {
int nfilter;
char **filter;
int nalias;
short *alias_;
}
struct XIndexValue {
c_ulong pixel;
ushort red, green, blue, alpha;
}
struct XAnimCursor {
Cursor cursor;
c_ulong delay;
}
struct XLinearGradient {
XPointFixed p1;
XPointFixed p2;
}
struct XRadialGradient {
XCircle inner;
XCircle outer;
}
struct XConicalGradient {
XPointFixed center;
XFixed angle; /* in degrees */
}
enum PictStandardARGB32 = 0;
enum PictStandardRGB24 = 1;
enum PictStandardA8 = 2;
enum PictStandardA4 = 3;
enum PictStandardA1 = 4;
enum PictStandardNUM = 5;
interface XRender {
extern(C) @nogc:
Bool XRenderQueryExtension (Display *dpy, int *event_basep, int *error_basep);
Status XRenderQueryVersion (Display *dpy,
int *major_versionp,
int *minor_versionp);
Status XRenderQueryFormats (Display *dpy);
int XRenderQuerySubpixelOrder (Display *dpy, int screen);
Bool XRenderSetSubpixelOrder (Display *dpy, int screen, int subpixel);
XRenderPictFormat *
XRenderFindVisualFormat (Display *dpy, const Visual *visual);
XRenderPictFormat *
XRenderFindFormat (Display *dpy,
c_ulong mask,
const XRenderPictFormat *templ,
int count);
XRenderPictFormat *
XRenderFindStandardFormat (Display *dpy,
int format);
XIndexValue *
XRenderQueryPictIndexValues(Display *dpy,
const XRenderPictFormat *format,
int *num);
Picture XRenderCreatePicture(
Display *dpy,
Drawable drawable,
const XRenderPictFormat *format,
c_ulong valuemask,
const XRenderPictureAttributes *attributes);
void XRenderChangePicture (Display *dpy,
Picture picture,
c_ulong valuemask,
const XRenderPictureAttributes *attributes);
void
XRenderSetPictureClipRectangles (Display *dpy,
Picture picture,
int xOrigin,
int yOrigin,
const XRectangle *rects,
int n);
void
XRenderSetPictureClipRegion (Display *dpy,
Picture picture,
Region r);
void
XRenderSetPictureTransform (Display *dpy,
Picture picture,
XTransform *transform);
void
XRenderFreePicture (Display *dpy,
Picture picture);
void
XRenderComposite (Display *dpy,
int op,
Picture src,
Picture mask,
Picture dst,
int src_x,
int src_y,
int mask_x,
int mask_y,
int dst_x,
int dst_y,
uint width,
uint height);
Picture XRenderCreateSolidFill (Display *dpy,
const XRenderColor *color);
Picture XRenderCreateLinearGradient (Display *dpy,
const XLinearGradient *gradient,
const XFixed *stops,
const XRenderColor *colors,
int nstops);
Picture XRenderCreateRadialGradient (Display *dpy,
const XRadialGradient *gradient,
const XFixed *stops,
const XRenderColor *colors,
int nstops);
Picture XRenderCreateConicalGradient (Display *dpy,
const XConicalGradient *gradient,
const XFixed *stops,
const XRenderColor *colors,
int nstops);
Cursor
XRenderCreateCursor (Display *dpy,
Picture source,
uint x,
uint y);
XFilters *
XRenderQueryFilters (Display *dpy, Drawable drawable);
void
XRenderSetPictureFilter (Display *dpy,
Picture picture,
const char *filter,
XFixed *params,
int nparams);
Cursor
XRenderCreateAnimCursor (Display *dpy,
int ncursor,
XAnimCursor *cursors);
}
__gshared bool XRenderLibrarySuccessfullyLoaded = true;
mixin DynamicLoad!(XRender, "Xrender", 1, XRenderLibrarySuccessfullyLoaded) XRenderLibrary;
/* XRender } */
/* Xrandr { */
struct XRRMonitorInfo {
Atom name;
Bool primary;
Bool automatic;
int noutput;
int x;
int y;
int width;
int height;
int mwidth;
int mheight;
/*RROutput*/ void *outputs;
}
struct XRRScreenChangeNotifyEvent {
int type; /* event base */
c_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* window which selected for this event */
Window root; /* Root window for changed screen */
Time timestamp; /* when the screen change occurred */
Time config_timestamp; /* when the last configuration change */
ushort/*SizeID*/ size_index;
ushort/*SubpixelOrder*/ subpixel_order;
ushort/*Rotation*/ rotation;
int width;
int height;
int mwidth;
int mheight;
}
enum RRScreenChangeNotify = 0;
enum RRScreenChangeNotifyMask = 1;
__gshared int xrrEventBase = -1;
interface XRandr {
extern(C) @nogc:
Bool XRRQueryExtension (Display *dpy, int *event_base_return, int *error_base_return);
Status XRRQueryVersion (Display *dpy, int *major_version_return, int *minor_version_return);
XRRMonitorInfo * XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors);
void XRRFreeMonitors(XRRMonitorInfo *monitors);
void XRRSelectInput(Display *dpy, Window window, int mask);
}
__gshared bool XRandrLibrarySuccessfullyLoaded = true;
mixin DynamicLoad!(XRandr, "Xrandr", 2, XRandrLibrarySuccessfullyLoaded) XRandrLibrary;
/* Xrandr } */
/* Xft { */
// actually freetype
alias void FT_Face;
// actually fontconfig
private alias FcBool = int;
alias void FcCharSet;
alias void FcPattern;
alias void FcResult;
enum FcEndian { FcEndianBig, FcEndianLittle }
struct FcFontSet {
int nfont;
int sfont;
FcPattern** fonts;
}
// actually XRegion
struct BOX {
short x1, x2, y1, y2;
}
struct _XRegion {
c_long size;
c_long numRects;
BOX* rects;
BOX extents;
}
alias Region = _XRegion*;
// ok actually Xft
struct XftFontInfo;
struct XftFont {
int ascent;
int descent;
int height;
int max_advance_width;
FcCharSet* charset;
FcPattern* pattern;
}
struct XftDraw;
struct XftColor {
c_ulong pixel;
XRenderColor color;
}
struct XftCharSpec {
dchar ucs4;
short x;
short y;
}
struct XftCharFontSpec {
XftFont *font;
dchar ucs4;
short x;
short y;
}
struct XftGlyphSpec {
uint glyph;
short x;
short y;
}
struct XftGlyphFontSpec {
XftFont *font;
uint glyph;
short x;
short y;
}
interface Xft {
extern(C) @nogc pure:
Bool XftColorAllocName (Display *dpy,
const Visual *visual,
Colormap cmap,
const char *name,
XftColor *result);
Bool XftColorAllocValue (Display *dpy,
Visual *visual,
Colormap cmap,
const XRenderColor *color,
XftColor *result);
void XftColorFree (Display *dpy,
Visual *visual,
Colormap cmap,
XftColor *color);
Bool XftDefaultHasRender (Display *dpy);
Bool XftDefaultSet (Display *dpy, FcPattern *defaults);
void XftDefaultSubstitute (Display *dpy, int screen, FcPattern *pattern);
XftDraw * XftDrawCreate (Display *dpy,
Drawable drawable,
Visual *visual,
Colormap colormap);
XftDraw * XftDrawCreateBitmap (Display *dpy,
Pixmap bitmap);
XftDraw * XftDrawCreateAlpha (Display *dpy,
Pixmap pixmap,
int depth);
void XftDrawChange (XftDraw *draw,
Drawable drawable);
Display * XftDrawDisplay (XftDraw *draw);
Drawable XftDrawDrawable (XftDraw *draw);
Colormap XftDrawColormap (XftDraw *draw);
Visual * XftDrawVisual (XftDraw *draw);
void XftDrawDestroy (XftDraw *draw);
Picture XftDrawPicture (XftDraw *draw);
Picture XftDrawSrcPicture (XftDraw *draw, const XftColor *color);
void XftDrawGlyphs (XftDraw *draw,
const XftColor *color,
XftFont *pub,
int x,
int y,
const uint *glyphs,
int nglyphs);
void XftDrawString8 (XftDraw *draw,
const XftColor *color,
XftFont *pub,
int x,
int y,
const char *string,
int len);
void XftDrawString16 (XftDraw *draw,
const XftColor *color,
XftFont *pub,
int x,
int y,
const wchar *string,
int len);
void XftDrawString32 (XftDraw *draw,
const XftColor *color,
XftFont *pub,
int x,
int y,
const dchar *string,
int len);
void XftDrawStringUtf8 (XftDraw *draw,
const XftColor *color,
XftFont *pub,
int x,
int y,
const char *string,
int len);
void XftDrawStringUtf16 (XftDraw *draw,
const XftColor *color,
XftFont *pub,
int x,
int y,
const char *string,
FcEndian endian,
int len);
void XftDrawCharSpec (XftDraw *draw,
const XftColor *color,
XftFont *pub,
const XftCharSpec *chars,
int len);
void XftDrawCharFontSpec (XftDraw *draw,
const XftColor *color,
const XftCharFontSpec *chars,
int len);
void XftDrawGlyphSpec (XftDraw *draw,
const XftColor *color,
XftFont *pub,
const XftGlyphSpec *glyphs,
int len);
void XftDrawGlyphFontSpec (XftDraw *draw,
const XftColor *color,
const XftGlyphFontSpec *glyphs,
int len);
void XftDrawRect (XftDraw *draw,
const XftColor *color,
int x,
int y,
uint width,
uint height);
Bool XftDrawSetClip (XftDraw *draw,
Region r);
Bool XftDrawSetClipRectangles (XftDraw *draw,
int xOrigin,
int yOrigin,
const XRectangle *rects,
int n);
void XftDrawSetSubwindowMode (XftDraw *draw,
int mode);
void XftGlyphExtents (Display *dpy,
XftFont *pub,
const uint *glyphs,
int nglyphs,
XGlyphInfo *extents);
void XftTextExtents8 (Display *dpy,
XftFont *pub,
const char *string,
int len,
XGlyphInfo *extents);
void XftTextExtents16 (Display *dpy,
XftFont *pub,
const wchar *string,
int len,
XGlyphInfo *extents);
void XftTextExtents32 (Display *dpy,
XftFont *pub,
const dchar *string,
int len,
XGlyphInfo *extents);
void XftTextExtentsUtf8 (Display *dpy,
XftFont *pub,
const char *string,
int len,
XGlyphInfo *extents);
void XftTextExtentsUtf16 (Display *dpy,
XftFont *pub,
const char *string,
FcEndian endian,
int len,
XGlyphInfo *extents);
FcPattern * XftFontMatch (Display *dpy,
int screen,
const FcPattern *pattern,
FcResult *result);
XftFont * XftFontOpen (Display *dpy, int screen, ...);
XftFont * XftFontOpenName (Display *dpy, int screen, const char *name);
XftFont * XftFontOpenXlfd (Display *dpy, int screen, const char *xlfd);
FT_Face XftLockFace (XftFont *pub);
void XftUnlockFace (XftFont *pub);
XftFontInfo * XftFontInfoCreate (Display *dpy, const FcPattern *pattern);
void XftFontInfoDestroy (Display *dpy, XftFontInfo *fi);
dchar XftFontInfoHash (const XftFontInfo *fi);
FcBool XftFontInfoEqual (const XftFontInfo *a, const XftFontInfo *b);
XftFont * XftFontOpenInfo (Display *dpy,
FcPattern *pattern,
XftFontInfo *fi);
XftFont * XftFontOpenPattern (Display *dpy, FcPattern *pattern);
XftFont * XftFontCopy (Display *dpy, XftFont *pub);
void XftFontClose (Display *dpy, XftFont *pub);
FcBool XftInitFtLibrary();
void XftFontLoadGlyphs (Display *dpy,
XftFont *pub,
FcBool need_bitmaps,
const uint *glyphs,
int nglyph);
void XftFontUnloadGlyphs (Display *dpy,
XftFont *pub,
const uint *glyphs,
int nglyph);
FcBool XftFontCheckGlyph (Display *dpy,
XftFont *pub,
FcBool need_bitmaps,
uint glyph,
uint *missing,
int *nmissing);
FcBool XftCharExists (Display *dpy,
XftFont *pub,
dchar ucs4);
uint XftCharIndex (Display *dpy,
XftFont *pub,
dchar ucs4);
FcBool XftInit (const char *config);
int XftGetVersion ();
FcFontSet * XftListFonts (Display *dpy,
int screen,
...);
FcPattern *XftNameParse (const char *name);
void XftGlyphRender (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
int x,
int y,
const uint *glyphs,
int nglyphs);
void XftGlyphSpecRender (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
const XftGlyphSpec *glyphs,
int nglyphs);
void XftCharSpecRender (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
const XftCharSpec *chars,
int len);
void XftGlyphFontSpecRender (Display *dpy,
int op,
Picture src,
Picture dst,
int srcx,
int srcy,
const XftGlyphFontSpec *glyphs,
int nglyphs);
void XftCharFontSpecRender (Display *dpy,
int op,
Picture src,
Picture dst,
int srcx,
int srcy,
const XftCharFontSpec *chars,
int len);
void XftTextRender8 (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
int x,
int y,
const char *string,
int len);
void XftTextRender16 (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
int x,
int y,
const wchar *string,
int len);
void XftTextRender16BE (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
int x,
int y,
const char *string,
int len);
void XftTextRender16LE (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
int x,
int y,
const char *string,
int len);
void XftTextRender32 (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
int x,
int y,
const dchar *string,
int len);
void XftTextRender32BE (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
int x,
int y,
const char *string,
int len);
void XftTextRender32LE (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
int x,
int y,
const char *string,
int len);
void XftTextRenderUtf8 (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
int x,
int y,
const char *string,
int len);
void XftTextRenderUtf16 (Display *dpy,
int op,
Picture src,
XftFont *pub,
Picture dst,
int srcx,
int srcy,
int x,
int y,
const char *string,
FcEndian endian,
int len);
FcPattern * XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable, Bool complete);
}
interface FontConfig {
extern(C) @nogc pure:
int FcPatternGetString(const FcPattern *p, const char *object, int n, char ** s);
void FcFontSetDestroy(FcFontSet*);
char* FcNameUnparse(const FcPattern *);
}
mixin DynamicLoad!(Xft, "Xft", 2, librariesSuccessfullyLoaded) XftLibrary;
mixin DynamicLoad!(FontConfig, "fontconfig", 1, librariesSuccessfullyLoaded) FontConfigLibrary;
/* Xft } */
class XDisconnectException : Exception {
bool userRequested;
this(bool userRequested = true) {
this.userRequested = userRequested;
super("X disconnected");
}
}
/// Platform-specific for X11. A singleton class (well, all its methods are actually static... so more like a namespace) wrapping a `Display*`.
class XDisplayConnection {
private __gshared Display* display;
private __gshared XIM xim;
private __gshared char* displayName;
private __gshared int connectionSequence_;
private __gshared bool isLocal_;
/// use this for lazy caching when reconnection
static int connectionSequenceNumber() { return connectionSequence_; }
/++
Guesses if the connection appears to be local.
History:
Added June 3, 2021
+/
static @property bool isLocal() nothrow @trusted @nogc {
return isLocal_;
}
/// Attempts recreation of state, may require application assistance
/// You MUST call this OUTSIDE the event loop. Let the exception kill the loop,
/// then call this, and if successful, reenter the loop.
static void discardAndRecreate(string newDisplayString = null) {
if(insideXEventLoop)
throw new Error("You MUST call discardAndRecreate from OUTSIDE the event loop");
// auto swnm = SimpleWindow.nativeMapping.dup; // this SHOULD be unnecessary because all simple windows are capable of handling native events, so the latter ought to do it all
auto chnenhm = CapableOfHandlingNativeEvent.nativeHandleMapping.dup;
foreach(handle; chnenhm) {
handle.discardConnectionState();
}
discardState();
if(newDisplayString !is null)
setDisplayName(newDisplayString);
auto display = get();
foreach(handle; chnenhm) {
handle.recreateAfterDisconnect();
}
}
private __gshared EventMask rootEventMask;
/++
Requests the specified input from the root window on the connection, in addition to any other request.
Since plain XSelectInput will replace the existing mask, adding input from multiple locations is tricky. This central function will combine all the masks for you.
$(WARNING it calls XSelectInput itself, which will override any other root window input you have!)
+/
static void addRootInput(EventMask mask) {
auto old = rootEventMask;
rootEventMask |= mask;
get(); // to ensure display connected
if(display !is null && rootEventMask != old)
XSelectInput(display, RootWindow(display, DefaultScreen(display)), rootEventMask);
}
static void discardState() {
freeImages();
foreach(atomPtr; interredAtoms)
*atomPtr = 0;
interredAtoms = null;
interredAtoms.assumeSafeAppend();
ScreenPainterImplementation.fontAttempted = false;
ScreenPainterImplementation.defaultfont = null;
ScreenPainterImplementation.defaultfontset = null;
Image.impl.xshmQueryCompleted = false;
Image.impl._xshmAvailable = false;
SimpleWindow.nativeMapping = null;
CapableOfHandlingNativeEvent.nativeHandleMapping = null;
// GlobalHotkeyManager
display = null;
xim = null;
}
// Do you want to know why do we need all this horrible-looking code? See comment at the bottom.
private static void createXIM () {
import core.stdc.locale : setlocale, LC_ALL;
import core.stdc.stdio : stderr, fprintf;
import core.stdc.stdlib : free;
import core.stdc.string : strdup;
static immutable string[3] mtry = [ null, "@im=local", "@im=" ];
auto olocale = strdup(setlocale(LC_ALL, null));
setlocale(LC_ALL, (sdx_isUTF8Locale ? "" : "en_US.UTF-8"));
scope(exit) { setlocale(LC_ALL, olocale); free(olocale); }
//fprintf(stderr, "opening IM...\n");
foreach (string s; mtry) {
if (s.length) XSetLocaleModifiers(s.ptr); // it's safe, as `s` is string literal
if ((xim = XOpenIM(display, null, null, null)) !is null) return;
}
fprintf(stderr, "createXIM: XOpenIM failed!\n");
}
// for X11 we will keep all XShm-allocated images in this list, so we can free 'em on connection closing.
// we'll use glibc malloc()/free(), 'cause `unregisterImage()` can be called from object dtor.
static struct ImgList {
size_t img; // class; hide it from GC
ImgList* next;
}
static __gshared ImgList* imglist = null;
static __gshared bool imglistLocked = false; // true: don't register and unregister images
static void registerImage (Image img) {
if (!imglistLocked && img !is null) {
import core.stdc.stdlib : malloc;
auto it = cast(ImgList*)malloc(ImgList.sizeof);
assert(it !is null); // do proper checks
it.img = cast(size_t)cast(void*)img;
it.next = imglist;
imglist = it;
version(sdpy_debug_xshm) { import core.stdc.stdio : printf; printf("registering image %p\n", cast(void*)img); }
}
}
static void unregisterImage (Image img) {
if (!imglistLocked && img !is null) {
import core.stdc.stdlib : free;
ImgList* prev = null;
ImgList* cur = imglist;
while (cur !is null) {
if (cur.img == cast(size_t)cast(void*)img) break; // i found her!
prev = cur;
cur = cur.next;
}
if (cur !is null) {
if (prev is null) imglist = cur.next; else prev.next = cur.next;
free(cur);
version(sdpy_debug_xshm) { import core.stdc.stdio : printf; printf("unregistering image %p\n", cast(void*)img); }
} else {
version(sdpy_debug_xshm) { import core.stdc.stdio : printf; printf("trying to unregister unknown image %p\n", cast(void*)img); }
}
}
}
static void freeImages () { // needed for discardAndRecreate
imglistLocked = true;
scope(exit) imglistLocked = false;
ImgList* cur = imglist;
ImgList* next = null;
while (cur !is null) {
import core.stdc.stdlib : free;
next = cur.next;
version(sdpy_debug_xshm) { import core.stdc.stdio : printf; printf("disposing image %p\n", cast(void*)cur.img); }
(cast(Image)cast(void*)cur.img).dispose();
free(cur);
cur = next;
}
imglist = null;
}
/// can be used to override normal handling of display name
/// from environment and/or command line
static setDisplayName(string newDisplayName) {
displayName = cast(char*) (newDisplayName ~ '\0');
}
/// resets to the default display string
static resetDisplayName() {
displayName = null;
}
///
static Display* get() {
if(display is null) {
if(!librariesSuccessfullyLoaded)
throw new Exception("Unable to load X11 client libraries");
display = XOpenDisplay(displayName);
isLocal_ = false;
connectionSequence_++;
if(display is null)
throw new Exception("Unable to open X display");
auto str = display.display_name;
// this is a bit of a hack but like if it looks like a unix socket we assume it is local
// and otherwise it probably isn't
if(str is null || (str[0] != ':' && str[0] != '/'))
isLocal_ = false;
else
isLocal_ = true;
//XSetErrorHandler(&adrlogger);
//XSynchronize(display, true);
XSetIOErrorHandler(&x11ioerrCB);
Bool sup;
XkbSetDetectableAutoRepeat(display, 1, &sup); // so we will not receive KeyRelease until key is really released
createXIM();
version(with_eventloop) {
import arsd.eventloop;
addFileEventListeners(display.fd, &eventListener, null, null);
}
}
return display;
}
extern(C)
static int x11ioerrCB(Display* dpy) {
throw new XDisconnectException(false);
}
version(with_eventloop) {
import arsd.eventloop;
static void eventListener(OsFileHandle fd) {
//this.mtLock();
//scope(exit) this.mtUnlock();
while(XPending(display))
doXNextEvent(display);
}
}
// close connection on program exit -- we need this to properly free all images
static ~this () {
// the gui thread must clean up after itself or else Xlib might deadlock
// using this flag on any thread destruction is the easiest way i know of
// (shared static this is run by the LAST thread to exit, which may not be
// the gui thread, and normal static this run by ALL threads, so we gotta check.)
if(thisIsGuiThread)
close();
}
///
static void close() {
if(display is null)
return;
version(with_eventloop) {
import arsd.eventloop;
removeFileEventListeners(display.fd);
}
// now remove all registered images to prevent shared memory leaks
freeImages();
// tbh I don't know why it is doing this but like if this happens to run
// from the other thread there's frequent hanging inside here.
if(thisIsGuiThread)
XCloseDisplay(display);
display = null;
}
}
mixin template NativeImageImplementation() {
XImage* handle;
ubyte* rawData;
XShmSegmentInfo shminfo;
__gshared bool xshmQueryCompleted;
__gshared bool _xshmAvailable;
public static @property bool xshmAvailable() {
if(!xshmQueryCompleted) {
int i1, i2, i3;
xshmQueryCompleted = true;
if(!XDisplayConnection.isLocal)
_xshmAvailable = false;
else
_xshmAvailable = XQueryExtension(XDisplayConnection.get(), "MIT-SHM", &i1, &i2, &i3) != 0;
}
return _xshmAvailable;
}
bool usingXshm;
final:
private __gshared bool xshmfailed;
void createImage(int width, int height, bool forcexshm=false, bool enableAlpha = false) {
auto display = XDisplayConnection.get();
assert(display !is null);
auto screen = DefaultScreen(display);
// it will only use shared memory for somewhat largish images,
// since otherwise we risk wasting shared memory handles on a lot of little ones
if (xshmAvailable && (forcexshm || (width > 100 && height > 100))) {
// it is possible for the query extension to return true, the DISPLAY check to pass, yet
// the actual use still fails. For example, if the program is in a container and permission denied
// on shared memory, or if it is a local thing forwarded to a remote server, etc.
//
// If it does fail, we need to detect it now, abort the xshm and fall back to core protocol.
// synchronize so preexisting buffers are clear
XSync(display, false);
xshmfailed = false;
auto oldErrorHandler = XSetErrorHandler(&XShmErrorHandler);
usingXshm = true;
handle = XShmCreateImage(
display,
DefaultVisual(display, screen),
enableAlpha ? 32: 24,
ImageFormat.ZPixmap,
null,
&shminfo,
width, height);
if(handle is null)
goto abortXshm1;
if(handle.bytes_per_line != 4 * width)
goto abortXshm2;
shminfo.shmid = shmget(IPC_PRIVATE, handle.bytes_per_line * height, IPC_CREAT | 511 /* 0777 */);
if(shminfo.shmid < 0)
goto abortXshm3;
handle.data = shminfo.shmaddr = rawData = cast(ubyte*) shmat(shminfo.shmid, null, 0);
if(rawData == cast(ubyte*) -1)
goto abortXshm4;
shminfo.readOnly = 0;
XShmAttach(display, &shminfo);
// and now to the final error check to ensure it actually worked.
XSync(display, false);
if(xshmfailed)
goto abortXshm5;
XSetErrorHandler(oldErrorHandler);
XDisplayConnection.registerImage(this);
// if I don't flush here there's a chance the dtor will run before the
// ctor and lead to a bad value X error. While this hurts the efficiency
// it is local anyway so prolly better to keep it simple
XFlush(display);
return;
abortXshm5:
shmdt(shminfo.shmaddr);
rawData = null;
abortXshm4:
shmctl(shminfo.shmid, IPC_RMID, null);
abortXshm3:
// nothing needed, the shmget failed so there's nothing to free
abortXshm2:
XDestroyImage(handle);
handle = null;
abortXshm1:
XSetErrorHandler(oldErrorHandler);
usingXshm = false;
handle = null;
shminfo = typeof(shminfo).init;
_xshmAvailable = false; // don't try again in the future
//import std.stdio; writeln("fallingback");
goto fallback;
} else {
fallback:
if (forcexshm) throw new Exception("can't create XShm Image");
// This actually needs to be malloc to avoid a double free error when XDestroyImage is called
import core.stdc.stdlib : malloc;
rawData = cast(ubyte*) malloc(width * height * 4);
handle = XCreateImage(
display,
DefaultVisual(display, screen),
enableAlpha ? 32 : 24, // bpp
ImageFormat.ZPixmap,
0, // offset
rawData,
width, height,
enableAlpha ? 32 : 8 /* FIXME */, 4 * width); // padding, bytes per line
}
}
void dispose() {
// note: this calls free(rawData) for us
if(handle) {
if (usingXshm) {
XDisplayConnection.unregisterImage(this);
if (XDisplayConnection.get()) XShmDetach(XDisplayConnection.get(), &shminfo);
}
XDestroyImage(handle);
if(usingXshm) {
shmdt(shminfo.shmaddr);
shmctl(shminfo.shmid, IPC_RMID, null);
}
handle = null;
}
}
Color getPixel(int x, int y) {
auto offset = (y * width + x) * 4;
Color c;
c.a = enableAlpha ? rawData[offset + 3] : 255;
c.b = rawData[offset + 0];
c.g = rawData[offset + 1];
c.r = rawData[offset + 2];
if(enableAlpha)
c.unPremultiply;
return c;
}
void setPixel(int x, int y, Color c) {
if(enableAlpha)
c.premultiply();
auto offset = (y * width + x) * 4;
rawData[offset + 0] = c.b;
rawData[offset + 1] = c.g;
rawData[offset + 2] = c.r;
if(enableAlpha)
rawData[offset + 3] = c.a;
}
void convertToRgbaBytes(ubyte[] where) {
assert(where.length == this.width * this.height * 4);
// if rawData had a length....
//assert(rawData.length == where.length);
for(int idx = 0; idx < where.length; idx += 4) {
where[idx + 0] = rawData[idx + 2]; // r
where[idx + 1] = rawData[idx + 1]; // g
where[idx + 2] = rawData[idx + 0]; // b
where[idx + 3] = enableAlpha ? rawData[idx + 3] : 255; // a
if(enableAlpha)
unPremultiplyRgba(where[idx .. idx + 4]);
}
}
void setFromRgbaBytes(in ubyte[] where) {
assert(where.length == this.width * this.height * 4);
// if rawData had a length....
//assert(rawData.length == where.length);
for(int idx = 0; idx < where.length; idx += 4) {
rawData[idx + 2] = where[idx + 0]; // r
rawData[idx + 1] = where[idx + 1]; // g
rawData[idx + 0] = where[idx + 2]; // b
if(enableAlpha) {
rawData[idx + 3] = where[idx + 3]; // a
premultiplyBgra(rawData[idx .. idx + 4]);
}
}
}
}
mixin template NativeSimpleWindowImplementation() {
GC gc;
Window window;
Display* display;
Pixmap buffer;
int bufferw, bufferh; // size of the buffer; can be bigger than window
XIC xic; // input context
int curHidden = 0; // counter
Cursor blankCurPtr = 0;
int cursorSequenceNumber = 0;
int warpEventCount = 0; // number of mouse movement events to eat
__gshared X11SetSelectionHandler[Atom] setSelectionHandlers;
X11GetSelectionHandler[Atom] getSelectionHandlers;
version(without_opengl) {} else
GLXContext glc;
private void fixFixedSize(bool forced=false) (int width, int height) {
if (forced || this.resizability == Resizability.fixedSize) {
//{ import core.stdc.stdio; printf("fixing size to: %dx%d\n", width, height); }
XSizeHints sh;
static if (!forced) {
c_long spr;
XGetWMNormalHints(display, window, &sh, &spr);
sh.flags |= PMaxSize | PMinSize;
} else {
sh.flags = PMaxSize | PMinSize;
}
sh.min_width = width;
sh.min_height = height;
sh.max_width = width;
sh.max_height = height;
XSetWMNormalHints(display, window, &sh);
//XFlush(display);
}
}
ScreenPainter getPainter(bool manualInvalidations) {
return ScreenPainter(this, window, manualInvalidations);
}
void move(int x, int y) {
XMoveWindow(display, window, x, y);
}
void resize(int w, int h) {
if (w < 1) w = 1;
if (h < 1) h = 1;
XResizeWindow(display, window, w, h);
// calling this now to avoid waiting for the server to
// acknowledge the resize; draws without returning to the
// event loop will thus actually work. the server's event
// btw might overrule this and resize it again
recordX11Resize(display, this, w, h);
// FIXME: do we need to set this as the opengl context to do the glViewport change?
version(without_opengl) {} else if (openglMode == OpenGlOptions.yes) glViewport(0, 0, w, h);
}
void moveResize (int x, int y, int w, int h) {
if (w < 1) w = 1;
if (h < 1) h = 1;
XMoveResizeWindow(display, window, x, y, w, h);
version(without_opengl) {} else if (openglMode == OpenGlOptions.yes) glViewport(0, 0, w, h);
}
void hideCursor () {
if (curHidden++ == 0) {
if (!blankCurPtr || cursorSequenceNumber != XDisplayConnection.connectionSequenceNumber) {
static const(char)[1] cmbmp = 0;
XColor blackcolor = { 0, 0, 0, 0, 0, 0 };
Pixmap pm = XCreateBitmapFromData(display, window, cmbmp.ptr, 1, 1);
blankCurPtr = XCreatePixmapCursor(display, pm, pm, &blackcolor, &blackcolor, 0, 0);
cursorSequenceNumber = XDisplayConnection.connectionSequenceNumber;
XFreePixmap(display, pm);
}
XDefineCursor(display, window, blankCurPtr);
}
}
void showCursor () {
if (--curHidden == 0) XUndefineCursor(display, window);
}
void warpMouse (int x, int y) {
// here i will send dummy "ignore next mouse motion" event,
// 'cause `XWarpPointer()` sends synthesised mouse motion,
// and we don't need to report it to the user (as warping is
// used when the user needs movement deltas).
//XClientMessageEvent xclient;
XEvent e;
e.xclient.type = EventType.ClientMessage;
e.xclient.window = window;
e.xclient.message_type = GetAtom!("_X11SDPY_INSMME_FLAG_EVENT_", true)(display); // let's hope nobody else will use such stupid name ;-)
e.xclient.format = 32;
e.xclient.data.l[0] = 0;
debug(x11sdpy_warp_debug) { import core.stdc.stdio : printf; printf("X11: sending \"INSMME\"...\n"); }
//{ import core.stdc.stdio : printf; printf("*X11 CLIENT: w=%u; type=%u; [0]=%u\n", cast(uint)e.xclient.window, cast(uint)e.xclient.message_type, cast(uint)e.xclient.data.l[0]); }
XSendEvent(display, window, false, EventMask.NoEventMask, /*cast(XEvent*)&xclient*/&e);
// now warp pointer...
debug(x11sdpy_warp_debug) { import core.stdc.stdio : printf; printf("X11: sending \"warp\"...\n"); }
XWarpPointer(display, None, window, 0, 0, 0, 0, x, y);
// ...and flush
debug(x11sdpy_warp_debug) { import core.stdc.stdio : printf; printf("X11: flushing...\n"); }
XFlush(display);
}
void sendDummyEvent () {
// here i will send dummy event to ping event queue
XEvent e;
e.xclient.type = EventType.ClientMessage;
e.xclient.window = window;
e.xclient.message_type = GetAtom!("_X11SDPY_DUMMY_EVENT_", true)(display); // let's hope nobody else will use such stupid name ;-)
e.xclient.format = 32;
e.xclient.data.l[0] = 0;
XSendEvent(display, window, false, EventMask.NoEventMask, /*cast(XEvent*)&xclient*/&e);
XFlush(display);
}
void setTitle(string title) {
if (title.ptr is null) title = "";
auto XA_UTF8 = XInternAtom(display, "UTF8_STRING".ptr, false);
auto XA_NETWM_NAME = XInternAtom(display, "_NET_WM_NAME".ptr, false);
XTextProperty windowName;
windowName.value = title.ptr;
windowName.encoding = XA_UTF8; //XA_STRING;
windowName.format = 8;
windowName.nitems = cast(uint)title.length;
XSetWMName(display, window, &windowName);
char[1024] namebuf = 0;
auto maxlen = namebuf.length-1;
if (maxlen > title.length) maxlen = title.length;
namebuf[0..maxlen] = title[0..maxlen];
XStoreName(display, window, namebuf.ptr);
XChangeProperty(display, window, XA_NETWM_NAME, XA_UTF8, 8, PropModeReplace, title.ptr, cast(uint)title.length);
flushGui(); // without this OpenGL windows has a LONG delay before changing title
}
string[] getTitles() {
auto XA_UTF8 = XInternAtom(display, "UTF8_STRING".ptr, false);
auto XA_NETWM_NAME = XInternAtom(display, "_NET_WM_NAME".ptr, false);
XTextProperty textProp;
if (XGetTextProperty(display, window, &textProp, XA_NETWM_NAME) != 0 || XGetWMName(display, window, &textProp) != 0) {
if ((textProp.encoding == XA_UTF8 || textProp.encoding == XA_STRING) && textProp.format == 8) {
return textProp.value[0 .. textProp.nitems].idup.split('\0');
} else
return [];
} else
return null;
}
string getTitle() {
auto titles = getTitles();
return titles.length ? titles[0] : null;
}
void setMinSize (int minwidth, int minheight) {
import core.stdc.config : c_long;
if (minwidth < 1) minwidth = 1;
if (minheight < 1) minheight = 1;
XSizeHints sh;
c_long spr;
XGetWMNormalHints(display, window, &sh, &spr);
sh.min_width = minwidth;
sh.min_height = minheight;
sh.flags |= PMinSize;
XSetWMNormalHints(display, window, &sh);
flushGui();
}
void setMaxSize (int maxwidth, int maxheight) {
import core.stdc.config : c_long;
if (maxwidth < 1) maxwidth = 1;
if (maxheight < 1) maxheight = 1;
XSizeHints sh;
c_long spr;
XGetWMNormalHints(display, window, &sh, &spr);
sh.max_width = maxwidth;
sh.max_height = maxheight;
sh.flags |= PMaxSize;
XSetWMNormalHints(display, window, &sh);
flushGui();
}
void setResizeGranularity (int granx, int grany) {
import core.stdc.config : c_long;
if (granx < 1) granx = 1;
if (grany < 1) grany = 1;
XSizeHints sh;
c_long spr;
XGetWMNormalHints(display, window, &sh, &spr);
sh.width_inc = granx;
sh.height_inc = grany;
sh.flags |= PResizeInc;
XSetWMNormalHints(display, window, &sh);
flushGui();
}
void setOpacity (uint opacity) {
arch_ulong o = opacity;
if (opacity == uint.max)
XDeleteProperty(display, window, XInternAtom(display, "_NET_WM_WINDOW_OPACITY".ptr, false));
else
XChangeProperty(display, window, XInternAtom(display, "_NET_WM_WINDOW_OPACITY".ptr, false),
XA_CARDINAL, 32, PropModeReplace, &o, 1);
}
void createWindow(int width, int height, string title, in OpenGlOptions opengl, SimpleWindow parent) {
version(without_opengl) {} else if(opengl == OpenGlOptions.yes && !openGlLibrariesSuccessfullyLoaded) throw new Exception("OpenGL libraries did not load");
display = XDisplayConnection.get();
auto screen = DefaultScreen(display);
version(without_opengl) {}
else {
if(opengl == OpenGlOptions.yes) {
GLXFBConfig fbconf = null;
XVisualInfo* vi = null;
bool useLegacy = false;
static if (SdpyIsUsingIVGLBinds) {if (glbindGetProcAddress("glHint") is null) assert(0, "GL: error loading OpenGL"); } // loads all necessary functions
if (sdpyOpenGLContextVersion != 0 && glXCreateContextAttribsARB_present()) {
int[23] visualAttribs = [
GLX_X_RENDERABLE , 1/*True*/,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_RENDER_TYPE , GLX_RGBA_BIT,
GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
GLX_RED_SIZE , 8,
GLX_GREEN_SIZE , 8,
GLX_BLUE_SIZE , 8,
GLX_ALPHA_SIZE , 8,
GLX_DEPTH_SIZE , 24,
GLX_STENCIL_SIZE , 8,
GLX_DOUBLEBUFFER , 1/*True*/,
0/*None*/,
];
int fbcount;
GLXFBConfig* fbc = glXChooseFBConfig(display, screen, visualAttribs.ptr, &fbcount);
if (fbcount == 0) {
useLegacy = true; // try to do at least something
} else {
// pick the FB config/visual with the most samples per pixel
int bestidx = -1, bestns = -1;
foreach (int fbi; 0..fbcount) {
int sb, samples;
glXGetFBConfigAttrib(display, fbc[fbi], GLX_SAMPLE_BUFFERS, &sb);
glXGetFBConfigAttrib(display, fbc[fbi], GLX_SAMPLES, &samples);
if (bestidx < 0 || sb && samples > bestns) { bestidx = fbi; bestns = samples; }
}
//{ import core.stdc.stdio; printf("found gl visual with %d samples\n", bestns); }
fbconf = fbc[bestidx];
// Be sure to free the FBConfig list allocated by glXChooseFBConfig()
XFree(fbc);
vi = cast(XVisualInfo*)glXGetVisualFromFBConfig(display, fbconf);
}
}
if (vi is null || useLegacy) {
static immutable GLint[5] attrs = [ GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None ];
vi = cast(XVisualInfo*)glXChooseVisual(display, 0, attrs.ptr);
useLegacy = true;
}
if (vi is null) throw new Exception("no open gl visual found");
XSetWindowAttributes swa;
auto root = RootWindow(display, screen);
swa.colormap = XCreateColormap(display, root, vi.visual, AllocNone);
window = XCreateWindow(display, (windowType != WindowTypes.nestedChild || parent is null) ? root : parent.impl.window,
0, 0, width, height,
0, vi.depth, 1 /* InputOutput */, vi.visual, CWColormap, &swa);
// now try to use `glXCreateContextAttribsARB()` if it's here
if (!useLegacy) {
// request fairly advanced context, even with stencil buffer!
int[9] contextAttribs = [
GLX_CONTEXT_MAJOR_VERSION_ARB, (sdpyOpenGLContextVersion>>8),
GLX_CONTEXT_MINOR_VERSION_ARB, (sdpyOpenGLContextVersion&0xff),
/*GLX_CONTEXT_PROFILE_MASK_ARB*/0x9126, (sdpyOpenGLContextCompatible ? /*GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB*/0x02 : /*GLX_CONTEXT_CORE_PROFILE_BIT_ARB*/ 0x01),
// for modern context, set "forward compatibility" flag too
(sdpyOpenGLContextCompatible ? None : /*GLX_CONTEXT_FLAGS_ARB*/ 0x2094), /*GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB*/ 0x02,
0/*None*/,
];
glc = glXCreateContextAttribsARB(display, fbconf, null, 1/*True*/, contextAttribs.ptr);
if (glc is null && sdpyOpenGLContextAllowFallback) {
sdpyOpenGLContextVersion = 0;
glc = glXCreateContext(display, vi, null, /*GL_TRUE*/1);
}
//{ import core.stdc.stdio; printf("using modern ogl v%d.%d\n", contextAttribs[1], contextAttribs[3]); }
} else {
// fallback to old GLX call
if (sdpyOpenGLContextAllowFallback || sdpyOpenGLContextVersion == 0) {
sdpyOpenGLContextVersion = 0;
glc = glXCreateContext(display, vi, null, /*GL_TRUE*/1);
}
}
// sync to ensure any errors generated are processed
XSync(display, 0/*False*/);
//{ import core.stdc.stdio; printf("ogl is here\n"); }
if(glc is null)
throw new Exception("glc");
}
}
if(opengl == OpenGlOptions.no) {
bool overrideRedirect = false;
if(windowType == WindowTypes.dropdownMenu || windowType == WindowTypes.popupMenu || windowType == WindowTypes.notification)
overrideRedirect = true;
XSetWindowAttributes swa;
swa.background_pixel = WhitePixel(display, screen);
swa.border_pixel = BlackPixel(display, screen);
swa.override_redirect = overrideRedirect;
auto root = RootWindow(display, screen);
swa.colormap = XCreateColormap(display, root, DefaultVisual(display, screen), AllocNone);
window = XCreateWindow(display, (windowType != WindowTypes.nestedChild || parent is null) ? root : parent.impl.window,
0, 0, width, height,
0, CopyFromParent, 1 /* InputOutput */, cast(Visual*) CopyFromParent, CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, &swa);
/*
window = XCreateSimpleWindow(
display,
parent is null ? RootWindow(display, screen) : parent.impl.window,
0, 0, // x, y
width, height,
1, // border width
BlackPixel(display, screen), // border
WhitePixel(display, screen)); // background
*/
buffer = XCreatePixmap(display, cast(Drawable) window, width, height, DefaultDepthOfDisplay(display));
bufferw = width;
bufferh = height;
gc = DefaultGC(display, screen);
// clear out the buffer to get us started...
XSetForeground(display, gc, WhitePixel(display, screen));
XFillRectangle(display, cast(Drawable) buffer, gc, 0, 0, width, height);
XSetForeground(display, gc, BlackPixel(display, screen));
}
// input context
//TODO: create this only for top-level windows, and reuse that?
if (XDisplayConnection.xim !is null) {
xic = XCreateIC(XDisplayConnection.xim,
/*XNInputStyle*/"inputStyle".ptr, XIMPreeditNothing|XIMStatusNothing,
/*XNClientWindow*/"clientWindow".ptr, window,
/*XNFocusWindow*/"focusWindow".ptr, window,
null);
if (xic is null) {
import core.stdc.stdio : stderr, fprintf;
fprintf(stderr, "XCreateIC failed for window %u\n", cast(uint)window);
}
}
if (sdpyWindowClassStr is null) loadBinNameToWindowClassName();
if (sdpyWindowClassStr is null) sdpyWindowClass = "DSimpleWindow";
// window class
if (sdpyWindowClassStr !is null && sdpyWindowClassStr[0]) {
//{ import core.stdc.stdio; printf("winclass: [%s]\n", sdpyWindowClassStr); }
XClassHint klass;
XWMHints wh;
XSizeHints size;
klass.res_name = sdpyWindowClassStr;
klass.res_class = sdpyWindowClassStr;
XSetWMProperties(display, window, null, null, null, 0, &size, &wh, &klass);
}
setTitle(title);
SimpleWindow.nativeMapping[window] = this;
CapableOfHandlingNativeEvent.nativeHandleMapping[window] = this;
// This gives our window a close button
if (windowType != WindowTypes.eventOnly) {
// FIXME: actually implement the WM_TAKE_FOCUS correctly
//Atom[2] atoms = [GetAtom!"WM_DELETE_WINDOW"(display), GetAtom!"WM_TAKE_FOCUS"(display)];
Atom[1] atoms = [GetAtom!"WM_DELETE_WINDOW"(display)];
XSetWMProtocols(display, window, atoms.ptr, cast(int) atoms.length);
}
// FIXME: windowType and customizationFlags
Atom[8] wsatoms; // here, due to goto
int wmsacount = 0; // here, due to goto
try
final switch(windowType) {
case WindowTypes.normal:
setNetWMWindowType(GetAtom!"_NET_WM_WINDOW_TYPE_NORMAL"(display));
break;
case WindowTypes.undecorated:
motifHideDecorations();
setNetWMWindowType(GetAtom!"_NET_WM_WINDOW_TYPE_NORMAL"(display));
break;
case WindowTypes.eventOnly:
_hidden = true;
XSelectInput(display, window, EventMask.StructureNotifyMask); // without this, we won't get destroy notification
goto hiddenWindow;
//break;
case WindowTypes.nestedChild:
// handled in XCreateWindow calls
break;
case WindowTypes.dropdownMenu:
motifHideDecorations();
setNetWMWindowType(GetAtom!"_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"(display));
customizationFlags |= WindowFlags.skipTaskbar | WindowFlags.alwaysOnTop;
break;
case WindowTypes.popupMenu:
motifHideDecorations();
setNetWMWindowType(GetAtom!"_NET_WM_WINDOW_TYPE_POPUP_MENU"(display));
customizationFlags |= WindowFlags.skipTaskbar | WindowFlags.alwaysOnTop;
break;
case WindowTypes.notification:
motifHideDecorations();
setNetWMWindowType(GetAtom!"_NET_WM_WINDOW_TYPE_NOTIFICATION"(display));
customizationFlags |= WindowFlags.skipTaskbar | WindowFlags.alwaysOnTop;
break;
/+
case WindowTypes.menu:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_MENU"(display);
motifHideDecorations();
break;
case WindowTypes.desktop:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_DESKTOP"(display);
break;
case WindowTypes.dock:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_DOCK"(display);
break;
case WindowTypes.toolbar:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_TOOLBAR"(display);
break;
case WindowTypes.menu:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_MENU"(display);
break;
case WindowTypes.utility:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_UTILITY"(display);
break;
case WindowTypes.splash:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_SPLASH"(display);
break;
case WindowTypes.dialog:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_DIALOG"(display);
break;
case WindowTypes.tooltip:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_TOOLTIP"(display);
break;
case WindowTypes.notification:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_NOTIFICATION"(display);
break;
case WindowTypes.combo:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_COMBO"(display);
break;
case WindowTypes.dnd:
atoms[0] = GetAtom!"_NET_WM_WINDOW_TYPE_DND"(display);
break;
+/
}
catch(Exception e) {
// XInternAtom failed, prolly a WM
// that doesn't support these things
}
if (customizationFlags&WindowFlags.skipTaskbar) wsatoms[wmsacount++] = GetAtom!("_NET_WM_STATE_SKIP_TASKBAR", true)(display);
// the two following flags may be ignored by WM
if (customizationFlags&WindowFlags.alwaysOnTop) wsatoms[wmsacount++] = GetAtom!("_NET_WM_STATE_ABOVE", true)(display);
if (customizationFlags&WindowFlags.alwaysOnBottom) wsatoms[wmsacount++] = GetAtom!("_NET_WM_STATE_BELOW", true)(display);
if (wmsacount != 0) XChangeProperty(display, window, GetAtom!("_NET_WM_STATE", true)(display), XA_ATOM, 32 /* bits */,0 /*PropModeReplace*/, wsatoms.ptr, wmsacount);
if (this.resizability == Resizability.fixedSize || (opengl == OpenGlOptions.no && this.resizability != Resizability.allowResizing)) fixFixedSize!true(width, height);
// What would be ideal here is if they only were
// selected if there was actually an event handler
// for them...
selectDefaultInput((customizationFlags & WindowFlags.alwaysRequestMouseMotionEvents)?true:false);
hiddenWindow:
// set the pid property for lookup later by window managers
// a standard convenience
import core.sys.posix.unistd;
arch_ulong pid = getpid();
XChangeProperty(
display,
impl.window,
GetAtom!("_NET_WM_PID", true)(display),
XA_CARDINAL,
32 /* bits */,
0 /*PropModeReplace*/,
&pid,
1);
if(isTransient && parent) { // customizationFlags & WindowFlags.transient) {
if(parent is null) assert(0);
XChangeProperty(
display,
impl.window,
GetAtom!("WM_TRANSIENT_FOR", true)(display),
XA_WINDOW,
32 /* bits */,
0 /*PropModeReplace*/,
&parent.impl.window,
1);
}
if(windowType != WindowTypes.eventOnly && (customizationFlags&WindowFlags.dontAutoShow) == 0) {
XMapWindow(display, window);
} else {
_hidden = true;
}
}
void selectDefaultInput(bool forceIncludeMouseMotion) {
auto mask = EventMask.ExposureMask |
EventMask.KeyPressMask |
EventMask.KeyReleaseMask |
EventMask.PropertyChangeMask |
EventMask.FocusChangeMask |
EventMask.StructureNotifyMask |
EventMask.VisibilityChangeMask
| EventMask.ButtonPressMask
| EventMask.ButtonReleaseMask
;
// xshm is our shortcut for local connections
if(XDisplayConnection.isLocal || forceIncludeMouseMotion)
mask |= EventMask.PointerMotionMask;
else
mask |= EventMask.ButtonMotionMask;
XSelectInput(display, window, mask);
}
void setNetWMWindowType(Atom type) {
Atom[2] atoms;
atoms[0] = type;
// generic fallback
atoms[1] = GetAtom!"_NET_WM_WINDOW_TYPE_NORMAL"(display);
XChangeProperty(
display,
impl.window,
GetAtom!"_NET_WM_WINDOW_TYPE"(display),
XA_ATOM,
32 /* bits */,
0 /*PropModeReplace*/,
atoms.ptr,
cast(int) atoms.length);
}
void motifHideDecorations(bool hide = true) {
MwmHints hints;
hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = hide ? 0 : 1;
XChangeProperty(
display,
impl.window,
GetAtom!"_MOTIF_WM_HINTS"(display),
GetAtom!"_MOTIF_WM_HINTS"(display),
32 /* bits */,
0 /*PropModeReplace*/,
&hints,
hints.sizeof / 4);
}
/*k8: unused
void createOpenGlContext() {
}
*/
void closeWindow() {
// I can't close this or a child window closing will
// break events for everyone. So I'm just leaking it right
// now and that is probably perfectly fine...
version(none)
if (customEventFDRead != -1) {
import core.sys.posix.unistd : close;
auto same = customEventFDRead == customEventFDWrite;
close(customEventFDRead);
if(!same)
close(customEventFDWrite);
customEventFDRead = -1;
customEventFDWrite = -1;
}
if(buffer)
XFreePixmap(display, buffer);
bufferw = bufferh = 0;
if (blankCurPtr && cursorSequenceNumber == XDisplayConnection.connectionSequenceNumber) XFreeCursor(display, blankCurPtr);
XDestroyWindow(display, window);
XFlush(display);
}
void dispose() {
}
bool destroyed = false;
}
bool insideXEventLoop;
}
version(X11) {
int mouseDoubleClickTimeout = 350; /// Double click timeout. X only, you probably shouldn't change this.
void recordX11Resize(Display* display, SimpleWindow win, int width, int height) {
if(width != win.width || height != win.height) {
win._width = width;
win._height = height;
if(win.openglMode == OpenGlOptions.no) {
// FIXME: could this be more efficient?
if (win.bufferw < width || win.bufferh < height) {
//{ import core.stdc.stdio; printf("new buffer; old size: %dx%d; new size: %dx%d\n", win.bufferw, win.bufferh, cast(int)width, cast(int)height); }
// grow the internal buffer to match the window...
auto newPixmap = XCreatePixmap(display, cast(Drawable) win.window, width, height, DefaultDepthOfDisplay(display));
{
GC xgc = XCreateGC(win.display, cast(Drawable)win.window, 0, null);
XCopyGC(win.display, win.gc, 0xffffffff, xgc);
scope(exit) XFreeGC(win.display, xgc);
XSetClipMask(win.display, xgc, None);
XSetForeground(win.display, xgc, 0);
XFillRectangle(display, cast(Drawable)newPixmap, xgc, 0, 0, width, height);
}
XCopyArea(display,
cast(Drawable) win.buffer,
cast(Drawable) newPixmap,
win.gc, 0, 0,
win.bufferw < width ? win.bufferw : win.width,
win.bufferh < height ? win.bufferh : win.height,
0, 0);
XFreePixmap(display, win.buffer);
win.buffer = newPixmap;
win.bufferw = width;
win.bufferh = height;
}
// clear unused parts of the buffer
if (win.bufferw > width || win.bufferh > height) {
GC xgc = XCreateGC(win.display, cast(Drawable)win.window, 0, null);
XCopyGC(win.display, win.gc, 0xffffffff, xgc);
scope(exit) XFreeGC(win.display, xgc);
XSetClipMask(win.display, xgc, None);
XSetForeground(win.display, xgc, 0);
immutable int maxw = (win.bufferw > width ? win.bufferw : width);
immutable int maxh = (win.bufferh > height ? win.bufferh : height);
XFillRectangle(win.display, cast(Drawable)win.buffer, xgc, width, 0, maxw, maxh); // let X11 do clipping
XFillRectangle(win.display, cast(Drawable)win.buffer, xgc, 0, height, maxw, maxh); // let X11 do clipping
}
}
version(without_opengl) {} else
if(win.openglMode == OpenGlOptions.yes && win.resizability == Resizability.automaticallyScaleIfPossible) {
glViewport(0, 0, width, height);
}
win.fixFixedSize(width, height); //k8: this does nothing on my FluxBox; wtf?!
if(win.windowResized !is null) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
win.windowResized(width, height);
}
}
}
/// Platform-specific, you might use it when doing a custom event loop.
bool doXNextEvent(Display* display) {
bool done;
XEvent e;
XNextEvent(display, &e);
version(sddddd) {
import std.stdio, std.conv : to;
if(auto win = e.xany.window in CapableOfHandlingNativeEvent.nativeHandleMapping) {
if(typeid(cast(Object) *win) == NotificationAreaIcon.classinfo)
writeln("event for: ", e.xany.window, "; type is ", to!string(cast(EventType)e.type));
}
}
// filter out compose events
if (XFilterEvent(&e, None)) {
//{ import core.stdc.stdio : printf; printf("XFilterEvent filtered!\n"); }
//NOTE: we should ungrab keyboard here, but simpledisplay doesn't use keyboard grabbing (yet)
return false;
}
// process keyboard mapping changes
if (e.type == EventType.KeymapNotify) {
//{ import core.stdc.stdio : printf; printf("KeymapNotify processed!\n"); }
XRefreshKeyboardMapping(&e.xmapping);
return false;
}
version(with_eventloop)
import arsd.eventloop;
if(SimpleWindow.handleNativeGlobalEvent !is null) {
// see windows impl's comments
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
auto ret = SimpleWindow.handleNativeGlobalEvent(e);
if(ret == 0)
return done;
}
if(auto win = e.xany.window in CapableOfHandlingNativeEvent.nativeHandleMapping) {
if(win.getNativeEventHandler !is null) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
auto ret = win.getNativeEventHandler()(e);
if(ret == 0)
return done;
}
}
if(xrrEventBase != -1 && e.type == xrrEventBase + RRScreenChangeNotify) {
if(auto win = e.xany.window in SimpleWindow.nativeMapping) {
// we get this because of the RRScreenChangeNotifyMask
// this isn't actually an ideal way to do it since it wastes time
// but meh it is simple and it works.
win.actualDpiLoadAttempted = false;
SimpleWindow.xRandrInfoLoadAttemped = false;
win.updateActualDpi(); // trigger a reload
}
}
switch(e.type) {
case EventType.SelectionClear:
if(auto win = e.xselectionclear.window in SimpleWindow.nativeMapping) {
// FIXME so it is supposed to finish any in progress transfers... but idk...
//import std.stdio; writeln("SelectionClear");
SimpleWindow.impl.setSelectionHandlers.remove(e.xselectionclear.selection);
}
break;
case EventType.SelectionRequest:
if(auto win = e.xselectionrequest.owner in SimpleWindow.nativeMapping)
if(auto ssh = e.xselectionrequest.selection in SimpleWindow.impl.setSelectionHandlers) {
// import std.stdio; printf("SelectionRequest %s\n", XGetAtomName(e.xselectionrequest.display, e.xselectionrequest.target));
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
(*ssh).handleRequest(e);
}
break;
case EventType.PropertyNotify:
// import std.stdio; printf("PropertyNotify %s %d\n", XGetAtomName(e.xproperty.display, e.xproperty.atom), e.xproperty.state);
foreach(ssh; SimpleWindow.impl.setSelectionHandlers) {
if(ssh.matchesIncr(e.xproperty.window, e.xproperty.atom) && e.xproperty.state == PropertyNotification.PropertyDelete)
ssh.sendMoreIncr(&e.xproperty);
}
if(auto win = e.xproperty.window in SimpleWindow.nativeMapping)
if(auto handler = e.xproperty.atom in win.getSelectionHandlers) {
if(handler.matchesIncr(e.xproperty.window, e.xproperty.atom) && e.xproperty.state == PropertyNotification.PropertyNewValue) {
Atom target;
int format;
arch_ulong bytesafter, length;
void* value;
ubyte[] s;
Atom targetToKeep;
XGetWindowProperty(
e.xproperty.display,
e.xproperty.window,
e.xproperty.atom,
0,
100000 /* length */,
true, /* erase it to signal we got it and want more */
0 /*AnyPropertyType*/,
&target, &format, &length, &bytesafter, &value);
if(!targetToKeep)
targetToKeep = target;
auto id = (cast(ubyte*) value)[0 .. length];
handler.handleIncrData(targetToKeep, id);
XFree(value);
}
}
break;
case EventType.SelectionNotify:
if(auto win = e.xselection.requestor in SimpleWindow.nativeMapping)
if(auto handler = e.xproperty.atom in win.getSelectionHandlers) {
if(e.xselection.property == None) { // || e.xselection.property == GetAtom!("NULL", true)(e.xselection.display)) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
handler.handleData(None, null);
} else {
Atom target;
int format;
arch_ulong bytesafter, length;
void* value;
XGetWindowProperty(
e.xselection.display,
e.xselection.requestor,
e.xselection.property,
0,
100000 /* length */,
//false, /* don't erase it */
true, /* do erase it lol */
0 /*AnyPropertyType*/,
&target, &format, &length, &bytesafter, &value);
// FIXME: I don't have to copy it now since it is in char[] instead of string
{
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
if(target == XA_ATOM) {
// initial request, see what they are able to work with and request the best one
// we can handle, if available
Atom[] answer = (cast(Atom*) value)[0 .. length];
Atom best = handler.findBestFormat(answer);
/+
writeln("got ", answer);
foreach(a; answer)
printf("%s\n", XGetAtomName(display, a));
writeln("best ", best);
+/
if(best != None) {
// actually request the best format
XConvertSelection(e.xselection.display, e.xselection.selection, best, GetAtom!("SDD_DATA", true)(display), e.xselection.requestor, 0 /*CurrentTime*/);
}
} else if(target == GetAtom!"INCR"(display)) {
// incremental
handler.prepareIncremental(e.xselection.requestor, e.xselection.property);
// signal the sending program that we see
// the incr and are ready to receive more.
XDeleteProperty(
e.xselection.display,
e.xselection.requestor,
e.xselection.property);
} else {
// unsupported type... maybe, forward
handler.handleData(target, cast(ubyte[]) value[0 .. length]);
}
}
XFree(value);
/*
XDeleteProperty(
e.xselection.display,
e.xselection.requestor,
e.xselection.property);
*/
}
}
break;
case EventType.ConfigureNotify:
auto event = e.xconfigure;
if(auto win = event.window in SimpleWindow.nativeMapping) {
//version(sdddd) { import std.stdio; writeln(" w=", event.width, "; h=", event.height); }
win.screenPositionX = event.x;
win.screenPositionY = event.y;
win.updateActualDpi();
recordX11Resize(display, *win, event.width, event.height);
}
break;
case EventType.Expose:
if(auto win = e.xexpose.window in SimpleWindow.nativeMapping) {
// if it is closing from a popup menu, it can get
// an Expose event right by the end and trigger a
// BadDrawable error ... we'll just check
// closed to handle that.
if((*win).closed) break;
if((*win).openglMode == OpenGlOptions.no) {
bool doCopy = true;// e.xexpose.count == 0; // the count is better if we copy all area but meh
if (win.handleExpose !is null) doCopy = !win.handleExpose(e.xexpose.x, e.xexpose.y, e.xexpose.width, e.xexpose.height, e.xexpose.count);
if (doCopy) XCopyArea(display, cast(Drawable) (*win).buffer, cast(Drawable) (*win).window, (*win).gc, e.xexpose.x, e.xexpose.y, e.xexpose.width, e.xexpose.height, e.xexpose.x, e.xexpose.y);
} else {
// need to redraw the scene somehow
if(e.xexpose.count == 0) { // only do the last one since redrawOpenGlSceneNow always does it all
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
version(without_opengl) {} else
win.redrawOpenGlSceneSoon();
}
}
}
break;
case EventType.FocusIn:
case EventType.FocusOut:
if(auto win = e.xfocus.window in SimpleWindow.nativeMapping) {
if (win.xic !is null) {
//{ import core.stdc.stdio : printf; printf("XIC focus change!\n"); }
if (e.type == EventType.FocusIn) XSetICFocus(win.xic); else XUnsetICFocus(win.xic);
}
win._focused = e.type == EventType.FocusIn;
if(win.demandingAttention)
demandAttention(*win, false);
if(win.onFocusChange) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
win.onFocusChange(e.type == EventType.FocusIn);
}
}
break;
case EventType.VisibilityNotify:
if(auto win = e.xfocus.window in SimpleWindow.nativeMapping) {
if (e.xvisibility.state == VisibilityNotify.VisibilityFullyObscured) {
if (win.visibilityChanged !is null) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
win.visibilityChanged(false);
}
} else {
if (win.visibilityChanged !is null) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
win.visibilityChanged(true);
}
}
}
break;
case EventType.ClientMessage:
if (e.xclient.message_type == GetAtom!("_X11SDPY_INSMME_FLAG_EVENT_", true)(e.xany.display)) {
// "ignore next mouse motion" event, increment ignore counter for teh window
if (auto win = e.xclient.window in SimpleWindow.nativeMapping) {
++(*win).warpEventCount;
debug(x11sdpy_warp_debug) { import core.stdc.stdio : printf; printf("X11: got \"INSMME\" message, new count=%d\n", (*win).warpEventCount); }
} else {
debug(x11sdpy_warp_debug) { import core.stdc.stdio : printf; printf("X11: got \"INSMME\" WTF?!!\n"); }
}
} else if(e.xclient.data.l[0] == GetAtom!"WM_DELETE_WINDOW"(e.xany.display)) {
// user clicked the close button on the window manager
if(auto win = e.xclient.window in SimpleWindow.nativeMapping) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
if ((*win).closeQuery !is null) (*win).closeQuery(); else (*win).close();
}
} else if(e.xclient.data.l[0] == GetAtom!"WM_TAKE_FOCUS"(e.xany.display)) {
import std.stdio; writeln("HAPPENED");
// user clicked the close button on the window manager
if(auto win = e.xclient.window in SimpleWindow.nativeMapping) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
// FIXME: so this is actually supposed to focus to a relevant child window if appropriate
XSetInputFocus(display, e.xclient.window, RevertToParent, e.xclient.data.l[1]);
}
} else if(e.xclient.message_type == GetAtom!"MANAGER"(e.xany.display)) {
foreach(nai; NotificationAreaIcon.activeIcons)
nai.newManager();
} else if(auto win = e.xclient.window in SimpleWindow.nativeMapping) {
bool xDragWindow = true;
if(xDragWindow && e.xclient.message_type == GetAtom!"XdndStatus"(e.xany.display)) {
//XDefineCursor(display, xDragWindow.impl.window,
//import std.stdio; writeln("XdndStatus ", e.xclient.data.l);
}
if(auto dh = win.dropHandler) {
static Atom[3] xFormatsBuffer;
static Atom[] xFormats;
void resetXFormats() {
xFormatsBuffer[] = 0;
xFormats = xFormatsBuffer[];
}
if(e.xclient.message_type == GetAtom!"XdndEnter"(e.xany.display)) {
// on Windows it is supposed to return the effect you actually do FIXME
auto sourceWindow = e.xclient.data.l[0];
xFormatsBuffer[0] = e.xclient.data.l[2];
xFormatsBuffer[1] = e.xclient.data.l[3];
xFormatsBuffer[2] = e.xclient.data.l[4];
if(e.xclient.data.l[1] & 1) {
// can just grab it all but like we don't necessarily need them...
xFormats = cast(Atom[]) getX11PropertyData(sourceWindow, GetAtom!"XdndTypeList"(display), XA_ATOM);
} else {
int len;
foreach(fmt; xFormatsBuffer)
if(fmt) len++;
xFormats = xFormatsBuffer[0 .. len];
}
auto pkg = DropPackage(*win, e.xclient.data.l[0], 0, xFormats);
dh.dragEnter(&pkg);
} else if(e.xclient.message_type == GetAtom!"XdndPosition"(e.xany.display)) {
auto pack = e.xclient.data.l[2];
auto result = dh.dragOver(Point((pack & 0xffff0000) >> 16, pack & 0xffff)); // FIXME: translate screen coordinates back to window coords
XClientMessageEvent xclient;
xclient.type = EventType.ClientMessage;
xclient.window = e.xclient.data.l[0];
xclient.message_type = GetAtom!"XdndStatus"(display);
xclient.format = 32;
xclient.data.l[0] = win.impl.window;
xclient.data.l[1] = (result.action != DragAndDropAction.none) ? 1 : 0; // will accept
auto r = result.consistentWithin;
xclient.data.l[2] = ((cast(short) r.left) << 16) | (cast(short) r.top);
xclient.data.l[3] = ((cast(short) r.width) << 16) | (cast(short) r.height);
xclient.data.l[4] = dndActionAtom(e.xany.display, result.action);
XSendEvent(
display,
e.xclient.data.l[0],
false,
EventMask.NoEventMask,
cast(XEvent*) &xclient
);
} else if(e.xclient.message_type == GetAtom!"XdndLeave"(e.xany.display)) {
//import std.stdio; writeln("XdndLeave");
// drop cancelled.
// data.l[0] is the source window
dh.dragLeave();
resetXFormats();
} else if(e.xclient.message_type == GetAtom!"XdndDrop"(e.xany.display)) {
// drop happening, should fetch data, then send finished
//import std.stdio; writeln("XdndDrop");
auto pkg = DropPackage(*win, e.xclient.data.l[0], e.xclient.data.l[2], xFormats);
dh.drop(&pkg);
resetXFormats();
} else if(e.xclient.message_type == GetAtom!"XdndFinished"(e.xany.display)) {
// import std.stdio; writeln("XdndFinished");
dh.finish();
}
}
}
break;
case EventType.MapNotify:
if(auto win = e.xmap.window in SimpleWindow.nativeMapping) {
(*win)._visible = true;
if (!(*win)._visibleForTheFirstTimeCalled) {
(*win)._visibleForTheFirstTimeCalled = true;
if ((*win).visibleForTheFirstTime !is null) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
version(without_opengl) {} else {
if((*win).openglMode == OpenGlOptions.yes) {
(*win).setAsCurrentOpenGlContextNT();
glViewport(0, 0, (*win).width, (*win).height);
}
}
(*win).visibleForTheFirstTime();
}
}
if ((*win).visibilityChanged !is null) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
(*win).visibilityChanged(true);
}
}
break;
case EventType.UnmapNotify:
if(auto win = e.xunmap.window in SimpleWindow.nativeMapping) {
win._visible = false;
if (win.visibilityChanged !is null) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
win.visibilityChanged(false);
}
}
break;
case EventType.DestroyNotify:
if(auto win = e.xdestroywindow.window in SimpleWindow.nativeMapping) {
if (win.onDestroyed !is null) try { win.onDestroyed(); } catch (Exception e) {} // sorry
win._closed = true; // just in case
win.destroyed = true;
if (win.xic !is null) {
XDestroyIC(win.xic);
win.xic = null; // just in calse
}
SimpleWindow.nativeMapping.remove(e.xdestroywindow.window);
bool anyImportant = false;
foreach(SimpleWindow w; SimpleWindow.nativeMapping)
if(w.beingOpenKeepsAppOpen) {
anyImportant = true;
break;
}
if(!anyImportant) {
EventLoop.quitApplication();
done = true;
}
}
auto window = e.xdestroywindow.window;
if(window in CapableOfHandlingNativeEvent.nativeHandleMapping)
CapableOfHandlingNativeEvent.nativeHandleMapping.remove(window);
version(with_eventloop) {
if(done) exit();
}
break;
case EventType.MotionNotify:
MouseEvent mouse;
auto event = e.xmotion;
mouse.type = MouseEventType.motion;
mouse.x = event.x;
mouse.y = event.y;
mouse.modifierState = event.state;
mouse.timestamp = event.time;
if(auto win = e.xmotion.window in SimpleWindow.nativeMapping) {
mouse.window = *win;
if (win.warpEventCount > 0) {
debug(x11sdpy_warp_debug) { import core.stdc.stdio : printf; printf("X11: got \"warp motion\" message, current count=%d\n", (*win).warpEventCount); }
--(*win).warpEventCount;
(*win).mdx(mouse); // so deltas will be correctly updated
} else {
win.warpEventCount = 0; // just in case
(*win).mdx(mouse);
if((*win).handleMouseEvent) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
(*win).handleMouseEvent(mouse);
}
}
}
version(with_eventloop)
send(mouse);
break;
case EventType.ButtonPress:
case EventType.ButtonRelease:
MouseEvent mouse;
auto event = e.xbutton;
mouse.timestamp = event.time;
mouse.type = cast(MouseEventType) (e.type == EventType.ButtonPress ? 1 : 2);
mouse.x = event.x;
mouse.y = event.y;
static Time lastMouseDownTime = 0;
mouse.doubleClick = e.type == EventType.ButtonPress && (event.time - lastMouseDownTime) < mouseDoubleClickTimeout;
if(e.type == EventType.ButtonPress) lastMouseDownTime = event.time;
switch(event.button) {
case 1: mouse.button = MouseButton.left; break; // left
case 2: mouse.button = MouseButton.middle; break; // middle
case 3: mouse.button = MouseButton.right; break; // right
case 4: mouse.button = MouseButton.wheelUp; break; // scroll up
case 5: mouse.button = MouseButton.wheelDown; break; // scroll down
case 6: break; // idk
case 7: break; // idk
case 8: mouse.button = MouseButton.backButton; break;
case 9: mouse.button = MouseButton.forwardButton; break;
default:
}
// FIXME: double check this
mouse.modifierState = event.state;
//mouse.modifierState = event.detail;
if(auto win = e.xbutton.window in SimpleWindow.nativeMapping) {
mouse.window = *win;
(*win).mdx(mouse);
if((*win).handleMouseEvent) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
(*win).handleMouseEvent(mouse);
}
}
version(with_eventloop)
send(mouse);
break;
case EventType.KeyPress:
case EventType.KeyRelease:
//if (e.type == EventType.KeyPress) { import core.stdc.stdio : stderr, fprintf; fprintf(stderr, "X11 keyboard event!\n"); }
KeyEvent ke;
ke.pressed = e.type == EventType.KeyPress;
ke.hardwareCode = cast(ubyte) e.xkey.keycode;
auto sym = XKeycodeToKeysym(
XDisplayConnection.get(),
e.xkey.keycode,
0);
ke.key = cast(Key) sym;//e.xkey.keycode;
ke.modifierState = e.xkey.state;
// import std.stdio; writefln("%x", sym);
wchar_t[128] charbuf = void; // buffer for XwcLookupString; composed value can consist of many chars!
int charbuflen = 0; // return value of XwcLookupString
if (ke.pressed) {
auto win = e.xkey.window in SimpleWindow.nativeMapping;
if (win !is null && win.xic !is null) {
//{ import core.stdc.stdio : printf; printf("using xic!\n"); }
Status status;
charbuflen = XwcLookupString(win.xic, &e.xkey, charbuf.ptr, cast(int)charbuf.length, &sym, &status);
//{ import core.stdc.stdio : printf; printf("charbuflen=%d\n", charbuflen); }
} else {
//{ import core.stdc.stdio : printf; printf("NOT using xic!\n"); }
// If XIM initialization failed, don't process intl chars. Sorry, boys and girls.
char[16] buffer;
auto res = XLookupString(&e.xkey, buffer.ptr, buffer.length, null, null);
if (res && buffer[0] < 128) charbuf[charbuflen++] = cast(wchar_t)buffer[0];
}
}
// if there's no char, subst one
if (charbuflen == 0) {
switch (sym) {
case 0xff09: charbuf[charbuflen++] = '\t'; break;
case 0xff8d: // keypad enter
case 0xff0d: charbuf[charbuflen++] = '\n'; break;
default : // ignore
}
}
if (auto win = e.xkey.window in SimpleWindow.nativeMapping) {
ke.window = *win;
if(win.inputProxy)
win = &win.inputProxy;
// char events are separate since they are on Windows too
// also, xcompose can generate long char sequences
// don't send char events if Meta and/or Hyper is pressed
// TODO: ctrl+char should only send control chars; not yet
if ((e.xkey.state&ModifierState.ctrl) != 0) {
if (charbuflen > 1 || charbuf[0] >= ' ') charbuflen = 0;
}
dchar[32] charsComingBuffer;
int charsComingPosition;
dchar[] charsComing = charsComingBuffer[];
if (ke.pressed && charbuflen > 0) {
// FIXME: I think Windows sends these on releases... we should try to match that, but idk about repeats.
foreach (immutable dchar ch; charbuf[0..charbuflen]) {
if(charsComingPosition >= charsComing.length)
charsComing.length = charsComingPosition + 8;
charsComing[charsComingPosition++] = ch;
}
charsComing = charsComing[0 .. charsComingPosition];
} else {
charsComing = null;
}
ke.charsPossible = charsComing;
if (win.handleKeyEvent) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
win.handleKeyEvent(ke);
}
// Super and alt modifier keys never actually send the chars, they are assumed to be special.
if ((e.xkey.state&(ModifierState.alt|ModifierState.windows)) == 0 && win.handleCharEvent) {
XUnlockDisplay(display);
scope(exit) XLockDisplay(display);
foreach(ch; charsComing)
win.handleCharEvent(ch);
}
}
version(with_eventloop)
send(ke);
break;
default:
}
return done;
}
}
/* *************************************** */
/* Done with simpledisplay stuff */
/* *************************************** */
// Necessary C library bindings follow
version(Windows) {} else
version(X11) {
extern(C) int eventfd (uint initval, int flags) nothrow @trusted @nogc;
// X11 bindings needed here
/*
A little of this is from the bindings project on
D Source and some of it is copy/paste from the C
header.
The DSource listing consistently used D's long
where C used long. That's wrong - C long is 32 bit, so
it should be int in D. I changed that here.
Note:
This isn't complete, just took what I needed for myself.
*/
import core.stdc.stddef : wchar_t;
interface XLib {
extern(C) nothrow @nogc {
char* XResourceManagerString(Display*);
void XrmInitialize();
XrmDatabase XrmGetStringDatabase(char* data);
bool XrmGetResource(XrmDatabase, const char*, const char*, char**, XrmValue*);
Cursor XCreateFontCursor(Display*, uint shape);
int XDefineCursor(Display* display, Window w, Cursor cursor);
int XUndefineCursor(Display* display, Window w);
Pixmap XCreateBitmapFromData(Display* display, Drawable d, const(char)* data, uint width, uint height);
Cursor XCreatePixmapCursor(Display* display, Pixmap source, Pixmap mask, XColor* foreground_color, XColor* background_color, uint x, uint y);
int XFreeCursor(Display* display, Cursor cursor);
int XLookupString(XKeyEvent *event_struct, char *buffer_return, int bytes_buffer, KeySym *keysym_return, void *status_in_out);
int XwcLookupString(XIC ic, XKeyPressedEvent* event, wchar_t* buffer_return, int wchars_buffer, KeySym* keysym_return, Status* status_return);
char *XKeysymToString(KeySym keysym);
KeySym XKeycodeToKeysym(
Display* /* display */,
KeyCode /* keycode */,
int /* index */
);
int XConvertSelection(Display *display, Atom selection, Atom target, Atom property, Window requestor, Time time);
int XFree(void*);
int XDeleteProperty(Display *display, Window w, Atom property);
int XChangeProperty(Display *display, Window w, Atom property, Atom type, int format, int mode, in void *data, int nelements);
int XGetWindowProperty(Display *display, Window w, Atom property, arch_long
long_offset, arch_long long_length, Bool del, Atom req_type, Atom
*actual_type_return, int *actual_format_return, arch_ulong
*nitems_return, arch_ulong *bytes_after_return, void** prop_return);
Atom* XListProperties(Display *display, Window w, int *num_prop_return);
Status XGetTextProperty(Display *display, Window w, XTextProperty *text_prop_return, Atom property);
Status XQueryTree(Display *display, Window w, Window *root_return, Window *parent_return, Window **children_return, uint *nchildren_return);
int XSetSelectionOwner(Display *display, Atom selection, Window owner, Time time);
Window XGetSelectionOwner(Display *display, Atom selection);
XVisualInfo* XGetVisualInfo(Display*, c_long, XVisualInfo*, int*);
char** XListFonts(Display*, const char*, int, int*);
void XFreeFontNames(char**);
Display* XOpenDisplay(const char*);
int XCloseDisplay(Display*);
int XSynchronize(Display*, bool);
Bool XQueryExtension(Display*, const char*, int*, int*, int*);
Bool XSupportsLocale();
char* XSetLocaleModifiers(const(char)* modifier_list);
XOM XOpenOM(Display* display, _XrmHashBucketRec* rdb, const(char)* res_name, const(char)* res_class);
Status XCloseOM(XOM om);
XIM XOpenIM(Display* dpy, _XrmHashBucketRec* rdb, const(char)* res_name, const(char)* res_class);
Status XCloseIM(XIM im);
char* XGetIMValues(XIM im, ...) /*_X_SENTINEL(0)*/;
char* XSetIMValues(XIM im, ...) /*_X_SENTINEL(0)*/;
Display* XDisplayOfIM(XIM im);
char* XLocaleOfIM(XIM im);
XIC XCreateIC(XIM im, ...) /*_X_SENTINEL(0)*/;
void XDestroyIC(XIC ic);
void XSetICFocus(XIC ic);
void XUnsetICFocus(XIC ic);
//wchar_t* XwcResetIC(XIC ic);
char* XmbResetIC(XIC ic);
char* Xutf8ResetIC(XIC ic);
char* XSetICValues(XIC ic, ...) /*_X_SENTINEL(0)*/;
char* XGetICValues(XIC ic, ...) /*_X_SENTINEL(0)*/;
XIM XIMOfIC(XIC ic);
uint XSendEvent(Display* display, Window w, Bool propagate, arch_long event_mask, XEvent* event_send);
XFontStruct *XLoadQueryFont(Display *display, in char *name);
int XFreeFont(Display *display, XFontStruct *font_struct);
int XSetFont(Display* display, GC gc, Font font);
int XTextWidth(XFontStruct*, in char*, int);
int XSetLineAttributes(Display *display, GC gc, uint line_width, int line_style, int cap_style, int join_style);
int XSetDashes(Display *display, GC gc, int dash_offset, in byte* dash_list, int n);
Window XCreateSimpleWindow(
Display* /* display */,
Window /* parent */,
int /* x */,
int /* y */,
uint /* width */,
uint /* height */,
uint /* border_width */,
uint /* border */,
uint /* background */
);
Window XCreateWindow(Display *display, Window parent, int x, int y, uint width, uint height, uint border_width, int depth, uint class_, Visual *visual, arch_ulong valuemask, XSetWindowAttributes *attributes);
int XReparentWindow(Display*, Window, Window, int, int);
int XClearWindow(Display*, Window);
int XMoveResizeWindow(Display*, Window, int, int, uint, uint);
int XMoveWindow(Display*, Window, int, int);
int XResizeWindow(Display *display, Window w, uint width, uint height);
Colormap XCreateColormap(Display *display, Window w, Visual *visual, int alloc);
Status XGetWindowAttributes(Display*, Window, XWindowAttributes*);
XImage *XCreateImage(
Display* /* display */,
Visual* /* visual */,
uint /* depth */,
int /* format */,
int /* offset */,
ubyte* /* data */,
uint /* width */,
uint /* height */,
int /* bitmap_pad */,
int /* bytes_per_line */
);
Status XInitImage (XImage* image);
Atom XInternAtom(
Display* /* display */,
const char* /* atom_name */,
Bool /* only_if_exists */
);
Status XInternAtoms(Display*, const char**, int, Bool, Atom*);
char* XGetAtomName(Display*, Atom);
Status XGetAtomNames(Display*, Atom*, int count, char**);
int XPutImage(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
XImage* /* image */,
int /* src_x */,
int /* src_y */,
int /* dest_x */,
int /* dest_y */,
uint /* width */,
uint /* height */
);
XImage *XGetImage(Display *display, Drawable d, int x, int y, uint width, uint height, c_ulong plane_mask, int format);
int XDestroyWindow(
Display* /* display */,
Window /* w */
);
int XDestroyImage(XImage*);
int XSelectInput(
Display* /* display */,
Window /* w */,
EventMask /* event_mask */
);
int XMapWindow(
Display* /* display */,
Window /* w */
);
Status XIconifyWindow(Display*, Window, int);
int XMapRaised(Display*, Window);
int XMapSubwindows(Display*, Window);
int XNextEvent(
Display* /* display */,
XEvent* /* event_return */
);
int XMaskEvent(Display*, arch_long, XEvent*);
Bool XFilterEvent(XEvent *event, Window window);
int XRefreshKeyboardMapping(XMappingEvent *event_map);
Status XSetWMProtocols(
Display* /* display */,
Window /* w */,
Atom* /* protocols */,
int /* count */
);
void XSetWMNormalHints(Display *display, Window w, XSizeHints *hints);
Status XGetWMNormalHints(Display *display, Window w, XSizeHints *hints, c_long* supplied_return);
Status XInitThreads();
void XLockDisplay (Display* display);
void XUnlockDisplay (Display* display);
void XSetWMProperties(Display*, Window, XTextProperty*, XTextProperty*, char**, int, XSizeHints*, XWMHints*, XClassHint*);
int XSetWindowBackground (Display* display, Window w, c_ulong background_pixel);
int XSetWindowBackgroundPixmap (Display* display, Window w, Pixmap background_pixmap);
//int XSetWindowBorder (Display* display, Window w, c_ulong border_pixel);
//int XSetWindowBorderPixmap (Display* display, Window w, Pixmap border_pixmap);
//int XSetWindowBorderWidth (Display* display, Window w, uint width);
// check out Xft too: http://www.keithp.com/~keithp/render/Xft.tutorial
int XDrawString(Display*, Drawable, GC, int, int, in char*, int);
int XDrawLine(Display*, Drawable, GC, int, int, int, int);
int XDrawRectangle(Display*, Drawable, GC, int, int, uint, uint);
int XDrawArc(Display*, Drawable, GC, int, int, uint, uint, int, int);
int XFillRectangle(Display*, Drawable, GC, int, int, uint, uint);
int XFillArc(Display*, Drawable, GC, int, int, uint, uint, int, int);
int XDrawPoint(Display*, Drawable, GC, int, int);
int XSetForeground(Display*, GC, uint);
int XSetBackground(Display*, GC, uint);
XFontSet XCreateFontSet(Display*, const char*, char***, int*, char**);
void XFreeFontSet(Display*, XFontSet);
void Xutf8DrawString(Display*, Drawable, XFontSet, GC, int, int, in char*, int);
void Xutf8DrawText(Display*, Drawable, GC, int, int, XmbTextItem*, int);
int Xutf8TextExtents(XFontSet font_set, const char *, int num_bytes, XRectangle *overall_ink_return, XRectangle *overall_logical_return);
//Status Xutf8TextPerCharExtents(XFontSet font_set, char *string, int num_bytes, XRectangle *ink_array_return, XRectangle *logical_array_return, int array_size, int *num_chars_return, XRectangle *overall_ink_return, XRectangle *overall_logical_return);
void XDrawText(Display*, Drawable, GC, int, int, XTextItem*, int);
int XSetFunction(Display*, GC, int);
GC XCreateGC(Display*, Drawable, uint, void*);
int XCopyGC(Display*, GC, uint, GC);
int XFreeGC(Display*, GC);
bool XCheckWindowEvent(Display*, Window, int, XEvent*);
bool XCheckMaskEvent(Display*, int, XEvent*);
int XPending(Display*);
int XEventsQueued(Display* display, int mode);
Pixmap XCreatePixmap(Display*, Drawable, uint, uint, uint);
int XFreePixmap(Display*, Pixmap);
int XCopyArea(Display*, Drawable, Drawable, GC, int, int, uint, uint, int, int);
int XFlush(Display*);
int XBell(Display*, int);
int XSync(Display*, bool);
int XGrabKey (Display* display, int keycode, uint modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode);
int XUngrabKey (Display* display, int keycode, uint modifiers, Window grab_window);
KeyCode XKeysymToKeycode (Display* display, KeySym keysym);
KeySym XStringToKeysym(const char *string);
Bool XCheckTypedEvent(Display *display, int event_type, XEvent *event_return);
Window XDefaultRootWindow(Display*);
int XGrabButton(Display *display, uint button, uint modifiers, Window grab_window, Bool owner_events, uint event_mask, int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor);
int XUngrabButton(Display *display, uint button, uint modifiers, Window grab_window);
int XDrawLines(Display*, Drawable, GC, XPoint*, int, CoordMode);
int XFillPolygon(Display*, Drawable, GC, XPoint*, int, PolygonShape, CoordMode);
Status XAllocColor(Display*, Colormap, XColor*);
int XWithdrawWindow(Display*, Window, int);
int XUnmapWindow(Display*, Window);
int XLowerWindow(Display*, Window);
int XRaiseWindow(Display*, Window);
int XWarpPointer(Display *display, Window src_w, Window dest_w, int src_x, int src_y, uint src_width, uint src_height, int dest_x, int dest_y);
Bool XTranslateCoordinates(Display *display, Window src_w, Window dest_w, int src_x, int src_y, int *dest_x_return, int *dest_y_return, Window *child_return);
int XGetInputFocus(Display*, Window*, int*);
int XSetInputFocus(Display*, Window, int, Time);
XErrorHandler XSetErrorHandler(XErrorHandler);
int XGetErrorText(Display*, int, char*, int);
Bool XkbSetDetectableAutoRepeat(Display* dpy, Bool detectable, Bool* supported);
int XGrabPointer(Display *display, Window grab_window, Bool owner_events, uint event_mask, int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time);
int XUngrabPointer(Display *display, Time time);
int XChangeActivePointerGrab(Display *display, uint event_mask, Cursor cursor, Time time);
int XCopyPlane(Display*, Drawable, Drawable, GC, int, int, uint, uint, int, int, arch_ulong);
Status XGetGeometry(Display*, Drawable, Window*, int*, int*, uint*, uint*, uint*, uint*);
int XSetClipMask(Display*, GC, Pixmap);
int XSetClipOrigin(Display*, GC, int, int);
void XSetClipRectangles(Display*, GC, int, int, XRectangle*, int, int);
void XSetWMName(Display*, Window, XTextProperty*);
Status XGetWMName(Display*, Window, XTextProperty*);
int XStoreName(Display* display, Window w, const(char)* window_name);
XIOErrorHandler XSetIOErrorHandler (XIOErrorHandler handler);
}
}
interface Xext {
extern(C) nothrow @nogc {
Status XShmAttach(Display*, XShmSegmentInfo*);
Status XShmDetach(Display*, XShmSegmentInfo*);
Status XShmPutImage(
Display* /* dpy */,
Drawable /* d */,
GC /* gc */,
XImage* /* image */,
int /* src_x */,
int /* src_y */,
int /* dst_x */,
int /* dst_y */,
uint /* src_width */,
uint /* src_height */,
Bool /* send_event */
);
Status XShmQueryExtension(Display*);
XImage *XShmCreateImage(
Display* /* dpy */,
Visual* /* visual */,
uint /* depth */,
int /* format */,
char* /* data */,
XShmSegmentInfo* /* shminfo */,
uint /* width */,
uint /* height */
);
Pixmap XShmCreatePixmap(
Display* /* dpy */,
Drawable /* d */,
char* /* data */,
XShmSegmentInfo* /* shminfo */,
uint /* width */,
uint /* height */,
uint /* depth */
);
}
}
// this requires -lXpm
//int XpmCreatePixmapFromData(Display*, Drawable, in char**, Pixmap*, Pixmap*, void*); // FIXME: void* should be XpmAttributes
mixin DynamicLoad!(XLib, "X11", 6, librariesSuccessfullyLoaded) xlib;
mixin DynamicLoad!(Xext, "Xext", 6, librariesSuccessfullyLoaded) xext;
shared static this() {
xlib.loadDynamicLibrary();
xext.loadDynamicLibrary();
}
extern(C) nothrow @nogc {
alias XrmDatabase = void*;
struct XrmValue {
uint size;
void* addr;
}
struct XVisualInfo {
Visual* visual;
VisualID visualid;
int screen;
uint depth;
int c_class;
c_ulong red_mask;
c_ulong green_mask;
c_ulong blue_mask;
int colormap_size;
int bits_per_rgb;
}
enum VisualNoMask= 0x0;
enum VisualIDMask= 0x1;
enum VisualScreenMask=0x2;
enum VisualDepthMask= 0x4;
enum VisualClassMask= 0x8;
enum VisualRedMaskMask=0x10;
enum VisualGreenMaskMask=0x20;
enum VisualBlueMaskMask=0x40;
enum VisualColormapSizeMask=0x80;
enum VisualBitsPerRGBMask=0x100;
enum VisualAllMask= 0x1FF;
// XIM and other crap
struct _XOM {}
struct _XIM {}
struct _XIC {}
alias XOM = _XOM*;
alias XIM = _XIM*;
alias XIC = _XIC*;
alias XIMStyle = arch_ulong;
enum : arch_ulong {
XIMPreeditArea = 0x0001,
XIMPreeditCallbacks = 0x0002,
XIMPreeditPosition = 0x0004,
XIMPreeditNothing = 0x0008,
XIMPreeditNone = 0x0010,
XIMStatusArea = 0x0100,
XIMStatusCallbacks = 0x0200,
XIMStatusNothing = 0x0400,
XIMStatusNone = 0x0800,
}
/* X Shared Memory Extension functions */
//pragma(lib, "Xshm");
alias arch_ulong ShmSeg;
struct XShmSegmentInfo {
ShmSeg shmseg;
int shmid;
ubyte* shmaddr;
Bool readOnly;
}
// and the necessary OS functions
int shmget(int, size_t, int);
void* shmat(int, in void*, int);
int shmdt(in void*);
int shmctl (int shmid, int cmd, void* ptr /*struct shmid_ds *buf*/);
enum IPC_PRIVATE = 0;
enum IPC_CREAT = 512;
enum IPC_RMID = 0;
/* MIT-SHM end */
enum MappingType:int {
MappingModifier =0,
MappingKeyboard =1,
MappingPointer =2
}
/* ImageFormat -- PutImage, GetImage */
enum ImageFormat:int {
XYBitmap =0, /* depth 1, XYFormat */
XYPixmap =1, /* depth == drawable depth */
ZPixmap =2 /* depth == drawable depth */
}
enum ModifierName:int {
ShiftMapIndex =0,
LockMapIndex =1,
ControlMapIndex =2,
Mod1MapIndex =3,
Mod2MapIndex =4,
Mod3MapIndex =5,
Mod4MapIndex =6,
Mod5MapIndex =7
}
enum ButtonMask:int {
Button1Mask =1<<8,
Button2Mask =1<<9,
Button3Mask =1<<10,
Button4Mask =1<<11,
Button5Mask =1<<12,
AnyModifier =1<<15/* used in GrabButton, GrabKey */
}
enum KeyOrButtonMask:uint {
ShiftMask =1<<0,
LockMask =1<<1,
ControlMask =1<<2,
Mod1Mask =1<<3,
Mod2Mask =1<<4,
Mod3Mask =1<<5,
Mod4Mask =1<<6,
Mod5Mask =1<<7,
Button1Mask =1<<8,
Button2Mask =1<<9,
Button3Mask =1<<10,
Button4Mask =1<<11,
Button5Mask =1<<12,
AnyModifier =1<<15/* used in GrabButton, GrabKey */
}
enum ButtonName:int {
Button1 =1,
Button2 =2,
Button3 =3,
Button4 =4,
Button5 =5
}
/* Notify modes */
enum NotifyModes:int
{
NotifyNormal =0,
NotifyGrab =1,
NotifyUngrab =2,
NotifyWhileGrabbed =3
}
enum NotifyHint = 1; /* for MotionNotify events */
/* Notify detail */
enum NotifyDetail:int
{
NotifyAncestor =0,
NotifyVirtual =1,
NotifyInferior =2,
NotifyNonlinear =3,
NotifyNonlinearVirtual =4,
NotifyPointer =5,
NotifyPointerRoot =6,
NotifyDetailNone =7
}
/* Visibility notify */
enum VisibilityNotify:int
{
VisibilityUnobscured =0,
VisibilityPartiallyObscured =1,
VisibilityFullyObscured =2
}
enum WindowStackingMethod:int
{
Above =0,
Below =1,
TopIf =2,
BottomIf =3,
Opposite =4
}
/* Circulation request */
enum CirculationRequest:int
{
PlaceOnTop =0,
PlaceOnBottom =1
}
enum PropertyNotification:int
{
PropertyNewValue =0,
PropertyDelete =1
}
enum ColorMapNotification:int
{
ColormapUninstalled =0,
ColormapInstalled =1
}
struct _XPrivate {}
struct _XrmHashBucketRec {}
alias void* XPointer;
alias void* XExtData;
version( X86_64 ) {
alias ulong XID;
alias ulong arch_ulong;
alias long arch_long;
} else version (AArch64) {
alias ulong XID;
alias ulong arch_ulong;
alias long arch_long;
} else {
alias uint XID;
alias uint arch_ulong;
alias int arch_long;
}
alias XID Window;
alias XID Drawable;
alias XID Pixmap;
alias arch_ulong Atom;
alias int Bool;
alias Display XDisplay;
alias int ByteOrder;
alias arch_ulong Time;
alias void ScreenFormat;
struct XImage {
int width, height; /* size of image */
int xoffset; /* number of pixels offset in X direction */
ImageFormat format; /* XYBitmap, XYPixmap, ZPixmap */
void *data; /* pointer to image data */
ByteOrder byte_order; /* data byte order, LSBFirst, MSBFirst */
int bitmap_unit; /* quant. of scanline 8, 16, 32 */
int bitmap_bit_order; /* LSBFirst, MSBFirst */
int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */
int depth; /* depth of image */
int bytes_per_line; /* accelarator to next line */
int bits_per_pixel; /* bits per pixel (ZPixmap) */
arch_ulong red_mask; /* bits in z arrangment */
arch_ulong green_mask;
arch_ulong blue_mask;
XPointer obdata; /* hook for the object routines to hang on */
static struct F { /* image manipulation routines */
XImage* function(
XDisplay* /* display */,
Visual* /* visual */,
uint /* depth */,
int /* format */,
int /* offset */,
ubyte* /* data */,
uint /* width */,
uint /* height */,
int /* bitmap_pad */,
int /* bytes_per_line */) create_image;
int function(XImage *) destroy_image;
arch_ulong function(XImage *, int, int) get_pixel;
int function(XImage *, int, int, arch_ulong) put_pixel;
XImage* function(XImage *, int, int, uint, uint) sub_image;
int function(XImage *, arch_long) add_pixel;
}
F f;
}
version(X86_64) static assert(XImage.sizeof == 136);
else version(X86) static assert(XImage.sizeof == 88);
struct XCharStruct {
short lbearing; /* origin to left edge of raster */
short rbearing; /* origin to right edge of raster */
short width; /* advance to next char's origin */
short ascent; /* baseline to top edge of raster */
short descent; /* baseline to bottom edge of raster */
ushort attributes; /* per char flags (not predefined) */
}
/*
* To allow arbitrary information with fonts, there are additional properties
* returned.
*/
struct XFontProp {
Atom name;
arch_ulong card32;
}
alias Atom Font;
struct XFontStruct {
XExtData *ext_data; /* Hook for extension to hang data */
Font fid; /* Font ID for this font */
uint direction; /* Direction the font is painted */
uint min_char_or_byte2; /* First character */
uint max_char_or_byte2; /* Last character */
uint min_byte1; /* First row that exists (for two-byte fonts) */
uint max_byte1; /* Last row that exists (for two-byte fonts) */
Bool all_chars_exist; /* Flag if all characters have nonzero size */
uint default_char; /* Char to print for undefined character */
int n_properties; /* How many properties there are */
XFontProp *properties; /* Pointer to array of additional properties*/
XCharStruct min_bounds; /* Minimum bounds over all existing char*/
XCharStruct max_bounds; /* Maximum bounds over all existing char*/
XCharStruct *per_char; /* first_char to last_char information */
int ascent; /* Max extent above baseline for spacing */
int descent; /* Max descent below baseline for spacing */
}
/*
* Definitions of specific events.
*/
struct XKeyEvent
{
int type; /* of event */
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window it is reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
KeyOrButtonMask state; /* key or button mask */
uint keycode; /* detail */
Bool same_screen; /* same screen flag */
}
version(X86_64) static assert(XKeyEvent.sizeof == 96);
alias XKeyEvent XKeyPressedEvent;
alias XKeyEvent XKeyReleasedEvent;
struct XButtonEvent
{
int type; /* of event */
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window it is reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
KeyOrButtonMask state; /* key or button mask */
uint button; /* detail */
Bool same_screen; /* same screen flag */
}
alias XButtonEvent XButtonPressedEvent;
alias XButtonEvent XButtonReleasedEvent;
struct XMotionEvent{
int type; /* of event */
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
KeyOrButtonMask state; /* key or button mask */
byte is_hint; /* detail */
Bool same_screen; /* same screen flag */
}
alias XMotionEvent XPointerMovedEvent;
struct XCrossingEvent{
int type; /* of event */
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
NotifyModes mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
NotifyDetail detail;
/*
* NotifyAncestor, NotifyVirtual, NotifyInferior,
* NotifyNonlinear,NotifyNonlinearVirtual
*/
Bool same_screen; /* same screen flag */
Bool focus; /* Boolean focus */
KeyOrButtonMask state; /* key or button mask */
}
alias XCrossingEvent XEnterWindowEvent;
alias XCrossingEvent XLeaveWindowEvent;
struct XFocusChangeEvent{
int type; /* FocusIn or FocusOut */
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* window of event */
NotifyModes mode; /* NotifyNormal, NotifyWhileGrabbed,
NotifyGrab, NotifyUngrab */
NotifyDetail detail;
/*
* NotifyAncestor, NotifyVirtual, NotifyInferior,
* NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
* NotifyPointerRoot, NotifyDetailNone
*/
}
alias XFocusChangeEvent XFocusInEvent;
alias XFocusChangeEvent XFocusOutEvent;
enum CWBackPixmap = (1L<<0);
enum CWBackPixel = (1L<<1);
enum CWBorderPixmap = (1L<<2);
enum CWBorderPixel = (1L<<3);
enum CWBitGravity = (1L<<4);
enum CWWinGravity = (1L<<5);
enum CWBackingStore = (1L<<6);
enum CWBackingPlanes = (1L<<7);
enum CWBackingPixel = (1L<<8);
enum CWOverrideRedirect = (1L<<9);
enum CWSaveUnder = (1L<<10);
enum CWEventMask = (1L<<11);
enum CWDontPropagate = (1L<<12);
enum CWColormap = (1L<<13);
enum CWCursor = (1L<<14);
struct XWindowAttributes {
int x, y; /* location of window */
int width, height; /* width and height of window */
int border_width; /* border width of window */
int depth; /* depth of window */
Visual *visual; /* the associated visual structure */
Window root; /* root of screen containing window */
int class_; /* InputOutput, InputOnly*/
int bit_gravity; /* one of the bit gravity values */
int win_gravity; /* one of the window gravity values */
int backing_store; /* NotUseful, WhenMapped, Always */
arch_ulong backing_planes; /* planes to be preserved if possible */
arch_ulong backing_pixel; /* value to be used when restoring planes */
Bool save_under; /* boolean, should bits under be saved? */
Colormap colormap; /* color map to be associated with window */
Bool map_installed; /* boolean, is color map currently installed*/
int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
arch_long all_event_masks; /* set of events all people have interest in*/
arch_long your_event_mask; /* my event mask */
arch_long do_not_propagate_mask; /* set of events that should not propagate */
Bool override_redirect; /* boolean value for override-redirect */
Screen *screen; /* back pointer to correct screen */
}
enum IsUnmapped = 0;
enum IsUnviewable = 1;
enum IsViewable = 2;
struct XSetWindowAttributes {
Pixmap background_pixmap;/* background, None, or ParentRelative */
arch_ulong background_pixel;/* background pixel */
Pixmap border_pixmap; /* border of the window or CopyFromParent */
arch_ulong border_pixel;/* border pixel value */
int bit_gravity; /* one of bit gravity values */
int win_gravity; /* one of the window gravity values */
int backing_store; /* NotUseful, WhenMapped, Always */
arch_ulong backing_planes;/* planes to be preserved if possible */
arch_ulong backing_pixel;/* value to use in restoring planes */
Bool save_under; /* should bits under be saved? (popups) */
arch_long event_mask; /* set of events that should be saved */
arch_long do_not_propagate_mask;/* set of events that should not propagate */
Bool override_redirect; /* boolean value for override_redirect */
Colormap colormap; /* color map to be associated with window */
Cursor cursor; /* cursor to be displayed (or None) */
}
alias int Status;
enum EventMask:int
{
NoEventMask =0,
KeyPressMask =1<<0,
KeyReleaseMask =1<<1,
ButtonPressMask =1<<2,
ButtonReleaseMask =1<<3,
EnterWindowMask =1<<4,
LeaveWindowMask =1<<5,
PointerMotionMask =1<<6,
PointerMotionHintMask =1<<7,
Button1MotionMask =1<<8,
Button2MotionMask =1<<9,
Button3MotionMask =1<<10,
Button4MotionMask =1<<11,
Button5MotionMask =1<<12,
ButtonMotionMask =1<<13,
KeymapStateMask =1<<14,
ExposureMask =1<<15,
VisibilityChangeMask =1<<16,
StructureNotifyMask =1<<17,
ResizeRedirectMask =1<<18,
SubstructureNotifyMask =1<<19,
SubstructureRedirectMask=1<<20,
FocusChangeMask =1<<21,
PropertyChangeMask =1<<22,
ColormapChangeMask =1<<23,
OwnerGrabButtonMask =1<<24
}
struct MwmHints {
c_ulong flags;
c_ulong functions;
c_ulong decorations;
c_long input_mode;
c_ulong status;
}
enum {
MWM_HINTS_FUNCTIONS = (1L << 0),
MWM_HINTS_DECORATIONS = (1L << 1),
MWM_FUNC_ALL = (1L << 0),
MWM_FUNC_RESIZE = (1L << 1),
MWM_FUNC_MOVE = (1L << 2),
MWM_FUNC_MINIMIZE = (1L << 3),
MWM_FUNC_MAXIMIZE = (1L << 4),
MWM_FUNC_CLOSE = (1L << 5),
MWM_DECOR_ALL = (1L << 0),
MWM_DECOR_BORDER = (1L << 1),
MWM_DECOR_RESIZEH = (1L << 2),
MWM_DECOR_TITLE = (1L << 3),
MWM_DECOR_MENU = (1L << 4),
MWM_DECOR_MINIMIZE = (1L << 5),
MWM_DECOR_MAXIMIZE = (1L << 6),
}
import core.stdc.config : c_long, c_ulong;
/* Size hints mask bits */
enum USPosition = (1L << 0) /* user specified x, y */;
enum USSize = (1L << 1) /* user specified width, height */;
enum PPosition = (1L << 2) /* program specified position */;
enum PSize = (1L << 3) /* program specified size */;
enum PMinSize = (1L << 4) /* program specified minimum size */;
enum PMaxSize = (1L << 5) /* program specified maximum size */;
enum PResizeInc = (1L << 6) /* program specified resize increments */;
enum PAspect = (1L << 7) /* program specified min and max aspect ratios */;
enum PBaseSize = (1L << 8);
enum PWinGravity = (1L << 9);
enum PAllHints = (PPosition|PSize| PMinSize|PMaxSize| PResizeInc|PAspect);
struct XSizeHints {
arch_long flags; /* marks which fields in this structure are defined */
int x, y; /* Obsolete */
int width, height; /* Obsolete */
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
struct Aspect {
int x; /* numerator */
int y; /* denominator */
}
Aspect min_aspect;
Aspect max_aspect;
int base_width, base_height;
int win_gravity;
/* this structure may be extended in the future */
}
enum EventType:int
{
KeyPress =2,
KeyRelease =3,
ButtonPress =4,
ButtonRelease =5,
MotionNotify =6,
EnterNotify =7,
LeaveNotify =8,
FocusIn =9,
FocusOut =10,
KeymapNotify =11,
Expose =12,
GraphicsExpose =13,
NoExpose =14,
VisibilityNotify =15,
CreateNotify =16,
DestroyNotify =17,
UnmapNotify =18,
MapNotify =19,
MapRequest =20,
ReparentNotify =21,
ConfigureNotify =22,
ConfigureRequest =23,
GravityNotify =24,
ResizeRequest =25,
CirculateNotify =26,
CirculateRequest =27,
PropertyNotify =28,
SelectionClear =29,
SelectionRequest =30,
SelectionNotify =31,
ColormapNotify =32,
ClientMessage =33,
MappingNotify =34,
LASTEvent =35 /* must be bigger than any event # */
}
/* generated on EnterWindow and FocusIn when KeyMapState selected */
struct XKeymapEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
byte[32] key_vector;
}
struct XExposeEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
int x, y;
int width, height;
int count; /* if non-zero, at least this many more */
}
struct XGraphicsExposeEvent{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Drawable drawable;
int x, y;
int width, height;
int count; /* if non-zero, at least this many more */
int major_code; /* core is CopyArea or CopyPlane */
int minor_code; /* not defined in the core */
}
struct XNoExposeEvent{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Drawable drawable;
int major_code; /* core is CopyArea or CopyPlane */
int minor_code; /* not defined in the core */
}
struct XVisibilityEvent{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
VisibilityNotify state; /* Visibility state */
}
struct XCreateWindowEvent{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window parent; /* parent of the window */
Window window; /* window id of window created */
int x, y; /* window location */
int width, height; /* size of window */
int border_width; /* border width */
Bool override_redirect; /* creation should be overridden */
}
struct XDestroyWindowEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
}
struct XUnmapEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
Bool from_configure;
}
struct XMapEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
Bool override_redirect; /* Boolean, is override set... */
}
struct XMapRequestEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window parent;
Window window;
}
struct XReparentEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
Window parent;
int x, y;
Bool override_redirect;
}
struct XConfigureEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
int x, y;
int width, height;
int border_width;
Window above;
Bool override_redirect;
}
struct XGravityEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
int x, y;
}
struct XResizeRequestEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
int width, height;
}
struct XConfigureRequestEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window parent;
Window window;
int x, y;
int width, height;
int border_width;
Window above;
WindowStackingMethod detail; /* Above, Below, TopIf, BottomIf, Opposite */
arch_ulong value_mask;
}
struct XCirculateEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
CirculationRequest place; /* PlaceOnTop, PlaceOnBottom */
}
struct XCirculateRequestEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window parent;
Window window;
CirculationRequest place; /* PlaceOnTop, PlaceOnBottom */
}
struct XPropertyEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
Atom atom;
Time time;
PropertyNotification state; /* NewValue, Deleted */
}
struct XSelectionClearEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
Atom selection;
Time time;
}
struct XSelectionRequestEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window owner;
Window requestor;
Atom selection;
Atom target;
Atom property;
Time time;
}
struct XSelectionEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window requestor;
Atom selection;
Atom target;
Atom property; /* ATOM or None */
Time time;
}
version(X86_64) static assert(XSelectionClearEvent.sizeof == 56);
struct XColormapEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
Colormap colormap; /* COLORMAP or None */
Bool new_; /* C++ */
ColorMapNotification state; /* ColormapInstalled, ColormapUninstalled */
}
version(X86_64) static assert(XColormapEvent.sizeof == 56);
struct XClientMessageEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
Atom message_type;
int format;
union Data{
byte[20] b;
short[10] s;
arch_ulong[5] l;
}
Data data;
}
version(X86_64) static assert(XClientMessageEvent.sizeof == 96);
struct XMappingEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* unused */
MappingType request; /* one of MappingModifier, MappingKeyboard,
MappingPointer */
int first_keycode; /* first keycode */
int count; /* defines range of change w. first_keycode*/
}
struct XErrorEvent
{
int type;
Display *display; /* Display the event was read from */
XID resourceid; /* resource id */
arch_ulong serial; /* serial number of failed request */
ubyte error_code; /* error code of failed request */
ubyte request_code; /* Major op-code of failed request */
ubyte minor_code; /* Minor op-code of failed request */
}
struct XAnyEvent
{
int type;
arch_ulong serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display;/* Display the event was read from */
Window window; /* window on which event was requested in event mask */
}
union XEvent{
int type; /* must not be changed; first element */
XAnyEvent xany;
XKeyEvent xkey;
XButtonEvent xbutton;
XMotionEvent xmotion;
XCrossingEvent xcrossing;
XFocusChangeEvent xfocus;
XExposeEvent xexpose;
XGraphicsExposeEvent xgraphicsexpose;
XNoExposeEvent xnoexpose;
XVisibilityEvent xvisibility;
XCreateWindowEvent xcreatewindow;
XDestroyWindowEvent xdestroywindow;
XUnmapEvent xunmap;
XMapEvent xmap;
XMapRequestEvent xmaprequest;
XReparentEvent xreparent;
XConfigureEvent xconfigure;
XGravityEvent xgravity;
XResizeRequestEvent xresizerequest;
XConfigureRequestEvent xconfigurerequest;
XCirculateEvent xcirculate;
XCirculateRequestEvent xcirculaterequest;
XPropertyEvent xproperty;
XSelectionClearEvent xselectionclear;
XSelectionRequestEvent xselectionrequest;
XSelectionEvent xselection;
XColormapEvent xcolormap;
XClientMessageEvent xclient;
XMappingEvent xmapping;
XErrorEvent xerror;
XKeymapEvent xkeymap;
arch_ulong[24] pad;
}
struct Display {
XExtData *ext_data; /* hook for extension to hang data */
_XPrivate *private1;
int fd; /* Network socket. */
int private2;
int proto_major_version;/* major version of server's X protocol */
int proto_minor_version;/* minor version of servers X protocol */
char *vendor; /* vendor of the server hardware */
XID private3;
XID private4;
XID private5;
int private6;
XID function(Display*)resource_alloc;/* allocator function */
ByteOrder byte_order; /* screen byte order, LSBFirst, MSBFirst */
int bitmap_unit; /* padding and data requirements */
int bitmap_pad; /* padding requirements on bitmaps */
ByteOrder bitmap_bit_order; /* LeastSignificant or MostSignificant */
int nformats; /* number of pixmap formats in list */
ScreenFormat *pixmap_format; /* pixmap format list */
int private8;
int release; /* release of the server */
_XPrivate *private9;
_XPrivate *private10;
int qlen; /* Length of input event queue */
arch_ulong last_request_read; /* seq number of last event read */
arch_ulong request; /* sequence number of last request. */
XPointer private11;
XPointer private12;
XPointer private13;
XPointer private14;
uint max_request_size; /* maximum number 32 bit words in request*/
_XrmHashBucketRec *db;
int function (Display*)private15;
char *display_name; /* "host:display" string used on this connect*/
int default_screen; /* default screen for operations */
int nscreens; /* number of screens on this server*/
Screen *screens; /* pointer to list of screens */
arch_ulong motion_buffer; /* size of motion buffer */
arch_ulong private16;
int min_keycode; /* minimum defined keycode */
int max_keycode; /* maximum defined keycode */
XPointer private17;
XPointer private18;
int private19;
byte *xdefaults; /* contents of defaults from server */
/* there is more to this structure, but it is private to Xlib */
}
// I got these numbers from a C program as a sanity test
version(X86_64) {
static assert(Display.sizeof == 296);
static assert(XPointer.sizeof == 8);
static assert(XErrorEvent.sizeof == 40);
static assert(XAnyEvent.sizeof == 40);
static assert(XMappingEvent.sizeof == 56);
static assert(XEvent.sizeof == 192);
} else version (AArch64) {
// omit check for aarch64
} else {
static assert(Display.sizeof == 176);
static assert(XPointer.sizeof == 4);
static assert(XEvent.sizeof == 96);
}
struct Depth
{
int depth; /* this depth (Z) of the depth */
int nvisuals; /* number of Visual types at this depth */
Visual *visuals; /* list of visuals possible at this depth */
}
alias void* GC;
alias c_ulong VisualID;
alias XID Colormap;
alias XID Cursor;
alias XID KeySym;
alias uint KeyCode;
enum None = 0;
}
version(without_opengl) {}
else {
extern(C) nothrow @nogc {
static if(!SdpyIsUsingIVGLBinds) {
enum GLX_USE_GL= 1; /* support GLX rendering */
enum GLX_BUFFER_SIZE= 2; /* depth of the color buffer */
enum GLX_LEVEL= 3; /* level in plane stacking */
enum GLX_RGBA= 4; /* true if RGBA mode */
enum GLX_DOUBLEBUFFER= 5; /* double buffering supported */
enum GLX_STEREO= 6; /* stereo buffering supported */
enum GLX_AUX_BUFFERS= 7; /* number of aux buffers */
enum GLX_RED_SIZE= 8; /* number of red component bits */
enum GLX_GREEN_SIZE= 9; /* number of green component bits */
enum GLX_BLUE_SIZE= 10; /* number of blue component bits */
enum GLX_ALPHA_SIZE= 11; /* number of alpha component bits */
enum GLX_DEPTH_SIZE= 12; /* number of depth bits */
enum GLX_STENCIL_SIZE= 13; /* number of stencil bits */
enum GLX_ACCUM_RED_SIZE= 14; /* number of red accum bits */
enum GLX_ACCUM_GREEN_SIZE= 15; /* number of green accum bits */
enum GLX_ACCUM_BLUE_SIZE= 16; /* number of blue accum bits */
enum GLX_ACCUM_ALPHA_SIZE= 17; /* number of alpha accum bits */
//XVisualInfo* glXChooseVisual(Display *dpy, int screen, in int *attrib_list);
enum GL_TRUE = 1;
enum GL_FALSE = 0;
alias int GLint;
}
alias XID GLXContextID;
alias XID GLXPixmap;
alias XID GLXDrawable;
alias XID GLXPbuffer;
alias XID GLXWindow;
alias XID GLXFBConfigID;
alias void* GLXContext;
}
}
enum AllocNone = 0;
extern(C) {
/* WARNING, this type not in Xlib spec */
extern(C) alias XIOErrorHandler = int function (Display* display);
}
extern(C) nothrow @nogc {
struct Screen{
XExtData *ext_data; /* hook for extension to hang data */
Display *display; /* back pointer to display structure */
Window root; /* Root window id. */
int width, height; /* width and height of screen */
int mwidth, mheight; /* width and height of in millimeters */
int ndepths; /* number of depths possible */
Depth *depths; /* list of allowable depths on the screen */
int root_depth; /* bits per pixel */
Visual *root_visual; /* root visual */
GC default_gc; /* GC for the root root visual */
Colormap cmap; /* default color map */
uint white_pixel;
uint black_pixel; /* White and Black pixel values */
int max_maps, min_maps; /* max and min color maps */
int backing_store; /* Never, WhenMapped, Always */
bool save_unders;
int root_input_mask; /* initial root input mask */
}
struct Visual
{
XExtData *ext_data; /* hook for extension to hang data */
VisualID visualid; /* visual id of this visual */
int class_; /* class of screen (monochrome, etc.) */
c_ulong red_mask, green_mask, blue_mask; /* mask values */
int bits_per_rgb; /* log base 2 of distinct color values */
int map_entries; /* color map entries */
}
alias Display* _XPrivDisplay;
extern(D) Screen* ScreenOfDisplay(Display* dpy, int scr) {
assert(dpy !is null);
return &dpy.screens[scr];
}
extern(D) Window RootWindow(Display *dpy,int scr) {
return ScreenOfDisplay(dpy,scr).root;
}
struct XWMHints {
arch_long flags;
Bool input;
int initial_state;
Pixmap icon_pixmap;
Window icon_window;
int icon_x, icon_y;
Pixmap icon_mask;
XID window_group;
}
struct XClassHint {
char* res_name;
char* res_class;
}
extern(D) int DefaultScreen(Display *dpy) {
return dpy.default_screen;
}
extern(D) int DefaultDepth(Display* dpy, int scr) { return ScreenOfDisplay(dpy, scr).root_depth; }
extern(D) int DisplayWidth(Display* dpy, int scr) { return ScreenOfDisplay(dpy, scr).width; }
extern(D) int DisplayHeight(Display* dpy, int scr) { return ScreenOfDisplay(dpy, scr).height; }
extern(D) int DisplayWidthMM(Display* dpy, int scr) { return ScreenOfDisplay(dpy, scr).mwidth; }
extern(D) int DisplayHeightMM(Display* dpy, int scr) { return ScreenOfDisplay(dpy, scr).mheight; }
extern(D) auto DefaultColormap(Display* dpy, int scr) { return ScreenOfDisplay(dpy, scr).cmap; }
extern(D) int ConnectionNumber(Display* dpy) { return dpy.fd; }
enum int AnyPropertyType = 0;
enum int Success = 0;
enum int RevertToNone = None;
enum int PointerRoot = 1;
enum Time CurrentTime = 0;
enum int RevertToPointerRoot = PointerRoot;
enum int RevertToParent = 2;
extern(D) int DefaultDepthOfDisplay(Display* dpy) {
return ScreenOfDisplay(dpy, DefaultScreen(dpy)).root_depth;
}
extern(D) Visual* DefaultVisual(Display *dpy,int scr) {
return ScreenOfDisplay(dpy,scr).root_visual;
}
extern(D) GC DefaultGC(Display *dpy,int scr) {
return ScreenOfDisplay(dpy,scr).default_gc;
}
extern(D) uint BlackPixel(Display *dpy,int scr) {
return ScreenOfDisplay(dpy,scr).black_pixel;
}
extern(D) uint WhitePixel(Display *dpy,int scr) {
return ScreenOfDisplay(dpy,scr).white_pixel;
}
alias void* XFontSet; // i think
struct XmbTextItem {
char* chars;
int nchars;
int delta;
XFontSet font_set;
}
struct XTextItem {
char* chars;
int nchars;
int delta;
Font font;
}
enum {
GXclear = 0x0, /* 0 */
GXand = 0x1, /* src AND dst */
GXandReverse = 0x2, /* src AND NOT dst */
GXcopy = 0x3, /* src */
GXandInverted = 0x4, /* NOT src AND dst */
GXnoop = 0x5, /* dst */
GXxor = 0x6, /* src XOR dst */
GXor = 0x7, /* src OR dst */
GXnor = 0x8, /* NOT src AND NOT dst */
GXequiv = 0x9, /* NOT src XOR dst */
GXinvert = 0xa, /* NOT dst */
GXorReverse = 0xb, /* src OR NOT dst */
GXcopyInverted = 0xc, /* NOT src */
GXorInverted = 0xd, /* NOT src OR dst */
GXnand = 0xe, /* NOT src OR NOT dst */
GXset = 0xf, /* 1 */
}
enum QueueMode : int {
QueuedAlready,
QueuedAfterReading,
QueuedAfterFlush
}
enum GrabMode { GrabModeSync = 0, GrabModeAsync = 1 }
struct XPoint {
short x;
short y;
}
enum CoordMode:int {
CoordModeOrigin = 0,
CoordModePrevious = 1
}
enum PolygonShape:int {
Complex = 0,
Nonconvex = 1,
Convex = 2
}
struct XTextProperty {
const(char)* value; /* same as Property routines */
Atom encoding; /* prop type */
int format; /* prop data format: 8, 16, or 32 */
arch_ulong nitems; /* number of data items in value */
}
version( X86_64 ) {
static assert(XTextProperty.sizeof == 32);
}
struct XGCValues {
int function_; /* logical operation */
arch_ulong plane_mask;/* plane mask */
arch_ulong foreground;/* foreground pixel */
arch_ulong background;/* background pixel */
int line_width; /* line width */
int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */
int cap_style; /* CapNotLast, CapButt,
CapRound, CapProjecting */
int join_style; /* JoinMiter, JoinRound, JoinBevel */
int fill_style; /* FillSolid, FillTiled,
FillStippled, FillOpaeueStippled */
int fill_rule; /* EvenOddRule, WindingRule */
int arc_mode; /* ArcChord, ArcPieSlice */
Pixmap tile; /* tile pixmap for tiling operations */
Pixmap stipple; /* stipple 1 plane pixmap for stipping */
int ts_x_origin; /* offset for tile or stipple operations */
int ts_y_origin;
Font font; /* default text font for text operations */
int subwindow_mode; /* ClipByChildren, IncludeInferiors */
Bool graphics_exposures;/* boolean, should exposures be generated */
int clip_x_origin; /* origin for clipping */
int clip_y_origin;
Pixmap clip_mask; /* bitmap clipping; other calls for rects */
int dash_offset; /* patterned/dashed line information */
char dashes;
}
struct XColor {
arch_ulong pixel;
ushort red, green, blue;
byte flags;
byte pad;
}
alias XErrorHandler = int function(Display*, XErrorEvent*);
struct XRectangle {
short x;
short y;
ushort width;
ushort height;
}
enum ClipByChildren = 0;
enum IncludeInferiors = 1;
enum Atom XA_PRIMARY = 1;
enum Atom XA_SECONDARY = 2;
enum Atom XA_STRING = 31;
enum Atom XA_CARDINAL = 6;
enum Atom XA_WM_NAME = 39;
enum Atom XA_ATOM = 4;
enum Atom XA_WINDOW = 33;
enum Atom XA_WM_HINTS = 35;
enum int PropModeAppend = 2;
enum int PropModeReplace = 0;
enum int PropModePrepend = 1;
enum int CopyFromParent = 0;
enum int InputOutput = 1;
// XWMHints
enum InputHint = 1 << 0;
enum StateHint = 1 << 1;
enum IconPixmapHint = (1L << 2);
enum IconWindowHint = (1L << 3);
enum IconPositionHint = (1L << 4);
enum IconMaskHint = (1L << 5);
enum WindowGroupHint = (1L << 6);
enum AllHints = (InputHint|StateHint|IconPixmapHint|IconWindowHint|IconPositionHint|IconMaskHint|WindowGroupHint);
enum XUrgencyHint = (1L << 8);
// GC Components
enum GCFunction = (1L<<0);
enum GCPlaneMask = (1L<<1);
enum GCForeground = (1L<<2);
enum GCBackground = (1L<<3);
enum GCLineWidth = (1L<<4);
enum GCLineStyle = (1L<<5);
enum GCCapStyle = (1L<<6);
enum GCJoinStyle = (1L<<7);
enum GCFillStyle = (1L<<8);
enum GCFillRule = (1L<<9);
enum GCTile = (1L<<10);
enum GCStipple = (1L<<11);
enum GCTileStipXOrigin = (1L<<12);
enum GCTileStipYOrigin = (1L<<13);
enum GCFont = (1L<<14);
enum GCSubwindowMode = (1L<<15);
enum GCGraphicsExposures= (1L<<16);
enum GCClipXOrigin = (1L<<17);
enum GCClipYOrigin = (1L<<18);
enum GCClipMask = (1L<<19);
enum GCDashOffset = (1L<<20);
enum GCDashList = (1L<<21);
enum GCArcMode = (1L<<22);
enum GCLastBit = 22;
enum int WithdrawnState = 0;
enum int NormalState = 1;
enum int IconicState = 3;
}
} else version (OSXCocoa) {
private:
alias void* id;
alias void* Class;
alias void* SEL;
alias void* IMP;
alias void* Ivar;
alias byte BOOL;
alias const(void)* CFStringRef;
alias const(void)* CFAllocatorRef;
alias const(void)* CFTypeRef;
alias const(void)* CGContextRef;
alias const(void)* CGColorSpaceRef;
alias const(void)* CGImageRef;
alias ulong CGBitmapInfo;
struct objc_super {
id self;
Class superclass;
}
struct CFRange {
long location, length;
}
struct NSPoint {
double x, y;
static fromTuple(T)(T tupl) {
return NSPoint(tupl.tupleof);
}
}
struct NSSize {
double width, height;
}
struct NSRect {
NSPoint origin;
NSSize size;
}
alias NSPoint CGPoint;
alias NSSize CGSize;
alias NSRect CGRect;
struct CGAffineTransform {
double a, b, c, d, tx, ty;
}
enum NSApplicationActivationPolicyRegular = 0;
enum NSBackingStoreBuffered = 2;
enum kCFStringEncodingUTF8 = 0x08000100;
enum : size_t {
NSBorderlessWindowMask = 0,
NSTitledWindowMask = 1 << 0,
NSClosableWindowMask = 1 << 1,
NSMiniaturizableWindowMask = 1 << 2,
NSResizableWindowMask = 1 << 3,
NSTexturedBackgroundWindowMask = 1 << 8
}
enum : ulong {
kCGImageAlphaNone,
kCGImageAlphaPremultipliedLast,
kCGImageAlphaPremultipliedFirst,
kCGImageAlphaLast,
kCGImageAlphaFirst,
kCGImageAlphaNoneSkipLast,
kCGImageAlphaNoneSkipFirst
}
enum : ulong {
kCGBitmapAlphaInfoMask = 0x1F,
kCGBitmapFloatComponents = (1 << 8),
kCGBitmapByteOrderMask = 0x7000,
kCGBitmapByteOrderDefault = (0 << 12),
kCGBitmapByteOrder16Little = (1 << 12),
kCGBitmapByteOrder32Little = (2 << 12),
kCGBitmapByteOrder16Big = (3 << 12),
kCGBitmapByteOrder32Big = (4 << 12)
}
enum CGPathDrawingMode {
kCGPathFill,
kCGPathEOFill,
kCGPathStroke,
kCGPathFillStroke,
kCGPathEOFillStroke
}
enum objc_AssociationPolicy : size_t {
OBJC_ASSOCIATION_ASSIGN = 0,
OBJC_ASSOCIATION_RETAIN_NONATOMIC = 1,
OBJC_ASSOCIATION_COPY_NONATOMIC = 3,
OBJC_ASSOCIATION_RETAIN = 0x301, //01401,
OBJC_ASSOCIATION_COPY = 0x303 //01403
}
extern(C) {
id objc_msgSend(id receiver, SEL selector, ...);
id objc_msgSendSuper(objc_super* superStruct, SEL selector, ...);
id objc_getClass(const(char)* name);
SEL sel_registerName(const(char)* str);
Class objc_allocateClassPair(Class superclass, const(char)* name,
size_t extra_bytes);
void objc_registerClassPair(Class cls);
BOOL class_addMethod(Class cls, SEL name, IMP imp, const(char)* types);
id objc_getAssociatedObject(id object, void* key);
void objc_setAssociatedObject(id object, void* key, id value,
objc_AssociationPolicy policy);
Ivar class_getInstanceVariable(Class cls, const(char)* name);
id object_getIvar(id object, Ivar ivar);
void object_setIvar(id object, Ivar ivar, id value);
BOOL class_addIvar(Class cls, const(char)* name,
size_t size, ubyte alignment, const(char)* types);
extern __gshared id NSApp;
void CFRelease(CFTypeRef obj);
CFStringRef CFStringCreateWithBytes(CFAllocatorRef allocator,
const(char)* bytes, long numBytes,
long encoding,
BOOL isExternalRepresentation);
long CFStringGetBytes(CFStringRef theString, CFRange range, long encoding,
char lossByte, bool isExternalRepresentation,
char* buffer, long maxBufLen, long* usedBufLen);
long CFStringGetLength(CFStringRef theString);
CGContextRef CGBitmapContextCreate(void* data,
size_t width, size_t height,
size_t bitsPerComponent,
size_t bytesPerRow,
CGColorSpaceRef colorspace,
CGBitmapInfo bitmapInfo);
void CGContextRelease(CGContextRef c);
ubyte* CGBitmapContextGetData(CGContextRef c);
CGImageRef CGBitmapContextCreateImage(CGContextRef c);
size_t CGBitmapContextGetWidth(CGContextRef c);
size_t CGBitmapContextGetHeight(CGContextRef c);
CGColorSpaceRef CGColorSpaceCreateDeviceRGB();
void CGColorSpaceRelease(CGColorSpaceRef cs);
void CGContextSetRGBStrokeColor(CGContextRef c,
double red, double green, double blue,
double alpha);
void CGContextSetRGBFillColor(CGContextRef c,
double red, double green, double blue,
double alpha);
void CGContextDrawImage(CGContextRef c, CGRect rect, CGImageRef image);
void CGContextShowTextAtPoint(CGContextRef c, double x, double y,
const(char)* str, size_t length);
void CGContextStrokeLineSegments(CGContextRef c,
const(CGPoint)* points, size_t count);
void CGContextBeginPath(CGContextRef c);
void CGContextDrawPath(CGContextRef c, CGPathDrawingMode mode);
void CGContextAddEllipseInRect(CGContextRef c, CGRect rect);
void CGContextAddArc(CGContextRef c, double x, double y, double radius,
double startAngle, double endAngle, long clockwise);
void CGContextAddRect(CGContextRef c, CGRect rect);
void CGContextAddLines(CGContextRef c,
const(CGPoint)* points, size_t count);
void CGContextSaveGState(CGContextRef c);
void CGContextRestoreGState(CGContextRef c);
void CGContextSelectFont(CGContextRef c, const(char)* name, double size,
ulong textEncoding);
CGAffineTransform CGContextGetTextMatrix(CGContextRef c);
void CGContextSetTextMatrix(CGContextRef c, CGAffineTransform t);
void CGImageRelease(CGImageRef image);
}
private:
// A convenient method to create a CFString (=NSString) from a D string.
CFStringRef createCFString(string str) {
return CFStringCreateWithBytes(null, str.ptr, cast(long) str.length,
kCFStringEncodingUTF8, false);
}
// Objective-C calls.
RetType objc_msgSend_specialized(string selector, RetType, T...)(id self, T args) {
auto _cmd = sel_registerName(selector.ptr);
alias extern(C) RetType function(id, SEL, T) ExpectedType;
return (cast(ExpectedType)&objc_msgSend)(self, _cmd, args);
}
RetType objc_msgSend_classMethod(string selector, RetType, T...)(const(char)* className, T args) {
auto _cmd = sel_registerName(selector.ptr);
auto cls = objc_getClass(className);
alias extern(C) RetType function(id, SEL, T) ExpectedType;
return (cast(ExpectedType)&objc_msgSend)(cls, _cmd, args);
}
RetType objc_msgSend_classMethod(string className, string selector, RetType, T...)(T args) {
return objc_msgSend_classMethod!(selector, RetType, T)(className.ptr, args);
}
alias objc_msgSend_specialized!("setNeedsDisplay:", void, BOOL) setNeedsDisplay;
alias objc_msgSend_classMethod!("alloc", id) alloc;
alias objc_msgSend_specialized!("initWithContentRect:styleMask:backing:defer:",
id, NSRect, size_t, size_t, BOOL) initWithContentRect;
alias objc_msgSend_specialized!("setTitle:", void, CFStringRef) setTitle;
alias objc_msgSend_specialized!("center", void) center;
alias objc_msgSend_specialized!("initWithFrame:", id, NSRect) initWithFrame;
alias objc_msgSend_specialized!("setContentView:", void, id) setContentView;
alias objc_msgSend_specialized!("release", void) release;
alias objc_msgSend_classMethod!("NSColor", "whiteColor", id) whiteNSColor;
alias objc_msgSend_specialized!("setBackgroundColor:", void, id) setBackgroundColor;
alias objc_msgSend_specialized!("makeKeyAndOrderFront:", void, id) makeKeyAndOrderFront;
alias objc_msgSend_specialized!("invalidate", void) invalidate;
alias objc_msgSend_specialized!("close", void) close;
alias objc_msgSend_classMethod!("NSTimer", "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:",
id, double, id, SEL, id, BOOL) scheduledTimer;
alias objc_msgSend_specialized!("run", void) run;
alias objc_msgSend_classMethod!("NSGraphicsContext", "currentContext",
id) currentNSGraphicsContext;
alias objc_msgSend_specialized!("graphicsPort", CGContextRef) graphicsPort;
alias objc_msgSend_specialized!("characters", CFStringRef) characters;
alias objc_msgSend_specialized!("superclass", Class) superclass;
alias objc_msgSend_specialized!("init", id) init;
alias objc_msgSend_specialized!("addItem:", void, id) addItem;
alias objc_msgSend_specialized!("setMainMenu:", void, id) setMainMenu;
alias objc_msgSend_specialized!("initWithTitle:action:keyEquivalent:",
id, CFStringRef, SEL, CFStringRef) initWithTitle;
alias objc_msgSend_specialized!("setSubmenu:", void, id) setSubmenu;
alias objc_msgSend_specialized!("setDelegate:", void, id) setDelegate;
alias objc_msgSend_specialized!("activateIgnoringOtherApps:",
void, BOOL) activateIgnoringOtherApps;
alias objc_msgSend_classMethod!("NSApplication", "sharedApplication",
id) sharedNSApplication;
alias objc_msgSend_specialized!("setActivationPolicy:", void, ptrdiff_t) setActivationPolicy;
} else static assert(0, "Unsupported operating system");
version(OSXCocoa) {
// I don't know anything about the Mac, but a couple years ago, KennyTM on the newsgroup wrote this for me
//
// http://forum.dlang.org/thread/innr0v$1deh$1@digitalmars.com?page=4#post-int88l:24uaf:241:40digitalmars.com
// https://github.com/kennytm/simpledisplay.d/blob/osx/simpledisplay.d
//
// and it is about time I merged it in here. It is available with -version=OSXCocoa until someone tests it for me!
// Probably won't even fully compile right now
import std.math : PI;
import std.algorithm : map;
import std.array : array;
alias SimpleWindow NativeWindowHandle;
alias void delegate(id) NativeEventHandler;
__gshared Ivar simpleWindowIvar;
enum KEY_ESCAPE = 27;
mixin template NativeImageImplementation() {
CGContextRef context;
ubyte* rawData;
final:
void convertToRgbaBytes(ubyte[] where) {
assert(where.length == this.width * this.height * 4);
// if rawData had a length....
//assert(rawData.length == where.length);
for(long idx = 0; idx < where.length; idx += 4) {
auto alpha = rawData[idx + 3];
if(alpha == 255) {
where[idx + 0] = rawData[idx + 0]; // r
where[idx + 1] = rawData[idx + 1]; // g
where[idx + 2] = rawData[idx + 2]; // b
where[idx + 3] = rawData[idx + 3]; // a
} else {
where[idx + 0] = cast(ubyte)(rawData[idx + 0] * 255 / alpha); // r
where[idx + 1] = cast(ubyte)(rawData[idx + 1] * 255 / alpha); // g
where[idx + 2] = cast(ubyte)(rawData[idx + 2] * 255 / alpha); // b
where[idx + 3] = rawData[idx + 3]; // a
}
}
}
void setFromRgbaBytes(in ubyte[] where) {
// FIXME: this is probably wrong
assert(where.length == this.width * this.height * 4);
// if rawData had a length....
//assert(rawData.length == where.length);
for(long idx = 0; idx < where.length; idx += 4) {
auto alpha = rawData[idx + 3];
if(alpha == 255) {
rawData[idx + 0] = where[idx + 0]; // r
rawData[idx + 1] = where[idx + 1]; // g
rawData[idx + 2] = where[idx + 2]; // b
rawData[idx + 3] = where[idx + 3]; // a
} else {
rawData[idx + 0] = cast(ubyte)(where[idx + 0] * 255 / alpha); // r
rawData[idx + 1] = cast(ubyte)(where[idx + 1] * 255 / alpha); // g
rawData[idx + 2] = cast(ubyte)(where[idx + 2] * 255 / alpha); // b
rawData[idx + 3] = where[idx + 3]; // a
}
}
}
void createImage(int width, int height, bool forcexshm=false) {
auto colorSpace = CGColorSpaceCreateDeviceRGB();
context = CGBitmapContextCreate(null, width, height, 8, 4*width,
colorSpace,
kCGImageAlphaPremultipliedLast
|kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colorSpace);
rawData = CGBitmapContextGetData(context);
}
void dispose() {
CGContextRelease(context);
}
void setPixel(int x, int y, Color c) {
auto offset = (y * width + x) * 4;
if (c.a == 255) {
rawData[offset + 0] = c.r;
rawData[offset + 1] = c.g;
rawData[offset + 2] = c.b;
rawData[offset + 3] = c.a;
} else {
rawData[offset + 0] = cast(ubyte)(c.r*c.a/255);
rawData[offset + 1] = cast(ubyte)(c.g*c.a/255);
rawData[offset + 2] = cast(ubyte)(c.b*c.a/255);
rawData[offset + 3] = c.a;
}
}
}
mixin template NativeScreenPainterImplementation() {
CGContextRef context;
ubyte[4] _outlineComponents;
id view;
void create(NativeWindowHandle window) {
context = window.drawingContext;
view = window.view;
}
void dispose() {
setNeedsDisplay(view, true);
}
bool manualInvalidations;
void invalidateRect(Rectangle invalidRect) { }
// NotYetImplementedException
Size textSize(in char[] txt) { return Size(32, 16); throw new NotYetImplementedException(); }
void rasterOp(RasterOp op) {}
Pen _activePen;
Color _fillColor;
Rectangle _clipRectangle;
void setClipRectangle(int, int, int, int) {}
void setFont(OperatingSystemFont) {}
int fontHeight() { return 14; }
// end
void pen(Pen pen) {
_activePen = pen;
auto color = pen.color; // FIXME
double alphaComponent = color.a/255.0f;
CGContextSetRGBStrokeColor(context,
color.r/255.0f, color.g/255.0f, color.b/255.0f, alphaComponent);
if (color.a != 255) {
_outlineComponents[0] = cast(ubyte)(color.r*color.a/255);
_outlineComponents[1] = cast(ubyte)(color.g*color.a/255);
_outlineComponents[2] = cast(ubyte)(color.b*color.a/255);
_outlineComponents[3] = color.a;
} else {
_outlineComponents[0] = color.r;
_outlineComponents[1] = color.g;
_outlineComponents[2] = color.b;
_outlineComponents[3] = color.a;
}
}
@property void fillColor(Color color) {
CGContextSetRGBFillColor(context,
color.r/255.0f, color.g/255.0f, color.b/255.0f, color.a/255.0f);
}
void drawImage(int x, int y, Image image, int ulx, int upy, int width, int height) {
// NotYetImplementedException for upper left/width/height
auto cgImage = CGBitmapContextCreateImage(image.context);
auto size = CGSize(CGBitmapContextGetWidth(image.context),
CGBitmapContextGetHeight(image.context));
CGContextDrawImage(context, CGRect(CGPoint(x, y), size), cgImage);
CGImageRelease(cgImage);
}
version(OSXCocoa) {} else // NotYetImplementedException
void drawPixmap(Sprite image, int x, int y) {
// FIXME: is this efficient?
auto cgImage = CGBitmapContextCreateImage(image.context);
auto size = CGSize(CGBitmapContextGetWidth(image.context),
CGBitmapContextGetHeight(image.context));
CGContextDrawImage(context, CGRect(CGPoint(x, y), size), cgImage);
CGImageRelease(cgImage);
}
void drawText(int x, int y, int x2, int y2, in char[] text, uint alignment) {
// FIXME: alignment
if (_outlineComponents[3] != 0) {
CGContextSaveGState(context);
auto invAlpha = 1.0f/_outlineComponents[3];
CGContextSetRGBFillColor(context, _outlineComponents[0]*invAlpha,
_outlineComponents[1]*invAlpha,
_outlineComponents[2]*invAlpha,
_outlineComponents[3]/255.0f);
CGContextShowTextAtPoint(context, x, y + 12 /* this is cuz this picks baseline but i want bounding box */, text.ptr, text.length);
// auto cfstr = cast(id)createCFString(text);
// objc_msgSend(cfstr, sel_registerName("drawAtPoint:withAttributes:"),
// NSPoint(x, y), null);
// CFRelease(cfstr);
CGContextRestoreGState(context);
}
}
void drawPixel(int x, int y) {
auto rawData = CGBitmapContextGetData(context);
auto width = CGBitmapContextGetWidth(context);
auto height = CGBitmapContextGetHeight(context);
auto offset = ((height - y - 1) * width + x) * 4;
rawData[offset .. offset+4] = _outlineComponents;
}
void drawLine(int x1, int y1, int x2, int y2) {
CGPoint[2] linePoints;
linePoints[0] = CGPoint(x1, y1);
linePoints[1] = CGPoint(x2, y2);
CGContextStrokeLineSegments(context, linePoints.ptr, linePoints.length);
}
void drawRectangle(int x, int y, int width, int height) {
CGContextBeginPath(context);
auto rect = CGRect(CGPoint(x, y), CGSize(width, height));
CGContextAddRect(context, rect);
CGContextDrawPath(context, CGPathDrawingMode.kCGPathFillStroke);
}
void drawEllipse(int x1, int y1, int x2, int y2) {
CGContextBeginPath(context);
auto rect = CGRect(CGPoint(x1, y1), CGSize(x2-x1, y2-y1));
CGContextAddEllipseInRect(context, rect);
CGContextDrawPath(context, CGPathDrawingMode.kCGPathFillStroke);
}
void drawArc(int x1, int y1, int width, int height, int start, int finish) {
// @@@BUG@@@ Does not support elliptic arc (width != height).
CGContextBeginPath(context);
CGContextAddArc(context, x1+width*0.5f, y1+height*0.5f, width,
start*PI/(180*64), finish*PI/(180*64), 0);
CGContextDrawPath(context, CGPathDrawingMode.kCGPathFillStroke);
}
void drawPolygon(Point[] intPoints) {
CGContextBeginPath(context);
auto points = array(map!(CGPoint.fromTuple)(intPoints));
CGContextAddLines(context, points.ptr, points.length);
CGContextDrawPath(context, CGPathDrawingMode.kCGPathFillStroke);
}
}
mixin template NativeSimpleWindowImplementation() {
void createWindow(int width, int height, string title, OpenGlOptions opengl, SimpleWindow parent) {
synchronized {
if (NSApp == null) initializeApp();
}
auto contentRect = NSRect(NSPoint(0, 0), NSSize(width, height));
// create the window.
window = initWithContentRect(alloc("NSWindow"),
contentRect,
NSTitledWindowMask
|NSClosableWindowMask
|NSMiniaturizableWindowMask
|NSResizableWindowMask,
NSBackingStoreBuffered,
true);
// set the title & move the window to center.
auto windowTitle = createCFString(title);
setTitle(window, windowTitle);
CFRelease(windowTitle);
center(window);
// create area to draw on.
auto colorSpace = CGColorSpaceCreateDeviceRGB();
drawingContext = CGBitmapContextCreate(null, width, height,
8, 4*width, colorSpace,
kCGImageAlphaPremultipliedLast
|kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colorSpace);
CGContextSelectFont(drawingContext, "Lucida Grande", 12.0f, 1);
auto matrix = CGContextGetTextMatrix(drawingContext);
matrix.c = -matrix.c;
matrix.d = -matrix.d;
CGContextSetTextMatrix(drawingContext, matrix);
// create the subview that things will be drawn on.
view = initWithFrame(alloc("SDGraphicsView"), contentRect);
setContentView(window, view);
object_setIvar(view, simpleWindowIvar, cast(id)this);
release(view);
setBackgroundColor(window, whiteNSColor);
makeKeyAndOrderFront(window, null);
}
void dispose() {
closeWindow();
release(window);
}
void closeWindow() {
invalidate(timer);
.close(window);
}
ScreenPainter getPainter(bool manualInvalidations) {
return ScreenPainter(this, this, manualInvalidations);
}
id window;
id timer;
id view;
CGContextRef drawingContext;
}
extern(C) {
private:
BOOL returnTrue3(id self, SEL _cmd, id app) {
return true;
}
BOOL returnTrue2(id self, SEL _cmd) {
return true;
}
void pulse(id self, SEL _cmd) {
auto simpleWindow = cast(SimpleWindow)object_getIvar(self, simpleWindowIvar);
simpleWindow.handlePulse();
setNeedsDisplay(self, true);
}
void drawRect(id self, SEL _cmd, NSRect rect) {
auto simpleWindow = cast(SimpleWindow)object_getIvar(self, simpleWindowIvar);
auto curCtx = graphicsPort(currentNSGraphicsContext);
auto cgImage = CGBitmapContextCreateImage(simpleWindow.drawingContext);
auto size = CGSize(CGBitmapContextGetWidth(simpleWindow.drawingContext),
CGBitmapContextGetHeight(simpleWindow.drawingContext));
CGContextDrawImage(curCtx, CGRect(CGPoint(0, 0), size), cgImage);
CGImageRelease(cgImage);
}
void keyDown(id self, SEL _cmd, id event) {
auto simpleWindow = cast(SimpleWindow)object_getIvar(self, simpleWindowIvar);
// the event may have multiple characters, and we send them all at
// once.
if (simpleWindow.handleCharEvent || simpleWindow.handleKeyEvent) {
auto chars = characters(event);
auto range = CFRange(0, CFStringGetLength(chars));
auto buffer = new char[range.length*3];
long actualLength;
CFStringGetBytes(chars, range, kCFStringEncodingUTF8, 0, false,
buffer.ptr, cast(int) buffer.length, &actualLength);
foreach (dchar dc; buffer[0..actualLength]) {
if (simpleWindow.handleCharEvent)
simpleWindow.handleCharEvent(dc);
// NotYetImplementedException
//if (simpleWindow.handleKeyEvent)
//simpleWindow.handleKeyEvent(KeyEvent(dc)); // FIXME: what about keyUp?
}
}
// the event's 'keyCode' is hardware-dependent. I don't think people
// will like it. Let's leave it to the native handler.
// perform the default action.
// so the default action is to make a bomp sound and i dont want that
// sooooooooo yeah not gonna do that.
//auto superData = objc_super(self, superclass(self));
//alias extern(C) void function(objc_super*, SEL, id) T;
//(cast(T)&objc_msgSendSuper)(&superData, _cmd, event);
}
}
// initialize the app so that it can be interacted with the user.
// based on http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html
private void initializeApp() {
// push an autorelease pool to avoid leaking.
init(alloc("NSAutoreleasePool"));
// create a new NSApp instance
sharedNSApplication;
setActivationPolicy(NSApp, NSApplicationActivationPolicyRegular);
// create the "Quit" menu.
auto menuBar = init(alloc("NSMenu"));
auto appMenuItem = init(alloc("NSMenuItem"));
addItem(menuBar, appMenuItem);
setMainMenu(NSApp, menuBar);
release(appMenuItem);
release(menuBar);
auto appMenu = init(alloc("NSMenu"));
auto quitTitle = createCFString("Quit");
auto q = createCFString("q");
auto quitItem = initWithTitle(alloc("NSMenuItem"),
quitTitle, sel_registerName("terminate:"), q);
addItem(appMenu, quitItem);
setSubmenu(appMenuItem, appMenu);
release(quitItem);
release(appMenu);
CFRelease(q);
CFRelease(quitTitle);
// assign a delegate for the application, allow it to quit when the last
// window is closed.
auto delegateClass = objc_allocateClassPair(objc_getClass("NSObject"),
"SDWindowCloseDelegate", 0);
class_addMethod(delegateClass,
sel_registerName("applicationShouldTerminateAfterLastWindowClosed:"),
&returnTrue3, "c@:@");
objc_registerClassPair(delegateClass);
auto appDelegate = init(alloc("SDWindowCloseDelegate"));
setDelegate(NSApp, appDelegate);
activateIgnoringOtherApps(NSApp, true);
// create a new view that draws the graphics and respond to keyDown
// events.
auto viewClass = objc_allocateClassPair(objc_getClass("NSView"),
"SDGraphicsView", (void*).sizeof);
class_addIvar(viewClass, "simpledisplay_simpleWindow",
(void*).sizeof, (void*).alignof, "^v");
class_addMethod(viewClass, sel_registerName("simpledisplay_pulse"),
&pulse, "v@:");
class_addMethod(viewClass, sel_registerName("drawRect:"),
&drawRect, "v@:{NSRect={NSPoint=ff}{NSSize=ff}}");
class_addMethod(viewClass, sel_registerName("isFlipped"),
&returnTrue2, "c@:");
class_addMethod(viewClass, sel_registerName("acceptsFirstResponder"),
&returnTrue2, "c@:");
class_addMethod(viewClass, sel_registerName("keyDown:"),
&keyDown, "v@:@");
objc_registerClassPair(viewClass);
simpleWindowIvar = class_getInstanceVariable(viewClass,
"simpledisplay_simpleWindow");
}
}
version(without_opengl) {} else
extern(System) nothrow @nogc {
//enum uint GL_VERSION = 0x1F02;
//const(char)* glGetString (/*GLenum*/uint);
version(X11) {
static if (!SdpyIsUsingIVGLBinds) {
enum GLX_X_RENDERABLE = 0x8012;
enum GLX_DRAWABLE_TYPE = 0x8010;
enum GLX_RENDER_TYPE = 0x8011;
enum GLX_X_VISUAL_TYPE = 0x22;
enum GLX_TRUE_COLOR = 0x8002;
enum GLX_WINDOW_BIT = 0x00000001;
enum GLX_RGBA_BIT = 0x00000001;
enum GLX_COLOR_INDEX_BIT = 0x00000002;
enum GLX_SAMPLE_BUFFERS = 0x186a0;
enum GLX_SAMPLES = 0x186a1;
enum GLX_CONTEXT_MAJOR_VERSION_ARB = 0x2091;
enum GLX_CONTEXT_MINOR_VERSION_ARB = 0x2092;
}
// GLX_EXT_swap_control
alias glXSwapIntervalEXT = void function (Display* dpy, /*GLXDrawable*/Drawable drawable, int interval);
private __gshared glXSwapIntervalEXT _glx_swapInterval_fn = null;
//k8: ugly code to prevent warnings when sdpy is compiled into .a
extern(System) {
alias glXCreateContextAttribsARB_fna = GLXContext function (Display *dpy, GLXFBConfig config, GLXContext share_context, /*Bool*/int direct, const(int)* attrib_list);
}
private __gshared /*glXCreateContextAttribsARB_fna*/void* glXCreateContextAttribsARBFn = cast(void*)1; //HACK!
// this made public so we don't have to get it again and again
public bool glXCreateContextAttribsARB_present () {
if (glXCreateContextAttribsARBFn is cast(void*)1) {
// get it
glXCreateContextAttribsARBFn = cast(void*)glbindGetProcAddress("glXCreateContextAttribsARB");
//{ import core.stdc.stdio; printf("checking glXCreateContextAttribsARB: %shere\n", (glXCreateContextAttribsARBFn !is null ? "".ptr : "not ".ptr)); }
}
return (glXCreateContextAttribsARBFn !is null);
}
// this made public so we don't have to get it again and again
public GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, /*Bool*/int direct, const(int)* attrib_list) {
if (!glXCreateContextAttribsARB_present()) assert(0, "glXCreateContextAttribsARB is not present");
return (cast(glXCreateContextAttribsARB_fna)glXCreateContextAttribsARBFn)(dpy, config, share_context, direct, attrib_list);
}
// extern(C) private __gshared int function(int) glXSwapIntervalSGI; // seems totally redundant to the tohers
extern(C) private __gshared int function(int) glXSwapIntervalMESA;
void glxSetVSync (Display* dpy, /*GLXDrawable*/Drawable drawable, bool wait) {
if (cast(void*)_glx_swapInterval_fn is cast(void*)1) return;
if (_glx_swapInterval_fn is null) {
_glx_swapInterval_fn = cast(glXSwapIntervalEXT)glXGetProcAddress("glXSwapIntervalEXT");
if (_glx_swapInterval_fn is null) {
_glx_swapInterval_fn = cast(glXSwapIntervalEXT)1;
return;
}
version(sdddd) { import std.stdio; debug writeln("glXSwapIntervalEXT found!"); }
}
if(glXSwapIntervalMESA is null) {
// it seems to require both to actually take effect on many computers
// idk why
glXSwapIntervalMESA = cast(typeof(glXSwapIntervalMESA)) glXGetProcAddress("glXSwapIntervalMESA");
if(glXSwapIntervalMESA is null)
glXSwapIntervalMESA = cast(typeof(glXSwapIntervalMESA)) 1;
}
if(cast(void*) glXSwapIntervalMESA > cast(void*) 1)
glXSwapIntervalMESA(wait ? 1 : 0);
_glx_swapInterval_fn(dpy, drawable, (wait ? 1 : 0));
}
} else version(Windows) {
static if (!SdpyIsUsingIVGLBinds) {
enum GL_TRUE = 1;
enum GL_FALSE = 0;
alias int GLint;
public void* glbindGetProcAddress (const(char)* name) {
void* res = wglGetProcAddress(name);
if (res is null) {
/+
//{ import core.stdc.stdio; printf("GL: '%s' not found (0)\n", name); }
import core.sys.windows.windef, core.sys.windows.winbase;
__gshared HINSTANCE dll = null;
if (dll is null) {
dll = LoadLibraryA("opengl32.dll");
if (dll is null) return null; // <32, but idc
}
res = GetProcAddress(dll, name);
+/
res = GetProcAddress(gl.libHandle, name);
}
//{ import core.stdc.stdio; printf(" GL: '%s' is 0x%08x\n", name, cast(uint)res); }
return res;
}
}
private __gshared extern(System) BOOL function(int) wglSwapIntervalEXT;
void wglSetVSync(bool wait) {
if(wglSwapIntervalEXT is null) {
wglSwapIntervalEXT = cast(typeof(wglSwapIntervalEXT)) wglGetProcAddress("wglSwapIntervalEXT");
if(wglSwapIntervalEXT is null)
wglSwapIntervalEXT = cast(typeof(wglSwapIntervalEXT)) 1;
}
if(cast(void*) wglSwapIntervalEXT is cast(void*) 1)
return;
wglSwapIntervalEXT(wait ? 1 : 0);
}
enum WGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091;
enum WGL_CONTEXT_MINOR_VERSION_ARB = 0x2092;
enum WGL_CONTEXT_LAYER_PLANE_ARB = 0x2093;
enum WGL_CONTEXT_FLAGS_ARB = 0x2094;
enum WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126;
enum WGL_CONTEXT_DEBUG_BIT_ARB = 0x0001;
enum WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
enum WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001;
enum WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002;
alias wglCreateContextAttribsARB_fna = HGLRC function (HDC hDC, HGLRC hShareContext, const(int)* attribList);
__gshared wglCreateContextAttribsARB_fna wglCreateContextAttribsARB = null;
void wglInitOtherFunctions () {
if (wglCreateContextAttribsARB is null) {
wglCreateContextAttribsARB = cast(wglCreateContextAttribsARB_fna)glbindGetProcAddress("wglCreateContextAttribsARB");
}
}
}
static if (!SdpyIsUsingIVGLBinds) {
interface GL {
extern(System) @nogc nothrow:
void glGetIntegerv(int, void*);
void glMatrixMode(int);
void glPushMatrix();
void glLoadIdentity();
void glOrtho(double, double, double, double, double, double);
void glFrustum(double, double, double, double, double, double);
void glPopMatrix();
void glEnable(int);
void glDisable(int);
void glClear(int);
void glBegin(int);
void glVertex2f(float, float);
void glVertex3f(float, float, float);
void glEnd();
void glColor3b(byte, byte, byte);
void glColor3ub(ubyte, ubyte, ubyte);
void glColor4b(byte, byte, byte, byte);
void glColor4ub(ubyte, ubyte, ubyte, ubyte);
void glColor3i(int, int, int);
void glColor3ui(uint, uint, uint);
void glColor4i(int, int, int, int);
void glColor4ui(uint, uint, uint, uint);
void glColor3f(float, float, float);
void glColor4f(float, float, float, float);
void glTranslatef(float, float, float);
void glScalef(float, float, float);
version(X11) {
void glSecondaryColor3b(byte, byte, byte);
void glSecondaryColor3ub(ubyte, ubyte, ubyte);
void glSecondaryColor3i(int, int, int);
void glSecondaryColor3ui(uint, uint, uint);
void glSecondaryColor3f(float, float, float);
}
void glDrawElements(int, int, int, void*);
void glRotatef(float, float, float, float);
uint glGetError();
void glDeleteTextures(int, uint*);
void glRasterPos2i(int, int);
void glDrawPixels(int, int, uint, uint, void*);
void glClearColor(float, float, float, float);
void glPixelStorei(uint, int);
void glGenTextures(uint, uint*);
void glBindTexture(int, int);
void glTexParameteri(uint, uint, int);
void glTexParameterf(uint/*GLenum*/ target, uint/*GLenum*/ pname, float param);
void glTexImage2D(int, int, int, int, int, int, int, int, in void*);
void glTexSubImage2D(uint/*GLenum*/ target, int level, int xoffset, int yoffset,
/*GLsizei*/int width, /*GLsizei*/int height,
uint/*GLenum*/ format, uint/*GLenum*/ type, in void* pixels);
void glTexEnvf(uint/*GLenum*/ target, uint/*GLenum*/ pname, float param);
void glLineWidth(int);
void glTexCoord2f(float, float);
void glVertex2i(int, int);
void glBlendFunc (int, int);
void glDepthFunc (int);
void glViewport(int, int, int, int);
void glClearDepth(double);
void glReadBuffer(uint);
void glReadPixels(int, int, int, int, int, int, void*);
void glFlush();
void glFinish();
version(Windows) {
BOOL wglCopyContext(HGLRC, HGLRC, UINT);
HGLRC wglCreateContext(HDC);
HGLRC wglCreateLayerContext(HDC, int);
BOOL wglDeleteContext(HGLRC);
BOOL wglDescribeLayerPlane(HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR);
HGLRC wglGetCurrentContext();
HDC wglGetCurrentDC();
int wglGetLayerPaletteEntries(HDC, int, int, int, COLORREF*);
PROC wglGetProcAddress(LPCSTR);
BOOL wglMakeCurrent(HDC, HGLRC);
BOOL wglRealizeLayerPalette(HDC, int, BOOL);
int wglSetLayerPaletteEntries(HDC, int, int, int, const(COLORREF)*);
BOOL wglShareLists(HGLRC, HGLRC);
BOOL wglSwapLayerBuffers(HDC, UINT);
BOOL wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD);
BOOL wglUseFontBitmapsW(HDC, DWORD, DWORD, DWORD);
BOOL wglUseFontOutlinesA(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT);
BOOL wglUseFontOutlinesW(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT);
}
}
interface GL3 {
extern(System) @nogc nothrow:
void glGenVertexArrays(GLsizei, GLuint*);
void glBindVertexArray(GLuint);
void glDeleteVertexArrays(GLsizei, const(GLuint)*);
void glGenerateMipmap(GLenum);
void glBufferSubData(GLenum, GLintptr, GLsizeiptr, const(GLvoid)*);
void glStencilMask(GLuint);
void glStencilFunc(GLenum, GLint, GLuint);
void glGetShaderInfoLog(GLuint, GLsizei, GLsizei*, GLchar*);
void glGetProgramInfoLog(GLuint, GLsizei, GLsizei*, GLchar*);
GLuint glCreateProgram();
GLuint glCreateShader(GLenum);
void glShaderSource(GLuint, GLsizei, const(GLchar*)*, const(GLint)*);
void glCompileShader(GLuint);
void glGetShaderiv(GLuint, GLenum, GLint*);
void glAttachShader(GLuint, GLuint);
void glBindAttribLocation(GLuint, GLuint, const(GLchar)*);
void glLinkProgram(GLuint);
void glGetProgramiv(GLuint, GLenum, GLint*);
void glDeleteProgram(GLuint);
void glDeleteShader(GLuint);
GLint glGetUniformLocation(GLuint, const(GLchar)*);
void glGenBuffers(GLsizei, GLuint*);
void glUniform1f(GLint location, GLfloat v0);
void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
void glUniform1i(GLint location, GLint v0);
void glUniform2i(GLint location, GLint v0, GLint v1);
void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
void glUniform1ui(GLint location, GLuint v0);
void glUniform2ui(GLint location, GLuint v0, GLuint v1);
void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
void glUniform1iv(GLint location, GLsizei count, const GLint *value);
void glUniform2iv(GLint location, GLsizei count, const GLint *value);
void glUniform3iv(GLint location, GLsizei count, const GLint *value);
void glUniform4iv(GLint location, GLsizei count, const GLint *value);
void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void glColorMask(GLboolean, GLboolean, GLboolean, GLboolean);
void glStencilOpSeparate(GLenum, GLenum, GLenum, GLenum);
void glDrawArrays(GLenum, GLint, GLsizei);
void glStencilOp(GLenum, GLenum, GLenum);
void glUseProgram(GLuint);
void glCullFace(GLenum);
void glFrontFace(GLenum);
void glActiveTexture(GLenum);
void glBindBuffer(GLenum, GLuint);
void glBufferData(GLenum, GLsizeiptr, const(void)*, GLenum);
void glEnableVertexAttribArray(GLuint);
void glVertexAttribPointer(GLuint, GLint, GLenum, GLboolean, GLsizei, const(void)*);
void glUniform1i(GLint, GLint);
void glUniform2fv(GLint, GLsizei, const(GLfloat)*);
void glDisableVertexAttribArray(GLuint);
void glDeleteBuffers(GLsizei, const(GLuint)*);
void glBlendFuncSeparate(GLenum, GLenum, GLenum, GLenum);
void glLogicOp (GLenum opcode);
void glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
void glDeleteFramebuffers (GLsizei n, const(GLuint)* framebuffers);
void glGenFramebuffers (GLsizei n, GLuint* framebuffers);
GLenum glCheckFramebufferStatus (GLenum target);
void glBindFramebuffer (GLenum target, GLuint framebuffer);
}
interface GL4 {
extern(System) @nogc nothrow:
void glTextureSubImage2D(uint texture, int level, int xoffset, int yoffset,
/*GLsizei*/int width, /*GLsizei*/int height,
uint/*GLenum*/ format, uint/*GLenum*/ type, in void* pixels);
}
interface GLU {
extern(System) @nogc nothrow:
void gluLookAt(double, double, double, double, double, double, double, double, double);
void gluPerspective(double, double, double, double);
char* gluErrorString(uint);
}
enum GL_RED = 0x1903;
enum GL_ALPHA = 0x1906;
enum uint GL_FRONT = 0x0404;
enum uint GL_BLEND = 0x0be2;
enum uint GL_LEQUAL = 0x0203;
enum uint GL_RGB = 0x1907;
enum uint GL_BGRA = 0x80e1;
enum uint GL_RGBA = 0x1908;
enum uint GL_TEXTURE_2D = 0x0DE1;
enum uint GL_TEXTURE_MIN_FILTER = 0x2801;
enum uint GL_NEAREST = 0x2600;
enum uint GL_LINEAR = 0x2601;
enum uint GL_TEXTURE_MAG_FILTER = 0x2800;
enum uint GL_TEXTURE_WRAP_S = 0x2802;
enum uint GL_TEXTURE_WRAP_T = 0x2803;
enum uint GL_REPEAT = 0x2901;
enum uint GL_CLAMP = 0x2900;
enum uint GL_CLAMP_TO_EDGE = 0x812F;
enum uint GL_CLAMP_TO_BORDER = 0x812D;
enum uint GL_DECAL = 0x2101;
enum uint GL_MODULATE = 0x2100;
enum uint GL_TEXTURE_ENV = 0x2300;
enum uint GL_TEXTURE_ENV_MODE = 0x2200;
enum uint GL_REPLACE = 0x1E01;
enum uint GL_LIGHTING = 0x0B50;
enum uint GL_DITHER = 0x0BD0;
enum uint GL_NO_ERROR = 0;
enum int GL_VIEWPORT = 0x0BA2;
enum int GL_MODELVIEW = 0x1700;
enum int GL_TEXTURE = 0x1702;
enum int GL_PROJECTION = 0x1701;
enum int GL_DEPTH_TEST = 0x0B71;
enum int GL_COLOR_BUFFER_BIT = 0x00004000;
enum int GL_ACCUM_BUFFER_BIT = 0x00000200;
enum int GL_DEPTH_BUFFER_BIT = 0x00000100;
enum uint GL_STENCIL_BUFFER_BIT = 0x00000400;
enum int GL_POINTS = 0x0000;
enum int GL_LINES = 0x0001;
enum int GL_LINE_LOOP = 0x0002;
enum int GL_LINE_STRIP = 0x0003;
enum int GL_TRIANGLES = 0x0004;
enum int GL_TRIANGLE_STRIP = 5;
enum int GL_TRIANGLE_FAN = 6;
enum int GL_QUADS = 7;
enum int GL_QUAD_STRIP = 8;
enum int GL_POLYGON = 9;
alias GLvoid = void;
alias GLboolean = ubyte;
alias GLuint = uint;
alias GLenum = uint;
alias GLchar = char;
alias GLsizei = int;
alias GLfloat = float;
alias GLintptr = size_t;
alias GLsizeiptr = ptrdiff_t;
enum uint GL_INVALID_ENUM = 0x0500;
enum uint GL_ZERO = 0;
enum uint GL_ONE = 1;
enum uint GL_BYTE = 0x1400;
enum uint GL_UNSIGNED_BYTE = 0x1401;
enum uint GL_SHORT = 0x1402;
enum uint GL_UNSIGNED_SHORT = 0x1403;
enum uint GL_INT = 0x1404;
enum uint GL_UNSIGNED_INT = 0x1405;
enum uint GL_FLOAT = 0x1406;
enum uint GL_2_BYTES = 0x1407;
enum uint GL_3_BYTES = 0x1408;
enum uint GL_4_BYTES = 0x1409;
enum uint GL_DOUBLE = 0x140A;
enum uint GL_STREAM_DRAW = 0x88E0;
enum uint GL_CCW = 0x0901;
enum uint GL_STENCIL_TEST = 0x0B90;
enum uint GL_SCISSOR_TEST = 0x0C11;
enum uint GL_EQUAL = 0x0202;
enum uint GL_NOTEQUAL = 0x0205;
enum uint GL_ALWAYS = 0x0207;
enum uint GL_KEEP = 0x1E00;
enum uint GL_INCR = 0x1E02;
enum uint GL_INCR_WRAP = 0x8507;
enum uint GL_DECR_WRAP = 0x8508;
enum uint GL_CULL_FACE = 0x0B44;
enum uint GL_BACK = 0x0405;
enum uint GL_FRAGMENT_SHADER = 0x8B30;
enum uint GL_VERTEX_SHADER = 0x8B31;
enum uint GL_COMPILE_STATUS = 0x8B81;
enum uint GL_LINK_STATUS = 0x8B82;
enum uint GL_ELEMENT_ARRAY_BUFFER = 0x8893;
enum uint GL_STATIC_DRAW = 0x88E4;
enum uint GL_UNPACK_ALIGNMENT = 0x0CF5;
enum uint GL_UNPACK_ROW_LENGTH = 0x0CF2;
enum uint GL_UNPACK_SKIP_PIXELS = 0x0CF4;
enum uint GL_UNPACK_SKIP_ROWS = 0x0CF3;
enum uint GL_GENERATE_MIPMAP = 0x8191;
enum uint GL_LINEAR_MIPMAP_LINEAR = 0x2703;
enum uint GL_TEXTURE0 = 0x84C0U;
enum uint GL_TEXTURE1 = 0x84C1U;
enum uint GL_ARRAY_BUFFER = 0x8892;
enum uint GL_SRC_COLOR = 0x0300;
enum uint GL_ONE_MINUS_SRC_COLOR = 0x0301;
enum uint GL_SRC_ALPHA = 0x0302;
enum uint GL_ONE_MINUS_SRC_ALPHA = 0x0303;
enum uint GL_DST_ALPHA = 0x0304;
enum uint GL_ONE_MINUS_DST_ALPHA = 0x0305;
enum uint GL_DST_COLOR = 0x0306;
enum uint GL_ONE_MINUS_DST_COLOR = 0x0307;
enum uint GL_SRC_ALPHA_SATURATE = 0x0308;
enum uint GL_INVERT = 0x150AU;
enum uint GL_DEPTH_STENCIL = 0x84F9U;
enum uint GL_UNSIGNED_INT_24_8 = 0x84FAU;
enum uint GL_FRAMEBUFFER = 0x8D40U;
enum uint GL_COLOR_ATTACHMENT0 = 0x8CE0U;
enum uint GL_DEPTH_STENCIL_ATTACHMENT = 0x821AU;
enum uint GL_FRAMEBUFFER_COMPLETE = 0x8CD5U;
enum uint GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6U;
enum uint GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7U;
enum uint GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9U;
enum uint GL_FRAMEBUFFER_UNSUPPORTED = 0x8CDDU;
enum uint GL_COLOR_LOGIC_OP = 0x0BF2U;
enum uint GL_CLEAR = 0x1500U;
enum uint GL_COPY = 0x1503U;
enum uint GL_XOR = 0x1506U;
enum uint GL_FRAMEBUFFER_BINDING = 0x8CA6U;
enum uint GL_TEXTURE_LOD_BIAS = 0x8501;
}
}
/++
History:
Added September 10, 2021. Previously it would have listed openGlLibrariesSuccessfullyLoaded as false if it couldn't find GLU but really opengl3 works fine without it so I didn't want to keep it required anymore.
+/
__gshared bool gluSuccessfullyLoaded = true;
version(without_opengl) {} else {
static if(!SdpyIsUsingIVGLBinds) {
version(Windows) {
mixin DynamicLoad!(GL, "opengl32", 1, openGlLibrariesSuccessfullyLoaded) gl;
mixin DynamicLoad!(GLU, "glu32", 1, gluSuccessfullyLoaded) glu;
} else {
mixin DynamicLoad!(GL, "GL", 1, openGlLibrariesSuccessfullyLoaded) gl;
mixin DynamicLoad!(GLU, "GLU", 3, gluSuccessfullyLoaded) glu;
}
mixin DynamicLoadSupplementalOpenGL!(GL3) gl3;
shared static this() {
gl.loadDynamicLibrary();
// FIXME: this is NOT actually required and should NOT fail if it is not loaded
// unless those functions are actually used
// go to mark b openGlLibrariesSuccessfullyLoaded = false;
glu.loadDynamicLibrary();
}
}
}
/++
Convenience method for converting D arrays to opengl buffer data
I would LOVE to overload it with the original glBufferData, but D won't
let me since glBufferData is a function pointer :(
Added: August 25, 2020 (version 8.5)
+/
version(without_opengl) {} else
void glBufferDataSlice(GLenum target, const(void[]) data, GLenum usage) {
glBufferData(target, data.length, data.ptr, usage);
}
/+
/++
A matrix for simple uses that easily integrates with [OpenGlShader].
Might not be useful to you since it only as some simple functions and
probably isn't that fast.
Note it uses an inline static array for its storage, so copying it
may be expensive.
+/
struct BasicMatrix(int columns, int rows, T = float) {
import core.stdc.math;
T[columns * rows] data = 0.0;
/++
Basic operations that operate *in place*.
+/
void translate() {
}
/// ditto
void scale() {
}
/// ditto
void rotate() {
}
/++
+/
static if(columns == rows)
static BasicMatrix identity() {
BasicMatrix m;
foreach(i; 0 .. columns)
data[0 + i + i * columns] = 1.0;
return m;
}
static BasicMatrix ortho() {
return BasicMatrix.init;
}
}
+/
/++
Convenience class for using opengl shaders.
Ensure that you've loaded opengl 3+ and set your active
context before trying to use this.
Added: August 25, 2020 (version 8.5)
+/
version(without_opengl) {} else
final class OpenGlShader {
private int shaderProgram_;
private @property void shaderProgram(int a) {
shaderProgram_ = a;
}
/// Get the program ID for use in OpenGL functions.
public @property int shaderProgram() {
return shaderProgram_;
}
/++
+/
static struct Source {
uint type; /// GL_FRAGMENT_SHADER, GL_VERTEX_SHADER, etc.
string code; ///
}
/++
Helper method to just compile some shader code and check for errors
while you do glCreateShader, etc. on the outside yourself.
This just does `glShaderSource` and `glCompileShader` for the given code.
If you the OpenGlShader class constructor, you never need to call this yourself.
+/
static void compile(int sid, Source code) {
const(char)*[1] buffer;
int[1] lengthBuffer;
buffer[0] = code.code.ptr;
lengthBuffer[0] = cast(int) code.code.length;
glShaderSource(sid, 1, buffer.ptr, lengthBuffer.ptr);
glCompileShader(sid);
int success;
glGetShaderiv(sid, GL_COMPILE_STATUS, &success);
if(!success) {
char[512] info;
int len;
glGetShaderInfoLog(sid, info.length, &len, info.ptr);
throw new Exception("Shader compile failure: " ~ cast(immutable) info[0 .. len]);
}
}
/++
Calls `glLinkProgram` and throws if error a occurs.
If you the OpenGlShader class constructor, you never need to call this yourself.
+/
static void link(int shaderProgram) {
glLinkProgram(shaderProgram);
int success;
glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
if(!success) {
char[512] info;
int len;
glGetProgramInfoLog(shaderProgram, info.length, &len, info.ptr);
throw new Exception("Shader link failure: " ~ cast(immutable) info[0 .. len]);
}
}
/++
Constructs the shader object by calling `glCreateProgram`, then
compiling each given [Source], and finally, linking them together.
Throws: on compile or link failure.
+/
this(Source[] codes...) {
shaderProgram = glCreateProgram();
int[16] shadersBufferStack;
int[] shadersBuffer = codes.length <= shadersBufferStack.length ?
shadersBufferStack[0 .. codes.length] :
new int[](codes.length);
foreach(idx, code; codes) {
shadersBuffer[idx] = glCreateShader(code.type);
compile(shadersBuffer[idx], code);
glAttachShader(shaderProgram, shadersBuffer[idx]);
}
link(shaderProgram);
foreach(s; shadersBuffer)
glDeleteShader(s);
}
/// Calls `glUseProgram(this.shaderProgram)`
void use() {
glUseProgram(this.shaderProgram);
}
/// Deletes the program.
void delete_() {
glDeleteProgram(shaderProgram);
shaderProgram = 0;
}
/++
[OpenGlShader.uniforms].name gives you one of these.
You can get the id out of it or just assign
+/
static struct Uniform {
/// the id passed to glUniform*
int id;
/// Assigns the 4 floats. You will probably have to call this via the .opAssign name
void opAssign(float x, float y, float z, float w) {
if(id != -1)
glUniform4f(id, x, y, z, w);
}
void opAssign(float x) {
if(id != -1)
glUniform1f(id, x);
}
void opAssign(float x, float y) {
if(id != -1)
glUniform2f(id, x, y);
}
void opAssign(T)(T t) {
t.glUniform(id);
}
}
static struct UniformsHelper {
OpenGlShader _shader;
@property Uniform opDispatch(string name)() {
auto i = glGetUniformLocation(_shader.shaderProgram, name.ptr);
// FIXME: decide what to do here; the exception is liable to be swallowed by the event syste
//if(i == -1)
//throw new Exception("Could not find uniform " ~ name);
return Uniform(i);
}
@property void opDispatch(string name, T)(T t) {
Uniform f = this.opDispatch!name;
t.glUniform(f);
}
}
/++
Gives access to the uniforms through dot access.
`OpenGlShader.Uniform = shader.uniforms.foo; // calls glGetUniformLocation(this, "foo");
+/
@property UniformsHelper uniforms() { return UniformsHelper(this); }
}
version(without_opengl) {} else {
/++
A static container of experimental types and value constructors for opengl 3+ shaders.
You can declare variables like:
```
OGL.vec3f something;
```
But generally it would be used with [OpenGlShader]'s uniform helpers like
```
shader.uniforms.mouse = OGL.vec(mouseX, mouseY); // or OGL.vec2f if you want to be more specific
```
This is still extremely experimental, not very useful at this point, and thus subject to change at random.
History:
Added December 7, 2021. Not yet stable.
+/
final class OGL {
static:
private template typeFromSpecifier(string specifier) {
static if(specifier == "f")
alias typeFromSpecifier = GLfloat;
else static if(specifier == "i")
alias typeFromSpecifier = GLint;
else static if(specifier == "ui")
alias typeFromSpecifier = GLuint;
else static assert(0, "I don't know this ogl type suffix " ~ specifier);
}
private template CommonType(T...) {
static if(T.length == 1)
alias CommonType = T[0];
else static if(is(typeof(true ? T[0].init : T[1].init) C))
alias CommonType = CommonType!(C, T[2 .. $]);
}
private template typesToSpecifier(T...) {
static if(is(CommonType!T == float))
enum typesToSpecifier = "f";
else static if(is(CommonType!T == int))
enum typesToSpecifier = "i";
else static if(is(CommonType!T == uint))
enum typesToSpecifier = "ui";
else static assert(0, "I can't find a gl type suffix for common type " ~ CommonType!T.stringof);
}
private template genNames(size_t dim, size_t dim2 = 0) {
string helper() {
string s;
if(dim2) {
s ~= "type["~(dim + '0')~"]["~(dim2 + '0')~"] matrix;";
} else {
if(dim > 0) s ~= "type x = 0;";
if(dim > 1) s ~= "type y = 0;";
if(dim > 2) s ~= "type z = 0;";
if(dim > 3) s ~= "type w = 0;";
}
return s;
}
enum genNames = helper();
}
// there's vec, arrays of vec, mat, and arrays of mat
template opDispatch(string name)
if(name.length > 4 && (name[0 .. 3] == "vec" || name[0 .. 3] == "mat"))
{
static if(name[4] == 'x') {
enum dimX = cast(int) (name[3] - '0');
static assert(dimX > 0 && dimX <= 4, "Bad dimension for OGL X type " ~ name[3]);
enum dimY = cast(int) (name[5] - '0');
static assert(dimY > 0 && dimY <= 4, "Bad dimension for OGL Y type " ~ name[5]);
enum isArray = name[$ - 1] == 'v';
enum typeSpecifier = isArray ? name[6 .. $ - 1] : name[6 .. $];
alias type = typeFromSpecifier!typeSpecifier;
} else {
enum dim = cast(int) (name[3] - '0');
static assert(dim > 0 && dim <= 4, "Bad dimension for OGL type " ~ name[3]);
enum isArray = name[$ - 1] == 'v';
enum typeSpecifier = isArray ? name[4 .. $ - 1] : name[4 .. $];
alias type = typeFromSpecifier!typeSpecifier;
}
align(1)
struct opDispatch {
align(1):
static if(name[4] == 'x')
mixin(genNames!(dimX, dimY));
else
mixin(genNames!dim);
private void glUniform(OpenGlShader.Uniform assignTo) {
glUniform(assignTo.id);
}
private void glUniform(int assignTo) {
static if(name[4] == 'x') {
// FIXME
pragma(msg, "This matrix uniform helper has never been tested!!!!");
mixin("glUniformMatrix" ~ name[3 .. $] ~ "v")(assignTo, dimX * dimY, false, this.matrix.ptr);
} else
mixin("glUniform" ~ name[3 .. $])(assignTo, this.tupleof);
}
}
}
auto vec(T...)(T members) {
return typeof(this).opDispatch!("vec" ~ toInternal!string(cast(int) T.length)~ typesToSpecifier!T)(members);
}
}
}
version(linux) {
version(with_eventloop) {} else {
private int epollFd = -1;
void prepareEventLoop() {
if(epollFd != -1)
return; // already initialized, no need to do it again
import ep = core.sys.linux.epoll;
epollFd = ep.epoll_create1(ep.EPOLL_CLOEXEC);
if(epollFd == -1)
throw new Exception("epoll create failure");
}
}
} else version(Posix) {
void prepareEventLoop() {}
}
version(X11) {
import core.stdc.locale : LC_ALL; // rdmd fix
__gshared bool sdx_isUTF8Locale;
// This whole crap is used to initialize X11 locale, so that you can use XIM methods later.
// Yes, there are people with non-utf locale (it's me, Ketmar!), but XIM (composing) will
// not work right if app/X11 locale is not utf. This sux. That's why all that "utf detection"
// anal magic is here. I (Ketmar) hope you like it.
// We will use `sdx_isUTF8Locale` on XIM creation to enforce UTF-8 locale, so XCompose will
// always return correct unicode symbols. The detection is here 'cause user can change locale
// later.
// NOTE: IT IS VERY IMPORTANT THAT THIS BE THE LAST STATIC CTOR OF THE FILE since it tests librariesSuccessfullyLoaded
shared static this () {
if(!librariesSuccessfullyLoaded)
return;
import core.stdc.locale : setlocale, LC_ALL, LC_CTYPE;
// this doesn't hurt; it may add some locking, but the speed is still
// allows doing 60 FPS videogames; also, ignore the result, as most
// users will probably won't do mulththreaded X11 anyway (and I (ketmar)
// never seen this failing).
if (XInitThreads() == 0) { import core.stdc.stdio; fprintf(stderr, "XInitThreads() failed!\n"); }
setlocale(LC_ALL, "");
// check if out locale is UTF-8
auto lct = setlocale(LC_CTYPE, null);
if (lct is null) {
sdx_isUTF8Locale = false;
} else {
for (size_t idx = 0; lct[idx] && lct[idx+1] && lct[idx+2]; ++idx) {
if ((lct[idx+0] == 'u' || lct[idx+0] == 'U') &&
(lct[idx+1] == 't' || lct[idx+1] == 'T') &&
(lct[idx+2] == 'f' || lct[idx+2] == 'F'))
{
sdx_isUTF8Locale = true;
break;
}
}
}
//{ import core.stdc.stdio : stderr, fprintf; fprintf(stderr, "UTF8: %s\n", sdx_isUTF8Locale ? "tan".ptr : "ona".ptr); }
}
}
class ExperimentalTextComponent2 {
/+
Stage 1: get it working monospace
Stage 2: use proportional font
Stage 3: allow changes in inline style
Stage 4: allow new fonts and sizes in the middle
Stage 5: optimize gap buffer
Stage 6: optimize layout
Stage 7: word wrap
Stage 8: justification
Stage 9: editing, selection, etc.
Operations:
insert text
overstrike text
select
cut
modify
+/
/++
It asks for a window so it can translate abstract font sizes to actual on-screen values depending on the window's current dpi, scaling settings, etc.
+/
this(SimpleWindow window) {
this.window = window;
}
private SimpleWindow window;
/++
When you render a [ComponentInFlow], it returns an arbitrary number of these interfaces
representing the internal parts. The first pass is focused on the x parameter, then the
renderer is responsible for going back to the parts in the current line and calling
adjustDownForAscent to change the y params.
+/
static interface ComponentRenderHelper {
/+
When you do an edit, possibly stuff on the same line previously need to move (to adjust
the baseline), stuff subsequent needs to move (adjust x) and possibly stuff below needs
to move (adjust y to make room for new line) until you get back to the same position,
then you can stop - if one thing is unchanged, nothing after it is changed too.
Word wrap might change this as if can rewrap tons of stuff, but the same idea applies,
once you reach something that is unchanged, you can stop.
+/
void adjustDownForAscent(int amount); // at the end of the line it needs to do these
int ascent() const;
int descent() const;
int advance() const;
bool endsWithExplititLineBreak() const;
}
static interface RenderResult {
/++
This is responsible for using what space is left (your object is responsible for keeping its own state after getting it updated from [repositionForNextLine]) and not going over if at all possible. If you can word wrap, you should when space is out. Otherwise, you can keep going if it means overflow hidden or scroll.
+/
void popFront();
@property bool empty() const;
@property ComponentRenderHelper front() const;
void repositionForNextLine(Point baseline, int availableWidth);
}
static interface ComponentInFlow {
void draw(ScreenPainter painter);
//RenderResult render(Point baseline, int availableWidth); // FIXME: it needs to be able to say "my cache is good, nothing different"
bool startsWithExplicitLineBreak() const;
}
static class TextFlowComponent : ComponentInFlow {
bool startsWithExplicitLineBreak() const { return false; } // FIXME: if it is block this can return true
Color foreground;
Color background;
OperatingSystemFont font; // should NEVER be null
ubyte attributes; // underline, strike through, display on new block
version(Windows)
const(wchar)[] content;
else
const(char)[] content; // this should NEVER have a newline, except at the end
RenderedComponent[] rendered; // entirely controlled by [rerender]
// could prolly put some spacing around it too like margin / padding
this(Color f, Color b, OperatingSystemFont font, ubyte attr, const(char)[] c)
in { assert(font !is null);
assert(!font.isNull); }
do
{
this.foreground = f;
this.background = b;
this.font = font;
this.attributes = attr;
version(Windows) {
auto conversionFlags = 0;//WindowsStringConversionFlags.convertNewLines;
auto sz = sizeOfConvertedWstring(c, conversionFlags);
auto buffer = new wchar[](sz);
this.content = makeWindowsString(c, buffer, conversionFlags);
} else {
this.content = c.dup;
}
}
void draw(ScreenPainter painter) {
painter.setFont(this.font);
painter.outlineColor = this.foreground;
painter.fillColor = Color.transparent;
foreach(rendered; this.rendered) {
// the component works in term of baseline,
// but the painter works in term of upper left bounding box
// so need to translate that
if(this.background.a) {
painter.fillColor = this.background;
painter.outlineColor = this.background;
painter.drawRectangle(Point(rendered.startX, rendered.startY - this.font.ascent), Size(rendered.width, this.font.height));
painter.outlineColor = this.foreground;
painter.fillColor = Color.transparent;
}
painter.drawText(Point(rendered.startX, rendered.startY - this.font.ascent), rendered.slice);
// FIXME: strike through, underline, highlight selection, etc.
}
}
}
// I could split the parts into words on render
// for easier word-wrap, each one being an unbreakable "inline-block"
private TextFlowComponent[] parts;
private int needsRerenderFrom;
void addPart(Color f, Color b, OperatingSystemFont font, ubyte attr, const(char)[] c) {
// FIXME: needsRerenderFrom. Basically if the bounding box and baseline is the same as the previous thing, it can prolly just stop.
parts ~= new TextFlowComponent(f, b, font, attr, c);
}
static struct RenderedComponent {
int startX;
int startY;
short width;
// height is always from the containing part's font. This saves some space and means recalculations need not continue past the current line, unless a new part is added with a different font!
// for individual chars in here you've gotta process on demand
version(Windows)
const(wchar)[] slice;
else
const(char)[] slice;
}
void rerender(Rectangle boundingBox) {
Point baseline = boundingBox.upperLeft;
this.boundingBox.left = boundingBox.left;
this.boundingBox.top = boundingBox.top;
auto remainingParts = parts;
int largestX;
foreach(part; parts)
part.font.prepareContext(window);
scope(exit)
foreach(part; parts)
part.font.releaseContext();
calculateNextLine:
int nextLineHeight = 0;
int nextBiggestDescent = 0;
foreach(part; remainingParts) {
auto height = part.font.ascent;
if(height > nextLineHeight)
nextLineHeight = height;
if(part.font.descent > nextBiggestDescent)
nextBiggestDescent = part.font.descent;
if(part.content.length && part.content[$-1] == '\n')
break;
}
baseline.y += nextLineHeight;
auto lineStart = baseline;
while(remainingParts.length) {
remainingParts[0].rendered = null;
bool eol;
if(remainingParts[0].content.length && remainingParts[0].content[$-1] == '\n')
eol = true;
// FIXME: word wrap
auto font = remainingParts[0].font;
auto slice = remainingParts[0].content[0 .. $ - (eol ? 1 : 0)];
auto width = font.stringWidth(slice, window);
remainingParts[0].rendered ~= RenderedComponent(baseline.x, baseline.y, cast(short) width, slice);
remainingParts = remainingParts[1 .. $];
baseline.x += width;
if(eol) {
baseline.y += nextBiggestDescent;
if(baseline.x > largestX)
largestX = baseline.x;
baseline.x = lineStart.x;
goto calculateNextLine;
}
}
if(baseline.x > largestX)
largestX = baseline.x;
this.boundingBox.right = largestX;
this.boundingBox.bottom = baseline.y;
}
// you must call rerender first!
void draw(ScreenPainter painter) {
foreach(part; parts) {
part.draw(painter);
}
}
struct IdentifyResult {
TextFlowComponent part;
int charIndexInPart;
int totalCharIndex = -1; // if this is -1, it just means the end
Rectangle boundingBox;
}
IdentifyResult identify(Point pt, bool exact = false) {
if(parts.length == 0)
return IdentifyResult(null, 0);
if(pt.y < boundingBox.top) {
if(exact)
return IdentifyResult(null, 1);
return IdentifyResult(parts[0], 0);
}
if(pt.y > boundingBox.bottom) {
if(exact)
return IdentifyResult(null, 2);
return IdentifyResult(parts[$-1], cast(int) parts[$-1].content.length);
}
int tci = 0;
// I should probably like binary search this or something...
foreach(ref part; parts) {
foreach(rendered; part.rendered) {
auto rect = Rectangle(rendered.startX, rendered.startY - part.font.ascent, rendered.startX + rendered.width, rendered.startY + part.font.descent);
if(rect.contains(pt)) {
auto x = pt.x - rendered.startX;
auto estimatedIdx = x / part.font.averageWidth;
if(estimatedIdx < 0)
estimatedIdx = 0;
if(estimatedIdx > rendered.slice.length)
estimatedIdx = cast(int) rendered.slice.length;
int idx;
int x1, x2;
if(part.font.isMonospace) {
auto w = part.font.averageWidth;
if(!exact && x > (estimatedIdx + 1) * w)
return IdentifyResult(null, 4);
idx = estimatedIdx;
x1 = idx * w;
x2 = (idx + 1) * w;
} else {
idx = estimatedIdx;
part.font.prepareContext(window);
scope(exit) part.font.releaseContext();
// int iterations;
while(true) {
// iterations++;
x1 = idx ? part.font.stringWidth(rendered.slice[0 .. idx - 1]) : 0;
x2 = part.font.stringWidth(rendered.slice[0 .. idx]); // should be the maximum since `averageWidth` kinda lies.
x1 += rendered.startX;
x2 += rendered.startX;
if(pt.x < x1) {
if(idx == 0) {
if(exact)
return IdentifyResult(null, 6);
else
break;
}
idx--;
} else if(pt.x > x2) {
idx++;
if(idx > rendered.slice.length) {
if(exact)
return IdentifyResult(null, 5);
else
break;
}
} else if(pt.x >= x1 && pt.x <= x2) {
if(idx)
idx--; // point it at the original index
break; // we fit
}
}
// import std.stdio; writeln(iterations)
}
return IdentifyResult(part, idx, tci + idx, Rectangle(x1, rect.top, x2, rect.bottom)); // FIXME: utf-8?
}
}
tci += cast(int) part.content.length; // FIXME: utf-8?
}
return IdentifyResult(null, 3);
}
Rectangle boundingBox; // only set after [rerender]
// text will be positioned around the exclusion zone
static struct ExclusionZone {
}
ExclusionZone[] exclusionZones;
}
// Don't use this yet. When I'm happy with it, I will move it to the
// regular module namespace.
mixin template ExperimentalTextComponent() {
static:
alias Rectangle = arsd.color.Rectangle;
struct ForegroundColor {
Color color;
alias color this;
this(Color c) {
color = c;
}
this(int r, int g, int b, int a = 255) {
color = Color(r, g, b, a);
}
static ForegroundColor opDispatch(string s)() if(__traits(compiles, ForegroundColor(mixin("Color." ~ s)))) {
return ForegroundColor(mixin("Color." ~ s));
}
}
struct BackgroundColor {
Color color;
alias color this;
this(Color c) {
color = c;
}
this(int r, int g, int b, int a = 255) {
color = Color(r, g, b, a);
}
static BackgroundColor opDispatch(string s)() if(__traits(compiles, BackgroundColor(mixin("Color." ~ s)))) {
return BackgroundColor(mixin("Color." ~ s));
}
}
static class InlineElement {
string text;
BlockElement containingBlock;
Color color = Color.black;
Color backgroundColor = Color.transparent;
ushort styles;
string font;
int fontSize;
int lineHeight;
void* identifier;
Rectangle boundingBox;
int[] letterXs; // FIXME: maybe i should do bounding boxes for every character
bool isMergeCompatible(InlineElement other) {
return
containingBlock is other.containingBlock &&
color == other.color &&
backgroundColor == other.backgroundColor &&
styles == other.styles &&
font == other.font &&
fontSize == other.fontSize &&
lineHeight == other.lineHeight &&
true;
}
int xOfIndex(size_t index) {
if(index < letterXs.length)
return letterXs[index];
else
return boundingBox.right;
}
InlineElement clone() {
auto ie = new InlineElement();
ie.tupleof = this.tupleof;
return ie;
}
InlineElement getPreviousInlineElement() {
InlineElement prev = null;
foreach(ie; this.containingBlock.parts) {
if(ie is this)
break;
prev = ie;
}
if(prev is null) {
BlockElement pb;
BlockElement cb = this.containingBlock;
moar:
foreach(ie; this.containingBlock.containingLayout.blocks) {
if(ie is cb)
break;
pb = ie;
}
if(pb is null)
return null;
if(pb.parts.length == 0) {
cb = pb;
goto moar;
}
prev = pb.parts[$-1];
}
return prev;
}
InlineElement getNextInlineElement() {
InlineElement next = null;
foreach(idx, ie; this.containingBlock.parts) {
if(ie is this) {
if(idx + 1 < this.containingBlock.parts.length)
next = this.containingBlock.parts[idx + 1];
break;
}
}
if(next is null) {
BlockElement n;
foreach(idx, ie; this.containingBlock.containingLayout.blocks) {
if(ie is this.containingBlock) {
if(idx + 1 < this.containingBlock.containingLayout.blocks.length)
n = this.containingBlock.containingLayout.blocks[idx + 1];
break;
}
}
if(n is null)
return null;
if(n.parts.length)
next = n.parts[0];
else {} // FIXME
}
return next;
}
}
// Block elements are used entirely for positioning inline elements,
// which are the things that are actually drawn.
class BlockElement {
InlineElement[] parts;
uint alignment;
int whiteSpace; // pre, pre-wrap, wrap
TextLayout containingLayout;
// inputs
Point where;
Size minimumSize;
Size maximumSize;
Rectangle[] excludedBoxes; // like if you want it to write around a floated image or something. Coordinates are relative to the bounding box.
void* identifier;
Rectangle margin;
Rectangle padding;
// outputs
Rectangle[] boundingBoxes;
}
struct TextIdentifyResult {
InlineElement element;
int offset;
private TextIdentifyResult fixupNewline() {
if(element !is null && offset < element.text.length && element.text[offset] == '\n') {
offset--;
} else if(element !is null && offset == element.text.length && element.text.length > 1 && element.text[$-1] == '\n') {
offset--;
}
return this;
}
}
class TextLayout {
BlockElement[] blocks;
Rectangle boundingBox_;
Rectangle boundingBox() { return boundingBox_; }
void boundingBox(Rectangle r) {
if(r != boundingBox_) {
boundingBox_ = r;
layoutInvalidated = true;
}
}
Rectangle contentBoundingBox() {
Rectangle r;
foreach(block; blocks)
foreach(ie; block.parts) {
if(ie.boundingBox.right > r.right)
r.right = ie.boundingBox.right;
if(ie.boundingBox.bottom > r.bottom)
r.bottom = ie.boundingBox.bottom;
}
return r;
}
BlockElement[] getBlocks() {
return blocks;
}
InlineElement[] getTexts() {
InlineElement[] elements;
foreach(block; blocks)
elements ~= block.parts;
return elements;
}
string getPlainText() {
string text;
foreach(block; blocks)
foreach(part; block.parts)
text ~= part.text;
return text;
}
string getHtml() {
return null; // FIXME
}
this(Rectangle boundingBox) {
this.boundingBox = boundingBox;
}
BlockElement addBlock(InlineElement after = null, Rectangle margin = Rectangle(0, 0, 0, 0), Rectangle padding = Rectangle(0, 0, 0, 0)) {
auto be = new BlockElement();
be.containingLayout = this;
if(after is null)
blocks ~= be;
else {
foreach(idx, b; blocks) {
if(b is after.containingBlock) {
blocks = blocks[0 .. idx + 1] ~ be ~ blocks[idx + 1 .. $];
break;
}
}
}
return be;
}
void clear() {
blocks = null;
selectionStart = selectionEnd = caret = Caret.init;
}
void addText(Args...)(Args args) {
if(blocks.length == 0)
addBlock();
InlineElement ie = new InlineElement();
foreach(idx, arg; args) {
static if(is(typeof(arg) == ForegroundColor))
ie.color = arg;
else static if(is(typeof(arg) == TextFormat)) {
if(arg & 0x8000) // ~TextFormat.something turns it off
ie.styles &= arg;
else
ie.styles |= arg;
} else static if(is(typeof(arg) == string)) {
static if(idx == 0 && args.length > 1)
static assert(0, "Put styles before the string.");
size_t lastLineIndex;
foreach(cidx, char a; arg) {
if(a == '\n') {
ie.text = arg[lastLineIndex .. cidx + 1];
lastLineIndex = cidx + 1;
ie.containingBlock = blocks[$-1];
blocks[$-1].parts ~= ie.clone;
ie.text = null;
} else {
}
}
ie.text = arg[lastLineIndex .. $];
ie.containingBlock = blocks[$-1];
blocks[$-1].parts ~= ie.clone;
caret = Caret(this, blocks[$-1].parts[$-1], cast(int) blocks[$-1].parts[$-1].text.length);
}
}
invalidateLayout();
}
void tryMerge(InlineElement into, InlineElement what) {
if(!into.isMergeCompatible(what)) {
return; // cannot merge, different configs
}
// cool, can merge, bring text together...
into.text ~= what.text;
// and remove what
for(size_t a = 0; a < what.containingBlock.parts.length; a++) {
if(what.containingBlock.parts[a] is what) {
for(size_t i = a; i < what.containingBlock.parts.length - 1; i++)
what.containingBlock.parts[i] = what.containingBlock.parts[i + 1];
what.containingBlock.parts = what.containingBlock.parts[0 .. $-1];
}
}
// FIXME: ensure no other carets have a reference to it
}
/// exact = true means return null if no match. otherwise, get the closest one that makes sense for a mouse click.
TextIdentifyResult identify(int x, int y, bool exact = false) {
TextIdentifyResult inexactMatch;
foreach(block; blocks) {
foreach(part; block.parts) {
if(x >= part.boundingBox.left && x < part.boundingBox.right && y >= part.boundingBox.top && y < part.boundingBox.bottom) {
// FIXME binary search
int tidx;
int lastX;
foreach_reverse(idxo, lx; part.letterXs) {
int idx = cast(int) idxo;
if(lx <= x) {
if(lastX && lastX - x < x - lx)
tidx = idx + 1;
else
tidx = idx;
break;
}
lastX = lx;
}
return TextIdentifyResult(part, tidx).fixupNewline;
} else if(!exact) {
// we're not in the box, but are we on the same line?
if(y >= part.boundingBox.top && y < part.boundingBox.bottom)
inexactMatch = TextIdentifyResult(part, x == 0 ? 0 : cast(int) part.text.length);
}
}
}
if(!exact && inexactMatch is TextIdentifyResult.init && blocks.length && blocks[$-1].parts.length)
return TextIdentifyResult(blocks[$-1].parts[$-1], cast(int) blocks[$-1].parts[$-1].text.length).fixupNewline;
return exact ? TextIdentifyResult.init : inexactMatch.fixupNewline;
}
void moveCaretToPixelCoordinates(int x, int y) {
auto result = identify(x, y);
caret.inlineElement = result.element;
caret.offset = result.offset;
}
void selectToPixelCoordinates(int x, int y) {
auto result = identify(x, y);
if(y < caretLastDrawnY1) {
// on a previous line, carat is selectionEnd
selectionEnd = caret;
selectionStart = Caret(this, result.element, result.offset);
} else if(y > caretLastDrawnY2) {
// on a later line
selectionStart = caret;
selectionEnd = Caret(this, result.element, result.offset);
} else {
// on the same line...
if(x <= caretLastDrawnX) {
selectionEnd = caret;
selectionStart = Caret(this, result.element, result.offset);
} else {
selectionStart = caret;
selectionEnd = Caret(this, result.element, result.offset);
}
}
}
/// Call this if the inputs change. It will reflow everything
void redoLayout(ScreenPainter painter) {
//painter.setClipRectangle(boundingBox);
auto pos = Point(boundingBox.left, boundingBox.top);
int lastHeight;
void nl() {
pos.x = boundingBox.left;
pos.y += lastHeight;
}
foreach(block; blocks) {
nl();
foreach(part; block.parts) {
part.letterXs = null;
auto size = painter.textSize(part.text);
version(Windows)
if(part.text.length && part.text[$-1] == '\n')
size.height /= 2; // windows counts the new line at the end, but we don't want that
part.boundingBox = Rectangle(pos.x, pos.y, pos.x + size.width, pos.y + size.height);
foreach(idx, char c; part.text) {
// FIXME: unicode
part.letterXs ~= painter.textSize(part.text[0 .. idx]).width + pos.x;
}
pos.x += size.width;
if(pos.x >= boundingBox.right) {
pos.y += size.height;
pos.x = boundingBox.left;
lastHeight = 0;
} else {
lastHeight = size.height;
}
if(part.text.length && part.text[$-1] == '\n')
nl();
}
}
layoutInvalidated = false;
}
bool layoutInvalidated = true;
void invalidateLayout() {
layoutInvalidated = true;
}
// FIXME: caret can remain sometimes when inserting
// FIXME: inserting at the beginning once you already have something can eff it up.
void drawInto(ScreenPainter painter, bool focused = false) {
if(layoutInvalidated)
redoLayout(painter);
foreach(block; blocks) {
foreach(part; block.parts) {
painter.outlineColor = part.color;
painter.fillColor = part.backgroundColor;
auto pos = part.boundingBox.upperLeft;
auto size = part.boundingBox.size;
painter.drawText(pos, part.text);
if(part.styles & TextFormat.underline)
painter.drawLine(Point(pos.x, pos.y + size.height - 4), Point(pos.x + size.width, pos.y + size.height - 4));
if(part.styles & TextFormat.strikethrough)
painter.drawLine(Point(pos.x, pos.y + size.height/2), Point(pos.x + size.width, pos.y + size.height/2));
}
}
// on every redraw, I will force the caret to be
// redrawn too, in order to eliminate perceived lag
// when moving around with the mouse.
eraseCaret(painter);
if(focused) {
highlightSelection(painter);
drawCaret(painter);
}
}
Color selectionXorColor = Color(255, 255, 127);
void highlightSelection(ScreenPainter painter) {
if(selectionStart is selectionEnd)
return; // no selection
if(selectionStart.inlineElement is null) return;
if(selectionEnd.inlineElement is null) return;
assert(selectionStart.inlineElement !is null);
assert(selectionEnd.inlineElement !is null);
painter.rasterOp = RasterOp.xor;
painter.outlineColor = Color.transparent;
painter.fillColor = selectionXorColor;
auto at = selectionStart.inlineElement;
auto atOffset = selectionStart.offset;
bool done;
while(at) {
auto box = at.boundingBox;
if(atOffset < at.letterXs.length)
box.left = at.letterXs[atOffset];
if(at is selectionEnd.inlineElement) {
if(selectionEnd.offset < at.letterXs.length)
box.right = at.letterXs[selectionEnd.offset];
done = true;
}
painter.drawRectangle(box.upperLeft, box.width, box.height);
if(done)
break;
at = at.getNextInlineElement();
atOffset = 0;
}
}
int caretLastDrawnX, caretLastDrawnY1, caretLastDrawnY2;
bool caretShowingOnScreen = false;
void drawCaret(ScreenPainter painter) {
//painter.setClipRectangle(boundingBox);
int x, y1, y2;
if(caret.inlineElement is null) {
x = boundingBox.left;
y1 = boundingBox.top + 2;
y2 = boundingBox.top + painter.fontHeight;
} else {
x = caret.inlineElement.xOfIndex(caret.offset);
y1 = caret.inlineElement.boundingBox.top + 2;
y2 = caret.inlineElement.boundingBox.bottom - 2;
}
if(caretShowingOnScreen && (x != caretLastDrawnX || y1 != caretLastDrawnY1 || y2 != caretLastDrawnY2))
eraseCaret(painter);
painter.pen = Pen(Color.white, 1);
painter.rasterOp = RasterOp.xor;
painter.drawLine(
Point(x, y1),
Point(x, y2)
);
painter.rasterOp = RasterOp.normal;
caretShowingOnScreen = !caretShowingOnScreen;
if(caretShowingOnScreen) {
caretLastDrawnX = x;
caretLastDrawnY1 = y1;
caretLastDrawnY2 = y2;
}
}
Rectangle caretBoundingBox() {
int x, y1, y2;
if(caret.inlineElement is null) {
x = boundingBox.left;
y1 = boundingBox.top + 2;
y2 = boundingBox.top + 16;
} else {
x = caret.inlineElement.xOfIndex(caret.offset);
y1 = caret.inlineElement.boundingBox.top + 2;
y2 = caret.inlineElement.boundingBox.bottom - 2;
}
return Rectangle(x, y1, x + 1, y2);
}
void eraseCaret(ScreenPainter painter) {
//painter.setClipRectangle(boundingBox);
if(!caretShowingOnScreen) return;
painter.pen = Pen(Color.white, 1);
painter.rasterOp = RasterOp.xor;
painter.drawLine(
Point(caretLastDrawnX, caretLastDrawnY1),
Point(caretLastDrawnX, caretLastDrawnY2)
);
caretShowingOnScreen = false;
painter.rasterOp = RasterOp.normal;
}
/// Caret movement api
/// These should give the user a logical result based on what they see on screen...
/// thus they locate predominately by *pixels* not char index. (These will generally coincide with monospace fonts tho!)
void moveUp() {
if(caret.inlineElement is null) return;
auto x = caret.inlineElement.xOfIndex(caret.offset);
auto y = caret.inlineElement.boundingBox.top + 2;
y -= caret.inlineElement.boundingBox.bottom - caret.inlineElement.boundingBox.top;
if(y < 0)
return;
auto i = identify(x, y);
if(i.element) {
caret.inlineElement = i.element;
caret.offset = i.offset;
}
}
void moveDown() {
if(caret.inlineElement is null) return;
auto x = caret.inlineElement.xOfIndex(caret.offset);
auto y = caret.inlineElement.boundingBox.bottom - 2;
y += caret.inlineElement.boundingBox.bottom - caret.inlineElement.boundingBox.top;
auto i = identify(x, y);
if(i.element) {
caret.inlineElement = i.element;
caret.offset = i.offset;
}
}
void moveLeft() {
if(caret.inlineElement is null) return;
if(caret.offset)
caret.offset--;
else {
auto p = caret.inlineElement.getPreviousInlineElement();
if(p) {
caret.inlineElement = p;
if(p.text.length && p.text[$-1] == '\n')
caret.offset = cast(int) p.text.length - 1;
else
caret.offset = cast(int) p.text.length;
}
}
}
void moveRight() {
if(caret.inlineElement is null) return;
if(caret.offset < caret.inlineElement.text.length && caret.inlineElement.text[caret.offset] != '\n') {
caret.offset++;
} else {
auto p = caret.inlineElement.getNextInlineElement();
if(p) {
caret.inlineElement = p;
caret.offset = 0;
}
}
}
void moveHome() {
if(caret.inlineElement is null) return;
auto x = 0;
auto y = caret.inlineElement.boundingBox.top + 2;
auto i = identify(x, y);
if(i.element) {
caret.inlineElement = i.element;
caret.offset = i.offset;
}
}
void moveEnd() {
if(caret.inlineElement is null) return;
auto x = int.max;
auto y = caret.inlineElement.boundingBox.top + 2;
auto i = identify(x, y);
if(i.element) {
caret.inlineElement = i.element;
caret.offset = i.offset;
}
}
void movePageUp(ref Caret caret) {}
void movePageDown(ref Caret caret) {}
void moveDocumentStart(ref Caret caret) {
if(blocks.length && blocks[0].parts.length)
caret = Caret(this, blocks[0].parts[0], 0);
else
caret = Caret.init;
}
void moveDocumentEnd(ref Caret caret) {
if(blocks.length) {
auto parts = blocks[$-1].parts;
if(parts.length) {
caret = Caret(this, parts[$-1], cast(int) parts[$-1].text.length);
} else {
caret = Caret.init;
}
} else
caret = Caret.init;
}
void deleteSelection() {
if(selectionStart is selectionEnd)
return;
if(selectionStart.inlineElement is null) return;
if(selectionEnd.inlineElement is null) return;
assert(selectionStart.inlineElement !is null);
assert(selectionEnd.inlineElement !is null);
auto at = selectionStart.inlineElement;
if(selectionEnd.inlineElement is at) {
// same element, need to chop out
at.text = at.text[0 .. selectionStart.offset] ~ at.text[selectionEnd.offset .. $];
at.letterXs = at.letterXs[0 .. selectionStart.offset] ~ at.letterXs[selectionEnd.offset .. $];
selectionEnd.offset -= selectionEnd.offset - selectionStart.offset;
} else {
// different elements, we can do it with slicing
at.text = at.text[0 .. selectionStart.offset];
if(selectionStart.offset < at.letterXs.length)
at.letterXs = at.letterXs[0 .. selectionStart.offset];
at = at.getNextInlineElement();
while(at) {
if(at is selectionEnd.inlineElement) {
at.text = at.text[selectionEnd.offset .. $];
if(selectionEnd.offset < at.letterXs.length)
at.letterXs = at.letterXs[selectionEnd.offset .. $];
selectionEnd.offset = 0;
break;
} else {
auto cfd = at;
cfd.text = null; // delete the whole thing
at = at.getNextInlineElement();
if(cfd.text.length == 0) {
// and remove cfd
for(size_t a = 0; a < cfd.containingBlock.parts.length; a++) {
if(cfd.containingBlock.parts[a] is cfd) {
for(size_t i = a; i < cfd.containingBlock.parts.length - 1; i++)
cfd.containingBlock.parts[i] = cfd.containingBlock.parts[i + 1];
cfd.containingBlock.parts = cfd.containingBlock.parts[0 .. $-1];
}
}
}
}
}
}
caret = selectionEnd;
selectNone();
invalidateLayout();
}
/// Plain text editing api. These work at the current caret inside the selected inline element.
void insert(in char[] text) {
foreach(dchar ch; text)
insert(ch);
}
/// ditto
void insert(dchar ch) {
bool selectionDeleted = false;
if(selectionStart !is selectionEnd) {
deleteSelection();
selectionDeleted = true;
}
if(ch == 127) {
delete_();
return;
}
if(ch == 8) {
if(!selectionDeleted)
backspace();
return;
}
invalidateLayout();
if(ch == 13) ch = 10;
auto e = caret.inlineElement;
if(e is null) {
addText("" ~ cast(char) ch) ; // FIXME
return;
}
if(caret.offset == e.text.length) {
e.text ~= cast(char) ch; // FIXME
caret.offset++;
if(ch == 10) {
auto c = caret.inlineElement.clone;
c.text = null;
c.letterXs = null;
insertPartAfter(c,e);
caret = Caret(this, c, 0);
}
} else {
// FIXME cast char sucks
if(ch == 10) {
auto c = caret.inlineElement.clone;
c.text = e.text[caret.offset .. $];
if(caret.offset < c.letterXs.length)
c.letterXs = e.letterXs[caret.offset .. $]; // FIXME boundingBox
e.text = e.text[0 .. caret.offset] ~ cast(char) ch;
if(caret.offset <= e.letterXs.length) {
e.letterXs = e.letterXs[0 .. caret.offset] ~ 0; // FIXME bounding box
}
insertPartAfter(c,e);
caret = Caret(this, c, 0);
} else {
e.text = e.text[0 .. caret.offset] ~ cast(char) ch ~ e.text[caret.offset .. $];
caret.offset++;
}
}
}
void insertPartAfter(InlineElement what, InlineElement where) {
foreach(idx, p; where.containingBlock.parts) {
if(p is where) {
if(idx + 1 == where.containingBlock.parts.length)
where.containingBlock.parts ~= what;
else
where.containingBlock.parts = where.containingBlock.parts[0 .. idx + 1] ~ what ~ where.containingBlock.parts[idx + 1 .. $];
return;
}
}
}
void cleanupStructures() {
for(size_t i = 0; i < blocks.length; i++) {
auto block = blocks[i];
for(size_t a = 0; a < block.parts.length; a++) {
auto part = block.parts[a];
if(part.text.length == 0) {
for(size_t b = a; b < block.parts.length - 1; b++)
block.parts[b] = block.parts[b+1];
block.parts = block.parts[0 .. $-1];
}
}
if(block.parts.length == 0) {
for(size_t a = i; a < blocks.length - 1; a++)
blocks[a] = blocks[a+1];
blocks = blocks[0 .. $-1];
}
}
}
void backspace() {
try_again:
auto e = caret.inlineElement;
if(e is null)
return;
if(caret.offset == 0) {
auto prev = e.getPreviousInlineElement();
if(prev is null)
return;
auto newOffset = cast(int) prev.text.length;
tryMerge(prev, e);
caret.inlineElement = prev;
caret.offset = prev is null ? 0 : newOffset;
goto try_again;
} else if(caret.offset == e.text.length) {
e.text = e.text[0 .. $-1];
caret.offset--;
} else {
e.text = e.text[0 .. caret.offset - 1] ~ e.text[caret.offset .. $];
caret.offset--;
}
//cleanupStructures();
invalidateLayout();
}
void delete_() {
if(selectionStart !is selectionEnd)
deleteSelection();
else {
auto before = caret;
moveRight();
if(caret != before) {
backspace();
}
}
invalidateLayout();
}
void overstrike() {}
/// Selection API. See also: caret movement.
void selectAll() {
moveDocumentStart(selectionStart);
moveDocumentEnd(selectionEnd);
}
bool selectNone() {
if(selectionStart != selectionEnd) {
selectionStart = selectionEnd = Caret.init;
return true;
}
return false;
}
/// Rich text editing api. These allow you to manipulate the meta data of the current element and add new elements.
/// They will modify the current selection if there is one and will splice one in if needed.
void changeAttributes() {}
/// Text search api. They manipulate the selection and/or caret.
void findText(string text) {}
void findIndex(size_t textIndex) {}
// sample event handlers
void handleEvent(KeyEvent event) {
//if(event.type == KeyEvent.Type.KeyPressed) {
//}
}
void handleEvent(dchar ch) {
}
void handleEvent(MouseEvent event) {
}
bool contentEditable; // can it be edited?
bool contentCaretable; // is there a caret/cursor that moves around in there?
bool contentSelectable; // selectable?
Caret caret;
Caret selectionStart;
Caret selectionEnd;
bool insertMode;
}
struct Caret {
TextLayout layout;
InlineElement inlineElement;
int offset;
}
enum TextFormat : ushort {
// decorations
underline = 1,
strikethrough = 2,
// font selectors
bold = 0x4000 | 1, // weight 700
light = 0x4000 | 2, // weight 300
veryBoldOrLight = 0x4000 | 4, // weight 100 with light, weight 900 with bold
// bold | light is really invalid but should give weight 500
// veryBoldOrLight without one of the others should just give the default for the font; it should be ignored.
italic = 0x4000 | 8,
smallcaps = 0x4000 | 16,
}
void* findFont(string family, int weight, TextFormat formats) {
return null;
}
}
/++
$(PITFALL This is not yet stable and may break in future versions without notice.)
History:
Added February 19, 2021
+/
/// Group: drag_and_drop
interface DropHandler {
/++
Called when the drag enters the handler's area.
+/
DragAndDropAction dragEnter(DropPackage*);
/++
Called when the drag leaves the handler's area or is
cancelled. You should free your resources when this is called.
+/
void dragLeave();
/++
Called continually as the drag moves over the handler's area.
Returns: feedback to the dragger
+/
DropParameters dragOver(Point pt);
/++
The user dropped the data and you should process it now. You can
access the data through the given [DropPackage].
+/
void drop(scope DropPackage*);
/++
Called when the drop is complete. You should free whatever temporary
resources you were using. It is often reasonable to simply forward
this call to [dragLeave].
+/
void finish();
/++
Parameters returned by [DropHandler.drop].
+/
static struct DropParameters {
/++
Acceptable action over this area.
+/
DragAndDropAction action;
/++
Rectangle, in client coordinates, where the dragger can expect the same result during this drag session and thus need not ask again.
If you leave this as Rectangle.init, the dragger will continue to ask and this can waste resources.
+/
Rectangle consistentWithin;
}
}
/++
History:
Added February 19, 2021
+/
/// Group: drag_and_drop
enum DragAndDropAction {
none = 0,
copy,
move,
link,
ask,
custom
}
/++
An opaque structure representing dropped data. It contains
private, platform-specific data that your `drop` function
should simply forward.
$(PITFALL This is not yet stable and may break in future versions without notice.)
History:
Added February 19, 2021
+/
/// Group: drag_and_drop
struct DropPackage {
/++
Lists the available formats as magic numbers. You should compare these
against looked-up formats (see [DraggableData.getFormatId]) you know you support and can
understand the passed data.
+/
DraggableData.FormatId[] availableFormats() {
version(X11) {
return xFormats;
} else version(Windows) {
if(pDataObj is null)
return null;
typeof(return) ret;
IEnumFORMATETC ef;
if(pDataObj.EnumFormatEtc(DATADIR.DATADIR_GET, &ef) == S_OK) {
FORMATETC fmt;
ULONG fetched;
while(ef.Next(1, &fmt, &fetched) == S_OK) {
if(fetched == 0)
break;
if(fmt.lindex != -1)
continue;
if(fmt.dwAspect != DVASPECT.DVASPECT_CONTENT)
continue;
if(!(fmt.tymed & TYMED.TYMED_HGLOBAL))
continue;
ret ~= fmt.cfFormat;
}
}
return ret;
}
}
/++
Gets data from the drop and optionally accepts it.
Returns:
void because the data is fed asynchronously through the `dg` parameter.
Params:
acceptedAction = the action to report back to the ender. If it is [DragAndDropAction.none], you are just inspecting the data, but not accepting the drop.
This is useful to tell the sender that you accepted a move, for example, so they can update their data source as well. For other cases, accepting a drop also indicates that any memory associated with the transfer can be freed.
Calling `getData` again after accepting a drop is not permitted.
format = the format you want, from [availableFormats]. Use [DraggableData.getFormatId] to convert from a MIME string or well-known standard format.
dg = delegate to receive the data asynchronously. Please note this delegate may be called immediately, never be called, or be called somewhere in between during event loop processing depending on the platform, requested format, and other conditions beyond your control.
Throws:
if `format` was not compatible with the [availableFormats] or if the drop has already been accepted.
History:
Included in first release of [DropPackage].
+/
void getData(DragAndDropAction acceptedAction, DraggableData.FormatId format, void delegate(scope ubyte[] data) dg) {
version(X11) {
auto display = XDisplayConnection.get();
auto selectionAtom = GetAtom!"XdndSelection"(display);
auto best = format;
static class X11GetSelectionHandler_Drop : X11GetSelectionHandler {
XDisplay* display;
Atom selectionAtom;
DraggableData.FormatId best;
DraggableData.FormatId format;
void delegate(scope ubyte[] data) dg;
DragAndDropAction acceptedAction;
Window sourceWindow;
SimpleWindow win;
this(XDisplay* display, SimpleWindow win, Window sourceWindow, DraggableData.FormatId format, Atom selectionAtom, DraggableData.FormatId best, void delegate(scope ubyte[] data) dg, DragAndDropAction acceptedAction) {
this.display = display;
this.win = win;
this.sourceWindow = sourceWindow;
this.format = format;
this.selectionAtom = selectionAtom;
this.best = best;
this.dg = dg;
this.acceptedAction = acceptedAction;
}
mixin X11GetSelectionHandler_Basics;
void handleData(Atom target, in ubyte[] data) {
//if(target == GetAtom!"UTF8_STRING"(XDisplayConnection.get) || target == XA_STRING || target == GetAtom!"text/plain"(XDisplayConnection.get))
dg(cast(ubyte[]) data);
if(acceptedAction != DragAndDropAction.none) {
auto display = XDisplayConnection.get;
XClientMessageEvent xclient;
xclient.type = EventType.ClientMessage;
xclient.window = sourceWindow;
xclient.message_type = GetAtom!"XdndFinished"(display);
xclient.format = 32;
xclient.data.l[0] = win.impl.window;
xclient.data.l[1] = 1; // drop successful
xclient.data.l[2] = dndActionAtom(display, acceptedAction);
XSendEvent(
display,
sourceWindow,
false,
EventMask.NoEventMask,
cast(XEvent*) &xclient
);
XFlush(display);
}
}
Atom findBestFormat(Atom[] answer) {
Atom best = None;
foreach(option; answer) {
if(option == format) {
best = option;
break;
}
/*
if(option == GetAtom!"UTF8_STRING"(XDisplayConnection.get)) {
best = option;
break;
} else if(option == XA_STRING) {
best = option;
} else if(option == GetAtom!"text/plain"(XDisplayConnection.get)) {
best = option;
}
*/
}
return best;
}
}
win.impl.getSelectionHandlers[selectionAtom] = new X11GetSelectionHandler_Drop(display, win, sourceWindow, format, selectionAtom, best, dg, acceptedAction);
XConvertSelection(display, selectionAtom, best, GetAtom!("SDD_DATA", true)(display), win.impl.window, dataTimestamp);
} else version(Windows) {
// clean up like DragLeave
// pass effect back up
FORMATETC t;
assert(format >= 0 && format <= ushort.max);
t.cfFormat = cast(ushort) format;
t.lindex = -1;
t.dwAspect = DVASPECT.DVASPECT_CONTENT;
t.tymed = TYMED.TYMED_HGLOBAL;
STGMEDIUM m;
if(pDataObj.GetData(&t, &m) != S_OK) {
// fail
} else {
// succeed, take the data and clean up
// FIXME: ensure it is legit HGLOBAL
auto handle = m.hGlobal;
if(handle) {
auto sz = GlobalSize(handle);
if(auto ptr = cast(ubyte*) GlobalLock(handle)) {
scope(exit) GlobalUnlock(handle);
scope(exit) GlobalFree(handle);
auto data = ptr[0 .. sz];
dg(data);
}
}
}
}
}
private:
version(X11) {
SimpleWindow win;
Window sourceWindow;
Time dataTimestamp;
Atom[] xFormats;
}
version(Windows) {
IDataObject pDataObj;
}
}
/++
A generic helper base class for making a drop handler with a preference list of custom types.
This is the base for [TextDropHandler] and [FilesDropHandler] and you can use it for your own
droppers too.
It assumes the whole window it used, but you can subclass to change that.
$(PITFALL This is not yet stable and may break in future versions without notice.)
History:
Added February 19, 2021
+/
/// Group: drag_and_drop
class GenericDropHandlerBase : DropHandler {
// no fancy state here so no need to do anything here
void finish() { }
void dragLeave() { }
private DragAndDropAction acceptedAction;
private DraggableData.FormatId acceptedFormat;
private void delegate(scope ubyte[]) acceptedHandler;
struct FormatHandler {
DraggableData.FormatId format;
void delegate(scope ubyte[]) handler;
}
protected abstract FormatHandler[] formatHandlers();
DragAndDropAction dragEnter(DropPackage* pkg) {
debug(sdpy_dnd) { import std.stdio; foreach(fmt; pkg.availableFormats()) writeln(fmt, " ", DraggableData.getFormatName(fmt)); }
foreach(fmt; formatHandlers())
foreach(f; pkg.availableFormats())
if(f == fmt.format) {
acceptedFormat = f;
acceptedHandler = fmt.handler;
return acceptedAction = DragAndDropAction.copy;
}
return acceptedAction = DragAndDropAction.none;
}
DropParameters dragOver(Point pt) {
return DropParameters(acceptedAction);
}
void drop(scope DropPackage* dropPackage) {
if(!acceptedFormat || acceptedHandler is null) {
debug(sdpy_dnd) { import std.stdio; writeln("drop called w/ handler ", acceptedHandler, " and format ", acceptedFormat); }
return; // prolly shouldn't happen anyway...
}
dropPackage.getData(acceptedAction, acceptedFormat, acceptedHandler);
}
}
/++
A simple handler for making your window accept drops of plain text.
$(PITFALL This is not yet stable and may break in future versions without notice.)
History:
Added February 22, 2021
+/
/// Group: drag_and_drop
class TextDropHandler : GenericDropHandlerBase {
private void delegate(in char[] text) dg;
/++
+/
this(void delegate(in char[] text) dg) {
this.dg = dg;
}
protected override FormatHandler[] formatHandlers() {
version(X11)
return [
FormatHandler(GetAtom!"UTF8_STRING"(XDisplayConnection.get), &translator),
FormatHandler(GetAtom!"text/plain;charset=utf-8"(XDisplayConnection.get), &translator),
];
else version(Windows)
return [
FormatHandler(CF_UNICODETEXT, &translator),
];
}
private void translator(scope ubyte[] data) {
version(X11)
dg(cast(char[]) data);
else version(Windows)
dg(makeUtf8StringFromWindowsString(cast(wchar[]) data));
}
}
/++
A simple handler for making your window accept drops of files, issued to you as file names.
$(PITFALL This is not yet stable and may break in future versions without notice.)
History:
Added February 22, 2021
+/
/// Group: drag_and_drop
class FilesDropHandler : GenericDropHandlerBase {
private void delegate(in char[][]) dg;
/++
+/
this(void delegate(in char[][] fileNames) dg) {
this.dg = dg;
}
protected override FormatHandler[] formatHandlers() {
version(X11)
return [
FormatHandler(GetAtom!"text/uri-list"(XDisplayConnection.get), &translator),
];
else version(Windows)
return [
FormatHandler(CF_HDROP, &translator),
];
}
private void translator(scope ubyte[] data) {
version(X11) {
char[] listString = cast(char[]) data;
char[][16] buffer;
int count;
char[][] result = buffer[];
void commit(char[] s) {
if(count == result.length)
result.length += 16;
if(s.length > 7 && s[0 ..7] == "file://")
s = s[7 .. $]; // FIXME: also may need to trim out the host and do some entity decoding
result[count++] = s;
}
size_t last;
foreach(idx, char c; listString) {
if(c == '\n') {
commit(listString[last .. idx - 1]); // a \r
last = idx + 1; // a \n
}
}
if(last < listString.length) {
commit(listString[last .. $]);
}
// FIXME: they are uris now, should I translate it to local file names?
// of course the host name is supposed to be there cuz of X rokking...
dg(result[0 .. count]);
} else version(Windows) {
static struct DROPFILES {
DWORD pFiles;
POINT pt;
BOOL fNC;
BOOL fWide;
}
const(char)[][16] buffer;
int count;
const(char)[][] result = buffer[];
size_t last;
void commitA(in char[] stuff) {
if(count == result.length)
result.length += 16;
result[count++] = stuff;
}
void commitW(in wchar[] stuff) {
commitA(makeUtf8StringFromWindowsString(stuff));
}
void magic(T)(T chars) {
size_t idx;
while(chars[idx]) {
last = idx;
while(chars[idx]) {
idx++;
}
static if(is(T == char*))
commitA(chars[last .. idx]);
else
commitW(chars[last .. idx]);
idx++;
}
}
auto df = cast(DROPFILES*) data.ptr;
if(df.fWide) {
wchar* chars = cast(wchar*) (data.ptr + df.pFiles);
magic(chars);
} else {
char* chars = cast(char*) (data.ptr + df.pFiles);
magic(chars);
}
dg(result[0 .. count]);
}
}
}
/++
Interface to describe data being dragged. See also [draggable] helper function.
$(PITFALL This is not yet stable and may break in future versions without notice.)
History:
Added February 19, 2021
+/
interface DraggableData {
version(X11)
alias FormatId = Atom;
else
alias FormatId = uint;
/++
Gets the platform-specific FormatId associated with the given named format.
This may be a MIME type, but may also be other various strings defined by the
programs you want to interoperate with.
FIXME: sdpy needs to offer data adapter things that look for compatible formats
and convert it to some particular type for you.
+/
static FormatId getFormatId(string name)() {
version(X11)
return GetAtom!name(XDisplayConnection.get);
else version(Windows) {
static UINT cache;
if(!cache)
cache = RegisterClipboardFormatA(name);
return cache;
} else
throw new NotYetImplementedException();
}
/++
Looks up a string to represent the name for the given format, if there is one.
You should avoid using this function because it is slow. It is provided more for
debugging than for primary use.
+/
static string getFormatName(FormatId format) {
version(X11) {
if(format == 0)
return "None";
else
return getAtomName(format, XDisplayConnection.get);
} else version(Windows) {
switch(format) {
case CF_UNICODETEXT: return "CF_UNICODETEXT";
case CF_DIBV5: return "CF_DIBV5";
case CF_RIFF: return "CF_RIFF";
case CF_WAVE: return "CF_WAVE";
case CF_HDROP: return "CF_HDROP";
default:
char[1024] name;
auto count = GetClipboardFormatNameA(format, name.ptr, name.length);
return name[0 .. count].idup;
}
}
}
FormatId[] availableFormats();
// Return the slice of data you filled, empty slice if done.
// this is to support the incremental thing
ubyte[] getData(FormatId format, return scope ubyte[] data);
size_t dataLength(FormatId format);
}
/++
$(PITFALL This is not yet stable and may break in future versions without notice.)
History:
Added February 19, 2021
+/
DraggableData draggable(string s) {
version(X11)
return new class X11SetSelectionHandler_Text, DraggableData {
this() {
super(s);
}
override FormatId[] availableFormats() {
return X11SetSelectionHandler_Text.availableFormats();
}
override ubyte[] getData(FormatId format, return scope ubyte[] data) {
return X11SetSelectionHandler_Text.getData(format, data);
}
size_t dataLength(FormatId format) {
return s.length;
}
};
version(Windows)
return new class DraggableData {
FormatId[] availableFormats() {
return [CF_UNICODETEXT];
}
ubyte[] getData(FormatId format, return scope ubyte[] data) {
return cast(ubyte[]) makeWindowsString(s, cast(wchar[]) data, WindowsStringConversionFlags.convertNewLines | WindowsStringConversionFlags.zeroTerminate);
}
size_t dataLength(FormatId format) {
return sizeOfConvertedWstring(s, WindowsStringConversionFlags.convertNewLines | WindowsStringConversionFlags.zeroTerminate) * wchar.sizeof;
}
};
}
/++
$(PITFALL This is not yet stable and may break in future versions without notice.)
History:
Added February 19, 2021
+/
/// Group: drag_and_drop
int doDragDrop(SimpleWindow window, DraggableData handler, DragAndDropAction action = DragAndDropAction.copy)
in {
assert(window !is null);
assert(handler !is null);
}
do
{
version(X11) {
auto sh = cast(X11SetSelectionHandler) handler;
if(sh is null) {
// gotta make my own adapter.
sh = new class X11SetSelectionHandler {
mixin X11SetSelectionHandler_Basics;
Atom[] availableFormats() { return handler.availableFormats(); }
ubyte[] getData(Atom format, return scope ubyte[] data) {
return handler.getData(format, data);
}
// since the drop selection is only ever used once it isn't important
// to reset it.
void done() {}
};
}
return doDragDropX11(window, sh, action);
} else version(Windows) {
return doDragDropWindows(window, handler, action);
} else throw new NotYetImplementedException();
}
version(Windows)
private int doDragDropWindows(SimpleWindow window, DraggableData handler, DragAndDropAction action = DragAndDropAction.copy) {
IDataObject obj = new class IDataObject {
ULONG refCount;
ULONG AddRef() {
return ++refCount;
}
ULONG Release() {
return --refCount;
}
HRESULT QueryInterface(const (IID)*riid, LPVOID *ppv) {
if (IID_IUnknown == *riid) {
*ppv = cast(void*) cast(IUnknown) this;
}
else if (IID_IDataObject == *riid) {
*ppv = cast(void*) cast(IDataObject) this;
}
else {
*ppv = null;
return E_NOINTERFACE;
}
AddRef();
return NOERROR;
}
HRESULT DAdvise(FORMATETC* pformatetc, DWORD advf, IAdviseSink pAdvSink, DWORD* pdwConnection) {
// import std.stdio; writeln("Advise");
return E_NOTIMPL;
}
HRESULT DUnadvise(DWORD dwConnection) {
return E_NOTIMPL;
}
HRESULT EnumDAdvise(IEnumSTATDATA* ppenumAdvise) {
// import std.stdio; writeln("EnumDAdvise");
return OLE_E_ADVISENOTSUPPORTED;
}
// tell what formats it supports
FORMATETC[] types;
this() {
FORMATETC t;
foreach(ty; handler.availableFormats()) {
assert(ty <= ushort.max && ty >= 0);
t.cfFormat = cast(ushort) ty;
t.lindex = -1;
t.dwAspect = DVASPECT.DVASPECT_CONTENT;
t.tymed = TYMED.TYMED_HGLOBAL;
}
types ~= t;
}
HRESULT EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC* ppenumFormatEtc) {
if(dwDirection == DATADIR.DATADIR_GET) {
*ppenumFormatEtc = new class IEnumFORMATETC {
ULONG refCount;
ULONG AddRef() {
return ++refCount;
}
ULONG Release() {
return --refCount;
}
HRESULT QueryInterface(const (IID)*riid, LPVOID *ppv) {
if (IID_IUnknown == *riid) {
*ppv = cast(void*) cast(IUnknown) this;
}
else if (IID_IEnumFORMATETC == *riid) {
*ppv = cast(void*) cast(IEnumFORMATETC) this;
}
else {
*ppv = null;
return E_NOINTERFACE;
}
AddRef();
return NOERROR;
}
int pos;
this() {
pos = 0;
}
HRESULT Clone(IEnumFORMATETC* ppenum) {
// import std.stdio; writeln("clone");
return E_NOTIMPL; // FIXME
}
// Caller is responsible for freeing memory
HRESULT Next(ULONG celt, FORMATETC* rgelt, ULONG* pceltFetched) {
// fetched may be null if celt is one
if(celt != 1)
return E_NOTIMPL; // FIXME
if(celt + pos > types.length)
return S_FALSE;
*rgelt = types[pos++];
if(pceltFetched !is null)
*pceltFetched = 1;
// import std.stdio; writeln("ok celt ", celt);
return S_OK;
}
HRESULT Reset() {
pos = 0;
return S_OK;
}
HRESULT Skip(ULONG celt) {
if(celt + pos <= types.length) {
pos += celt;
return S_OK;
}
return S_FALSE;
}
};
return S_OK;
} else
return E_NOTIMPL;
}
// given a format, return the format you'd prefer to use cuz it is identical
HRESULT GetCanonicalFormatEtc(FORMATETC* pformatectIn, FORMATETC* pformatetcOut) {
// FIXME: prolly could be better but meh
// import std.stdio; writeln("gcf: ", *pformatectIn);
*pformatetcOut = *pformatectIn;
return S_OK;
}
HRESULT GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium) {
foreach(ty; types) {
if(ty == *pformatetcIn) {
auto format = ty.cfFormat;
// import std.stdio; writeln("A: ", *pformatetcIn, "\nB: ", ty);
STGMEDIUM medium;
medium.tymed = TYMED.TYMED_HGLOBAL;
auto sz = handler.dataLength(format);
auto handle = GlobalAlloc(GMEM_MOVEABLE, sz);
if(handle is null) throw new Exception("GlobalAlloc");
if(auto data = cast(wchar*) GlobalLock(handle)) {
auto slice = data[0 .. sz];
scope(exit)
GlobalUnlock(handle);
handler.getData(format, cast(ubyte[]) slice[]);
}
medium.hGlobal = handle; // FIXME
*pmedium = medium;
return S_OK;
}
}
return DV_E_FORMATETC;
}
HRESULT GetDataHere(FORMATETC* pformatetcIn, STGMEDIUM* pmedium) {
// import std.stdio; writeln("GDH: ", *pformatetcIn);
return E_NOTIMPL; // FIXME
}
HRESULT QueryGetData(FORMATETC* pformatetc) {
auto search = *pformatetc;
search.tymed &= TYMED.TYMED_HGLOBAL;
foreach(ty; types)
if(ty == search) {
// import std.stdio; writeln("QueryGetData ", search, " ", types[0]);
return S_OK;
}
if(pformatetc.cfFormat==CF_UNICODETEXT) {
//import std.stdio; writeln("QueryGetData FALSE ", search, " ", types[0]);
}
return S_FALSE;
}
HRESULT SetData(FORMATETC* pformatetc, STGMEDIUM* pmedium, BOOL fRelease) {
// import std.stdio; writeln("SetData: ");
return E_NOTIMPL;
}
};
IDropSource src = new class IDropSource {
ULONG refCount;
ULONG AddRef() {
return ++refCount;
}
ULONG Release() {
return --refCount;
}
HRESULT QueryInterface(const (IID)*riid, LPVOID *ppv) {
if (IID_IUnknown == *riid) {
*ppv = cast(void*) cast(IUnknown) this;
}
else if (IID_IDropSource == *riid) {
*ppv = cast(void*) cast(IDropSource) this;
}
else {
*ppv = null;
return E_NOINTERFACE;
}
AddRef();
return NOERROR;
}
int QueryContinueDrag(int fEscapePressed, uint grfKeyState) {
if(fEscapePressed)
return DRAGDROP_S_CANCEL;
if(!(grfKeyState & MK_LBUTTON))
return DRAGDROP_S_DROP;
return S_OK;
}
int GiveFeedback(uint dwEffect) {
return DRAGDROP_S_USEDEFAULTCURSORS;
}
};
DWORD effect;
if(action == DragAndDropAction.none) assert(0, "Don't drag something with a none effect.");
DROPEFFECT de = win32DragAndDropAction(action);
// I'm not as concerned about the GC here since DoDragDrop blocks so the stack frame still sane the whole time
// but still prolly a FIXME
auto ret = DoDragDrop(obj, src, de, &effect);
/+
import std.stdio;
if(ret == DRAGDROP_S_DROP)
writeln("drop ", effect);
else if(ret == DRAGDROP_S_CANCEL)
writeln("cancel");
else if(ret == S_OK)
writeln("ok");
else writeln(ret);
+/
return ret;
}
version(Windows)
DROPEFFECT win32DragAndDropAction(DragAndDropAction action) {
DROPEFFECT de;
with(DragAndDropAction)
with(DROPEFFECT)
final switch(action) {
case none: de = DROPEFFECT_NONE; break;
case copy: de = DROPEFFECT_COPY; break;
case move: de = DROPEFFECT_MOVE; break;
case link: de = DROPEFFECT_LINK; break;
case ask: throw new Exception("ask not implemented yet");
case custom: throw new Exception("custom not implemented yet");
}
return de;
}
/++
History:
Added February 19, 2021
+/
/// Group: drag_and_drop
void enableDragAndDrop(SimpleWindow window, DropHandler handler) {
version(X11) {
auto display = XDisplayConnection.get;
Atom atom = 5; // right???
XChangeProperty(
display,
window.impl.window,
GetAtom!"XdndAware"(display),
XA_ATOM,
32 /* bits */,
PropModeReplace,
&atom,
1);
window.dropHandler = handler;
} else version(Windows) {
initDnd();
auto dropTarget = new class (handler) IDropTarget {
DropHandler handler;
this(DropHandler handler) {
this.handler = handler;
}
ULONG refCount;
ULONG AddRef() {
return ++refCount;
}
ULONG Release() {
return --refCount;
}
HRESULT QueryInterface(const (IID)*riid, LPVOID *ppv) {
if (IID_IUnknown == *riid) {
*ppv = cast(void*) cast(IUnknown) this;
}
else if (IID_IDropTarget == *riid) {
*ppv = cast(void*) cast(IDropTarget) this;
}
else {
*ppv = null;
return E_NOINTERFACE;
}
AddRef();
return NOERROR;
}
// ///////////////////
HRESULT DragEnter(IDataObject pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) {
DropPackage dropPackage = DropPackage(pDataObj);
*pdwEffect = win32DragAndDropAction(handler.dragEnter(&dropPackage));
return S_OK; // https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-idroptarget-dragenter
}
HRESULT DragLeave() {
handler.dragLeave();
// release the IDataObject if needed
return S_OK;
}
HRESULT DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) {
auto res = handler.dragOver(Point(pt.x, pt.y)); // FIXME: translate screen coordinates back to window coordinates
*pdwEffect = win32DragAndDropAction(res.action);
// same as DragEnter basically
return S_OK;
}
HRESULT Drop(IDataObject pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) {
DropPackage pkg = DropPackage(pDataObj);
handler.drop(&pkg);
return S_OK;
}
};
// Windows can hold on to the handler and try to call it
// during which time the GC can't see it. so important to
// manually manage this. At some point i'll FIXME and make
// all my com instances manually managed since they supposed
// to respect the refcount.
import core.memory;
GC.addRoot(cast(void*) dropTarget);
if(RegisterDragDrop(window.impl.hwnd, dropTarget) != S_OK)
throw new Exception("register");
window.dropHandler = handler;
} else throw new NotYetImplementedException();
}
static if(UsingSimpledisplayX11) {
enum _NET_WM_STATE_ADD = 1;
enum _NET_WM_STATE_REMOVE = 0;
enum _NET_WM_STATE_TOGGLE = 2;
/// X-specific. Use [SimpleWindow.requestAttention] instead for most cases.
void demandAttention(SimpleWindow window, bool needs = true) {
demandAttention(window.impl.window, needs);
}
/// ditto
void demandAttention(Window window, bool needs = true) {
setNetWmStateAtom(window, GetAtom!("_NET_WM_STATE_DEMANDS_ATTENTION", false)(XDisplayConnection.get), needs);
}
void setNetWmStateAtom(Window window, Atom atom, bool set = true, Atom atom2 = None) {
auto display = XDisplayConnection.get();
if(atom == None)
return; // non-failure error
//auto atom2 = GetAtom!"_NET_WM_STATE_SHADED"(display);
XClientMessageEvent xclient;
xclient.type = EventType.ClientMessage;
xclient.window = window;
xclient.message_type = GetAtom!"_NET_WM_STATE"(display);
xclient.format = 32;
xclient.data.l[0] = set ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
xclient.data.l[1] = atom;
xclient.data.l[2] = atom2;
xclient.data.l[3] = 1;
// [3] == source. 0 == unknown, 1 == app, 2 == else
XSendEvent(
display,
RootWindow(display, DefaultScreen(display)),
false,
EventMask.SubstructureRedirectMask | EventMask.SubstructureNotifyMask,
cast(XEvent*) &xclient
);
/+
XChangeProperty(
display,
window.impl.window,
GetAtom!"_NET_WM_STATE"(display),
XA_ATOM,
32 /* bits */,
PropModeAppend,
&atom,
1);
+/
}
private Atom dndActionAtom(Display* display, DragAndDropAction action) {
Atom actionAtom;
with(DragAndDropAction)
final switch(action) {
case none: actionAtom = None; break;
case copy: actionAtom = GetAtom!"XdndActionCopy"(display); break;
case move: actionAtom = GetAtom!"XdndActionMove"(display); break;
case link: actionAtom = GetAtom!"XdndActionLink"(display); break;
case ask: actionAtom = GetAtom!"XdndActionAsk"(display); break;
case custom: actionAtom = GetAtom!"XdndActionCustom"(display); break;
}
return actionAtom;
}
private int doDragDropX11(SimpleWindow window, X11SetSelectionHandler handler, DragAndDropAction action) {
// FIXME: I need to show user feedback somehow.
auto display = XDisplayConnection.get;
auto actionAtom = dndActionAtom(display, action);
assert(actionAtom, "Don't use action none to accept a drop");
setX11Selection!"XdndSelection"(window, handler, null);
auto oldKeyHandler = window.handleKeyEvent;
scope(exit) window.handleKeyEvent = oldKeyHandler;
auto oldCharHandler = window.handleCharEvent;
scope(exit) window.handleCharEvent = oldCharHandler;
auto oldMouseHandler = window.handleMouseEvent;
scope(exit) window.handleMouseEvent = oldMouseHandler;
Window[Window] eligibility; // 0 == not eligible, otherwise it is the window id of an eligible child
import core.sys.posix.sys.time;
timeval tv;
gettimeofday(&tv, null);
Time dataTimestamp = tv.tv_sec * 1000 + tv.tv_usec / 1000;
Time lastMouseTimestamp;
bool dnding = true;
Window lastIn = None;
void leave() {
if(lastIn == None)
return;
XEvent ev;
ev.xclient.type = EventType.ClientMessage;
ev.xclient.window = lastIn;
ev.xclient.message_type = GetAtom!("XdndLeave", true)(display);
ev.xclient.format = 32;
ev.xclient.data.l[0] = window.impl.window;
XSendEvent(XDisplayConnection.get, lastIn, false, EventMask.NoEventMask, &ev);
XFlush(display);
lastIn = None;
}
void enter(Window w) {
assert(lastIn == None);
lastIn = w;
XEvent ev;
ev.xclient.type = EventType.ClientMessage;
ev.xclient.window = lastIn;
ev.xclient.message_type = GetAtom!("XdndEnter", true)(display);
ev.xclient.format = 32;
ev.xclient.data.l[0] = window.impl.window;
ev.xclient.data.l[1] = (5 << 24) | 0; // version 5, no more sources. FIXME source types
auto types = handler.availableFormats();
assert(types.length > 0);
ev.xclient.data.l[2] = types[0];
if(types.length > 1)
ev.xclient.data.l[3] = types[1];
if(types.length > 2)
ev.xclient.data.l[4] = types[2];
// FIXME: other types?!?!? and make sure we skip TARGETS
XSendEvent(XDisplayConnection.get, lastIn, false, EventMask.NoEventMask, &ev);
XFlush(display);
}
void position(int rootX, int rootY) {
assert(lastIn != None);
XEvent ev;
ev.xclient.type = EventType.ClientMessage;
ev.xclient.window = lastIn;
ev.xclient.message_type = GetAtom!("XdndPosition", true)(display);
ev.xclient.format = 32;
ev.xclient.data.l[0] = window.impl.window;
ev.xclient.data.l[1] = 0; // reserved
ev.xclient.data.l[2] = (rootX << 16) | rootY;
ev.xclient.data.l[3] = dataTimestamp;
ev.xclient.data.l[4] = actionAtom;
XSendEvent(XDisplayConnection.get, lastIn, false, EventMask.NoEventMask, &ev);
XFlush(display);
}
void drop() {
XEvent ev;
ev.xclient.type = EventType.ClientMessage;
ev.xclient.window = lastIn;
ev.xclient.message_type = GetAtom!("XdndDrop", true)(display);
ev.xclient.format = 32;
ev.xclient.data.l[0] = window.impl.window;
ev.xclient.data.l[1] = 0; // reserved
ev.xclient.data.l[2] = dataTimestamp;
XSendEvent(XDisplayConnection.get, lastIn, false, EventMask.NoEventMask, &ev);
XFlush(display);
lastIn = None;
dnding = false;
}
// fyi nativeEventHandler can return 0 if it handles it, or otherwise it goes back to the normal handler
// but idk if i should...
window.setEventHandlers(
delegate(KeyEvent ev) {
if(ev.pressed == true && ev.key == Key.Escape) {
// cancel
dnding = false;
}
},
delegate(MouseEvent ev) {
if(ev.timestamp < lastMouseTimestamp)
return;
lastMouseTimestamp = ev.timestamp;
if(ev.type == MouseEventType.motion) {
auto display = XDisplayConnection.get;
auto root = RootWindow(display, DefaultScreen(display));
Window topWindow;
int rootX, rootY;
XTranslateCoordinates(display, window.impl.window, root, ev.x, ev.y, &rootX, &rootY, &topWindow);
if(topWindow == None)
return;
top:
if(auto result = topWindow in eligibility) {
auto dropWindow = *result;
if(dropWindow == None) {
leave();
return;
}
if(dropWindow != lastIn) {
leave();
enter(dropWindow);
position(rootX, rootY);
} else {
position(rootX, rootY);
}
} else {
// determine eligibility
auto data = cast(Atom[]) getX11PropertyData(topWindow, GetAtom!"XdndAware"(display), XA_ATOM);
if(data.length == 1) {
// in case there is no WM or it isn't reparenting
eligibility[topWindow] = (data[0] == 5) ? topWindow : None; // FIXME I'm supposed to handle older versions too but meh
} else {
Window tryScanChildren(Window search, int maxRecurse) {
// could be reparenting window manager, so gotta check the next few children too
Window child;
int x;
int y;
XTranslateCoordinates(display, window.impl.window, search, ev.x, ev.y, &x, &y, &child);
if(child == None)
return None;
auto data = cast(Atom[]) getX11PropertyData(child, GetAtom!"XdndAware"(display), XA_ATOM);
if(data.length == 1) {
return (data[0] == 5) ? child : None; // FIXME I'm supposed to handle older versions too but meh
} else {
if(maxRecurse)
return tryScanChildren(child, maxRecurse - 1);
else
return None;
}
}
// if a WM puts more than 3 layers on it, like wtf is it doing, screw that.
auto topResult = tryScanChildren(topWindow, 3);
// it is easy to have a false negative due to the mouse going over a WM
// child window like the close button if separate from the frame... so I
// can't really cache negatives, :(
if(topResult != None) {
eligibility[topWindow] = topResult;
goto top; // reload to do the positioning iff eligibility changed lest we endless loop
}
}
}
} else if(ev.type == MouseEventType.buttonReleased) {
drop();
dnding = false;
}
}
);
window.grabInput();
scope(exit)
window.releaseInputGrab();
EventLoop.get.run(() => dnding);
return 0;
}
/// X-specific
TrueColorImage getWindowNetWmIcon(Window window) {
try {
auto display = XDisplayConnection.get;
auto data = getX11PropertyData (window, GetAtom!"_NET_WM_ICON"(display), XA_CARDINAL);
if (data.length > arch_ulong.sizeof * 2) {
auto meta = cast(arch_ulong[]) (data[0 .. arch_ulong.sizeof * 2]);
// these are an array of rgba images that we have to convert into pixmaps ourself
int width = cast(int) meta[0];
int height = cast(int) meta[1];
auto bytes = cast(ubyte[]) (data[arch_ulong.sizeof * 2 .. $]);
static if(arch_ulong.sizeof == 4) {
bytes = bytes[0 .. width * height * 4];
alias imageData = bytes;
} else static if(arch_ulong.sizeof == 8) {
bytes = bytes[0 .. width * height * 8];
auto imageData = new ubyte[](4 * width * height);
} else static assert(0);
// this returns ARGB. Remember it is little-endian so
// we have BGRA
// our thing uses RGBA, which in little endian, is ABGR
for(int idx = 0, idx2 = 0; idx < bytes.length; idx += arch_ulong.sizeof, idx2 += 4) {
auto r = bytes[idx + 2];
auto g = bytes[idx + 1];
auto b = bytes[idx + 0];
auto a = bytes[idx + 3];
imageData[idx2 + 0] = r;
imageData[idx2 + 1] = g;
imageData[idx2 + 2] = b;
imageData[idx2 + 3] = a;
}
return new TrueColorImage(width, height, imageData);
}
return null;
} catch(Exception e) {
return null;
}
}
} /* UsingSimpledisplayX11 */
void loadBinNameToWindowClassName () {
import core.stdc.stdlib : realloc;
version(linux) {
// args[0] MAY be empty, so we'll just use this
import core.sys.posix.unistd : readlink;
char[1024] ebuf = void; // 1KB should be enough for everyone!
auto len = readlink("/proc/self/exe", ebuf.ptr, ebuf.length);
if (len < 1) return;
} else /*version(Windows)*/ {
import core.runtime : Runtime;
if (Runtime.args.length == 0 || Runtime.args[0].length == 0) return;
auto ebuf = Runtime.args[0];
auto len = ebuf.length;
}
auto pos = len;
while (pos > 0 && ebuf[pos-1] != '/') --pos;
sdpyWindowClassStr = cast(char*)realloc(sdpyWindowClassStr, len-pos+1);
if (sdpyWindowClassStr is null) return; // oops
sdpyWindowClassStr[0..len-pos+1] = 0; // just in case
sdpyWindowClassStr[0..len-pos] = ebuf[pos..len];
}
/++
An interface representing a font.
This is still MAJOR work in progress.
+/
interface DrawableFont {
void drawString(ScreenPainter painter, Point upperLeft, in char[] text);
}
/++
Loads a true type font using [arsd.ttf]. That module must be compiled
in if you choose to use this function.
Be warned: this can be slow and memory hungry, especially on remote connections
to the X server.
This is still MAJOR work in progress.
+/
DrawableFont arsdTtfFont()(in ubyte[] data, int size) {
import arsd.ttf;
static class ArsdTtfFont : DrawableFont {
TtfFont font;
int size;
this(in ubyte[] data, int size) {
font = TtfFont(data);
this.size = size;
}
Sprite[string] cache;
void drawString(ScreenPainter painter, Point upperLeft, in char[] text) {
Sprite sprite = (text in cache) ? *(text in cache) : null;
auto fg = painter.impl._outlineColor;
auto bg = painter.impl._fillColor;
if(sprite is null) {
int width, height;
auto data = font.renderString(text, size, width, height);
auto image = new TrueColorImage(width, height);
int pos = 0;
foreach(y; 0 .. height)
foreach(x; 0 .. width) {
fg.a = data[0];
bg.a = 255;
auto color = alphaBlend(fg, bg);
image.imageData.bytes[pos++] = color.r;
image.imageData.bytes[pos++] = color.g;
image.imageData.bytes[pos++] = color.b;
image.imageData.bytes[pos++] = data[0];
data = data[1 .. $];
}
assert(data.length == 0);
sprite = new Sprite(painter.window, Image.fromMemoryImage(image));
cache[text.idup] = sprite;
}
sprite.drawAt(painter, upperLeft);
}
}
return new ArsdTtfFont(data, size);
}
class NotYetImplementedException : Exception {
this(string file = __FILE__, size_t line = __LINE__) {
super("Not yet implemented", file, line);
}
}
///
__gshared bool librariesSuccessfullyLoaded = true;
///
__gshared bool openGlLibrariesSuccessfullyLoaded = true;
private mixin template DynamicLoadSupplementalOpenGL(Iface) {
mixin(staticForeachReplacement!Iface);
void loadDynamicLibrary() @nogc {
(cast(void function() @nogc) &loadDynamicLibraryForReal)();
}
void loadDynamicLibraryForReal() {
foreach(name; __traits(derivedMembers, Iface)) {
mixin("alias tmp = " ~ name ~ ";");
tmp = cast(typeof(tmp)) glbindGetProcAddress(name);
if(tmp is null) throw new Exception("load failure of function " ~ name ~ " from supplemental OpenGL");
}
}
}
private const(char)[] staticForeachReplacement(Iface)() pure {
/*
// just this for gdc 9....
// when i drop support for it and switch to gdc10, we can put this original back for a slight compile time ram decrease
static foreach(name; __traits(derivedMembers, Iface))
mixin("__gshared typeof(&__traits(getMember, Iface, name)) " ~ name ~ ";");
*/
char[] code = new char[](__traits(derivedMembers, Iface).length * 64);
size_t pos;
void append(in char[] what) {
if(pos + what.length > code.length)
code.length = (code.length * 3) / 2;
code[pos .. pos + what.length] = what[];
pos += what.length;
}
foreach(name; __traits(derivedMembers, Iface)) {
append(`__gshared typeof(&__traits(getMember, Iface, "`);
append(name);
append(`")) `);
append(name);
append(";");
}
return code[0 .. pos];
}
private mixin template DynamicLoad(Iface, string library, int majorVersion, alias success) {
mixin(staticForeachReplacement!Iface);
private __gshared void* libHandle;
private __gshared bool attempted;
void loadDynamicLibrary() @nogc {
(cast(void function() @nogc) &loadDynamicLibraryForReal)();
}
bool loadAttempted() {
return attempted;
}
bool loadSuccessful() {
return libHandle !is null;
}
void loadDynamicLibraryForReal() {
attempted = true;
version(Posix) {
import core.sys.posix.dlfcn;
version(OSX) {
version(X11)
libHandle = dlopen("/usr/X11/lib/lib" ~ library ~ ".dylib", RTLD_NOW);
else
libHandle = dlopen(library ~ ".dylib", RTLD_NOW);
} else {
libHandle = dlopen("lib" ~ library ~ ".so", RTLD_NOW);
if(libHandle is null)
libHandle = dlopen(("lib" ~ library ~ ".so." ~ toInternal!string(majorVersion) ~ "\0").ptr, RTLD_NOW);
}
static void* loadsym(void* l, const char* name) {
import core.stdc.stdlib;
if(l is null)
return &abort;
return dlsym(l, name);
}
} else version(Windows) {
import core.sys.windows.winbase;
libHandle = LoadLibrary(library ~ ".dll");
static void* loadsym(void* l, const char* name) {
import core.stdc.stdlib;
if(l is null)
return &abort;
return GetProcAddress(l, name);
}
}
if(libHandle is null) {
success = false;
//throw new Exception("load failure of library " ~ library);
}
foreach(name; __traits(derivedMembers, Iface)) {
mixin("alias tmp = " ~ name ~ ";");
tmp = cast(typeof(tmp)) loadsym(libHandle, name);
if(tmp is null) throw new Exception("load failure of function " ~ name ~ " from " ~ library);
}
}
void unloadDynamicLibrary() {
version(Posix) {
import core.sys.posix.dlfcn;
dlclose(libHandle);
} else version(Windows) {
import core.sys.windows.winbase;
FreeLibrary(libHandle);
}
foreach(name; __traits(derivedMembers, Iface))
mixin(name ~ " = null;");
}
}
void guiAbortProcess(string msg) {
import core.stdc.stdlib;
version(Windows) {
WCharzBuffer t = WCharzBuffer(msg);
MessageBoxW(null, t.ptr, "Program Termination"w.ptr, 0);
} else {
import std.stdio;
stderr.writeln(msg);
stderr.flush();
}
abort();
}
private int minInternal(int a, int b) {
return (a < b) ? a : b;
}
private alias scriptable = arsd_jsvar_compatible;
|
D
|
/*
* Hunt - A data validation for DLang based on hunt library.
*
* Copyright (C) 2015-2019, HuntLabs
*
* Website: https://www.huntlabs.net
*
* Licensed under the Apache-2.0 License.
*
*/
module hunt.validation.constraints.Range;
struct Range
{
long min = long.min;
long max = long.max;
string message="must be between {{min}} and {{max}}";
}
|
D
|
// // Before each example:
// CALL_Init();
// / * Example 1: hero-> SetFightRangeBase (42) A simple setter is called, nothing exciting *. Afterwards is hero.fightRangeBase / changed.
// CALL_PushIntParam (42);
// CALL__thiscall (MEM_InstToPtr (hero), oCNpc__SetFightRangeBase_adr);
// / * Example 2: npc-> AI_UnreadySpell () * acts on the NPC as AI_RemoveWeapon (NPC), * /
// CALL__thiscall (MEM_InstToPtr (Falgo), oCNpc__AI_UnreadySpell_adr);
// / * Example 3: npc-> SetAsPlayer () * Same effect as when you press O with NPC in focus * /
// CALL__thiscall (MEM_InstToPtr (Falgo), oCNpc__SetAsPlayer);
// / * Example 4: MEM_Game-> SetAsPlayer (EX_VLK_5076_FALGO_CITY "); * Same effect as in Example 3 demonstrated that string transfer works. * /
// CALL_PushStringParam ("EX_VLK_5076_FALGO_CITY");
// CALL__thiscall (MEM_InstToPtr (MEM_Game), oCGame__SetAsPlayer);
const int oCNPC_DoDie_adr = 6894752; //ocnpc attacker
const int oCNPC_DropUnconscious_adr = 6892560; //float,ocnpc
const int oCNpc_EV_Unconscious_adr = 7014236; //char c
const int oCNpc_ExchangeTorch_adr = 6907456; //void
var C_NPC CALLINT_SymbolBeforeCodepool;
var int CALLINT_Codepool[4095]; //hierein wird assembler code geschrieben
func void CALLINT_GenericExternal() {}; //wird zu einer External gemacht, die Code im Codepool aufruft.
func void CALLINT_callgenericExternal() { //soll die genericExternal aufrufen.
//
//Apply_Options_Game() menu
Doc_Create(); //wird durch call an generic External ersetzt.
};
var zCPar_Symbol CALLINT_GenericExternal_Sym;
var int CALLINT_CODEPOOL_SYMBOLINDEX ;
var int CALLINT_GENERICEXTERNAL_SYMBOLINDEX ;
var int CALLINT_CALLGENERICEXTERNAL_SYMBOLINDEX;
var int CALLINT_cpStart;
var int CALLINT_cpCurrEntryOffset;
var int CALLINT_cpCursorOffset;
var int CALL_result;
func int CALL_GetResult() {
return CALL_result;
};
var int CALL_result_adr;
const int CALLINT_OP_movImToECX = 185; //0xB9
const int CALLINT_OP_pushIm = 104; //0x68
const int CALLINT_OP_call = 232; //0xE8
const int CALLINT_OP_movEAXToMem = 1417; //0x0589
const int CALLINT_OP_retn = 195; //0xC3
func zCPar_Symbol CALLINT_GetSymbol (var int index) {
var zCPar_Symbol result;
result = MEM_PtrToInst (MEM_ReadIntArray (currSymbolTableAddress, index));
MEMINT_StackPushInst (result);
};
func void CALL_Init() {
MEM_InitAll(); //mindestens der Parser muss initialisiert sein
CALLINT_CODEPOOL_SYMBOLINDEX = CALLINT_SymbolBeforeCodepool + 1;
CALLINT_GENERICEXTERNAL_SYMBOLINDEX = CALLINT_SymbolBeforeCodepool + 2;
CALLINT_CALLGENERICEXTERNAL_SYMBOLINDEX = CALLINT_SymbolBeforeCodepool + 3;
//Pointer auf Codepool muss stehen
var zCPar_Symbol sym;
sym = CALLINT_GetSymbol (CALLINT_CODEPOOL_SYMBOLINDEX);
CALLINT_cpStart = sym.content;
//genericExternal muss External Symbol sein
CALLINT_GenericExternal_Sym = CALLINT_GetSymbol (CALLINT_GENERICEXTERNAL_SYMBOLINDEX);
CALLINT_GenericExternal_Sym.bitfield = zPAR_TYPE_FUNC | zPAR_FLAG_EXTERNAL | zPAR_FLAG_CONST;
//callgenericExternal muss genericExternal aufrufen.
sym = CALLINT_GetSymbol (CALLINT_CALLGENERICEXTERNAL_SYMBOLINDEX);
MEM_WriteInt (currParserStackAddress + sym.content + 1, CALLINT_GENERICEXTERNAL_SYMBOLINDEX);
//Adresse von CALL_result holen:
CALL_GetResult();
MEMINT_StackPopInst();
MEMINT_StackPushInst(zPAR_TOK_PUSHINT);
CALL_result_adr = MEMINT_PopInt();
};
func void CALL_PushIntParam(var int param) {
//************************************************
// push param
//************************************************
MEM_WriteInt (CALLINT_cpStart + CALLINT_cpCursorOffset, CALLINT_OP_pushIm);
CALLINT_cpCursorOffset += 1;
MEM_WriteInt (CALLINT_cpStart + CALLINT_cpCursorOffset, param);
CALLINT_cpCursorOffset += 4;
};
func void CALL_PushStringParam (var string param) {
//Absolut unzureichend: Niemals kann mehr als ein String gepusht werden.
CALL_PushIntParam (STRINT_GetStringAddress (param));
};
func void CALL__stdcall (var int adr) {
//************************************************
// Der Call selbst:
//************************************************
printdebug("STDCALL:Checkpoint 1");
MEM_WriteInt (CALLINT_cpStart + CALLINT_cpCursorOffset, CALLINT_OP_call);
CALLINT_cpCursorOffset += 1;
//Vorsicht: Call ist relativ!
printdebug("STDCALL:Checkpoint 2");
MEM_WriteInt (CALLINT_cpStart + CALLINT_cpCursorOffset, adr - CALLINT_cpStart - CALLINT_cpCursorOffset - 4); //-4 weil relativ zum Ende der Instruktion gemessen wird.
CALLINT_cpCursorOffset += 4;
//************************************************
// Ergebnis in Ergebniswert schieben
//************************************************
printdebug("STDCALL:Checkpoint 3");
MEM_WriteInt (CALLINT_cpStart + CALLINT_cpCursorOffset, CALLINT_OP_movEAXToMem);
CALLINT_cpCursorOffset += 2;
printdebug("STDCALL:Checkpoint 4");
MEM_WriteInt (CALLINT_cpStart + CALLINT_cpCursorOffset, CALL_result_adr);
CALLINT_cpCursorOffset += 4;
//************************************************
// return
//************************************************
printdebug("STDCALL:Checkpoint 5");
MEM_WriteInt (CALLINT_cpStart + CALLINT_cpCursorOffset, CALLINT_OP_retn);
CALLINT_cpCursorOffset += 1;
printdebug("STDCALL:Checkpoint 5.3");
//************************************************
// Jetzt gehts los:
//************************************************
CALLINT_GenericExternal_Sym.content = CALLINT_cpStart + CALLINT_cpCurrEntryOffset;
printdebug("STDCALL:Checkpoint 5.6");
CALLINT_callgenericExternal();
printdebug("STDCALL:Checkpoint 6");
//Fürs nächste mal:
CALLINT_cpCurrEntryOffset = CALLINT_cpCursorOffset;
if (CALLINT_cpCursorOffset > 3800) {
//3800 byte vollgeschrieben: Zurück auf los:
CALLINT_cpCursorOffset = 0;
CALLINT_cpCurrEntryOffset = 0;
};
};
func void CALL__thiscall (var int this, var int adr) {
//code zum setzen von ECX setzen, dann normaler Call:
if(this<=0){ MEM_Warn ("THIS in this call is 0 or less!!!"); return;};
if(adr<=0){ MEM_Warn ("ADR in this call is 0 or less!!!");return;};
//************************************************
// ecx <- this
//************************************************
printdebug("TCALL:Checkpoint 1");
MEM_WriteInt (CALLINT_cpStart + CALLINT_cpCursorOffset, CALLINT_OP_movImToECX);
CALLINT_cpCursorOffset += 1;
printdebug("TCALL:Checkpoint 2");
MEM_WriteInt (CALLINT_cpStart + CALLINT_cpCursorOffset, this);
CALLINT_cpCursorOffset += 4;
CALL__stdcall (adr);
};
|
D
|
/**
String validation routines
Copyright: © 2012 RejectedSoftware e.K.
License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file.
Authors: Sönke Ludwig
*/
module vibe.utils.validation;
import vibe.utils.string;
import std.algorithm : canFind;
import std.exception;
import std.compiler;
import std.conv;
import std.string;
import std.utf;
static if (__VERSION__ >= 2060) // does not link pre 2.060
import std.net.isemail;
/** Provides a simple email address validation.
Note that the validation could be stricter in some cases than required. The user name
is forced to be ASCII, which is not strictly required as of RFC 6531. It also does not
allow quotiations for the user name part (RFC 5321).
Invalid email adresses will cause an exception with the error description to be thrown.
*/
string validateEmail(string str, size_t max_length = 64)
{
enforce(str.length <= max_length, "The email address may not be longer than "~to!string(max_length)~"characters.");
auto at_idx = str.indexOf('@');
enforce(at_idx > 0, "Email is missing the '@'.");
validateIdent(str[0 .. at_idx], "!#$%&'*+-/=?^_`{|}~.(),:;<>@[\\]", "An email user name", false);
auto domain = str[at_idx+1 .. $];
auto dot_idx = domain.indexOf('.');
enforce(dot_idx > 0 && dot_idx < str.length-2, "The email domain is not valid.");
enforce(!domain.anyOf(" @,[](){}<>!\"'%&/\\?*#;:|"), "The email domain contains invalid characters.");
static if (__VERSION__ >= 2060)
enforce(isEmail(str) == EmailStatusCode.valid, "The email address is invalid.");
return str;
}
unittest {
assertNotThrown(validateEmail("0a0@b.com"));
assertNotThrown(validateEmail("123@123.com"));
assertThrown(validateEmail("§@b.com"));
}
/** Validates a user name string.
User names may only contain ASCII letters and digits or any of the specified additional
letters.
Invalid user names will cause an exception with the error description to be thrown.
*/
string validateUserName(string str, int min_length = 3, int max_length = 32, string additional_chars = "-_", bool no_number_start = true)
{
enforce(str.length >= min_length,
"The user name must be at least "~to!string(min_length)~" characters long.");
enforce(str.length <= max_length,
"The user name must not be longer than "~to!string(max_length)~" characters.");
validateIdent(str, additional_chars, "A user name", no_number_start);
return str;
}
/** Validates an identifier string as used in most programming languages.
The identifier must begin with a letter or with any of the additional_chars and may
contain only ASCII letters and digits and any of the additional_chars.
Invalid identifiers will cause an exception with the error description to be thrown.
*/
string validateIdent(string str, string additional_chars = "_", string entity_name = "An identifier", bool no_number_start = true)
{
// NOTE: this is meant for ASCII identifiers only!
foreach (i, char ch; str) {
if (ch >= 'a' && ch <= 'z') continue;
if (ch >= 'A' && ch <= 'Z') continue;
if (ch >= '0' && ch <= '9') {
if (!no_number_start || i > 0) continue;
else throw new Exception(entity_name~" must not begin with a number.");
}
if (additional_chars.canFind(ch)) continue;
throw new Exception(entity_name~" may only contain numbers, letters and one of ("~additional_chars~")");
}
return str;
}
/** Checks a password for minimum complexity requirements
*/
string validatePassword(string str, string str_confirm, size_t min_length = 8, size_t max_length = 64)
{
enforce(str.length >= min_length,
"The password must be at least "~to!string(min_length)~" characters long.");
enforce(str.length <= max_length,
"The password must not be longer than "~to!string(max_length)~" characters.");
enforce(str == str_confirm, "The password and the confirmation differ.");
return str;
}
/** Checks if a string falls within the specified length range.
*/
string validateString(string str, size_t min_length = 0, size_t max_length = 0, string entity_name = "String")
{
std.utf.validate(str);
enforce(str.length >= min_length,
entity_name~" must be at least "~to!string(min_length)~" characters long.");
enforce(!max_length || str.length <= max_length,
entity_name~" must not be longer than "~to!string(max_length)~" characters.");
return str;
}
|
D
|
/*** Content import test ***/
import pack.mod1;
import pack.mod2, pack.sample, pack.subpack.mod3;
SampleClass mod1class;
void func() {
SampleClass.foo++;
foopublicImportVar++;
fooprivateImportVar++; // fail
pack2.foopublic.foopublicImportVar++;
pack2.fooprivate.fooprivateImportVar++; // fail
}
|
D
|
/Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Vapor.build/Content/QueryContainer.swift.o : /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/FileIO.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/FormDataCoder+HTTP.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionData.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/Thread.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/URLEncoded.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Deprecated.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/ServeCommand.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/RoutesCommand.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/BootCommand.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Method.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionCache.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/ResponseCodable.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Request/RequestCodable.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Middleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/Middleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/CORSMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/FileMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/DateMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/ErrorMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionsMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+LazyMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/Response.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/AnyResponse.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/MiddlewareConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/NIOServerConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionsConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/ContentConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Request/HTTPMethod+String.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Path.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/JSONCoder+Custom.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/Request+Session.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/Session.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Application.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/RouteCollection.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Function.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Services/VaporProvider.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/Responder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/BasicResponder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/ApplicationResponder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/WebSocketResponder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/PlaintextEncoder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/HTTPMessageContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/ParametersContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/ContentContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/QueryContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/EngineRouter.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/Server.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/NIOServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/RunningServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/WebSocketServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/NIOWebSocketServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Error/Error.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Logging/Logger+LogError.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Error/AbortError.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/Sessions.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/KeyedCacheSessions.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/MemorySessions.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/ContentCoders.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/Exports.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/HTTPStatus.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/Redirect.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/SingleValueGet.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Services/Config+Default.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/CommandConfig+Default.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Services/Services+Default.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Client/Client.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/WebSocketClient.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/NIOWebSocketClient.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Content.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/Content.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Error/Abort.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Request/Request.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/View/Vapor+View.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/HTTP.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Command.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Console.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Logging.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Routing.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/URLEncodedForm.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Validation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/WebSocket.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOWebSocket.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/TemplateKit.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Multipart.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOSHA1/include/CNIOSHA1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/asn1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/tls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/md5.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509.h /usr/local/Cellar/libressl/2.9.2/include/openssl/sha.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rsa.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOZlib/include/CNIOZlib.h /usr/local/Cellar/libressl/2.9.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/hmac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ec.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rand.h /usr/local/Cellar/libressl/2.9.2/include/openssl/conf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/lhash.h /usr/local/Cellar/libressl/2.9.2/include/openssl/stack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/safestack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bn.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bio.h /usr/local/Cellar/libressl/2.9.2/include/openssl/crypto.h /usr/local/Cellar/libressl/2.9.2/include/openssl/srtp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/evp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.9.2/include/openssl/buffer.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.9.2/include/openssl/err.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.9.2/include/openssl/objects.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslv.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509_vfy.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio-ssl-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Vapor.build/Content/QueryContainer~partial.swiftmodule : /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/FileIO.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/FormDataCoder+HTTP.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionData.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/Thread.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/URLEncoded.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Deprecated.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/ServeCommand.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/RoutesCommand.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/BootCommand.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Method.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionCache.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/ResponseCodable.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Request/RequestCodable.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Middleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/Middleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/CORSMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/FileMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/DateMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/ErrorMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionsMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+LazyMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/Response.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/AnyResponse.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/MiddlewareConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/NIOServerConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionsConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/ContentConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Request/HTTPMethod+String.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Path.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/JSONCoder+Custom.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/Request+Session.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/Session.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Application.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/RouteCollection.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Function.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Services/VaporProvider.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/Responder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/BasicResponder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/ApplicationResponder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/WebSocketResponder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/PlaintextEncoder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/HTTPMessageContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/ParametersContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/ContentContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/QueryContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/EngineRouter.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/Server.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/NIOServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/RunningServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/WebSocketServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/NIOWebSocketServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Error/Error.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Logging/Logger+LogError.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Error/AbortError.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/Sessions.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/KeyedCacheSessions.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/MemorySessions.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/ContentCoders.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/Exports.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/HTTPStatus.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/Redirect.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/SingleValueGet.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Services/Config+Default.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/CommandConfig+Default.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Services/Services+Default.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Client/Client.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/WebSocketClient.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/NIOWebSocketClient.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Content.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/Content.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Error/Abort.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Request/Request.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/View/Vapor+View.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/HTTP.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Command.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Console.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Logging.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Routing.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/URLEncodedForm.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Validation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/WebSocket.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOWebSocket.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/TemplateKit.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Multipart.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOSHA1/include/CNIOSHA1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/asn1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/tls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/md5.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509.h /usr/local/Cellar/libressl/2.9.2/include/openssl/sha.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rsa.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOZlib/include/CNIOZlib.h /usr/local/Cellar/libressl/2.9.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/hmac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ec.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rand.h /usr/local/Cellar/libressl/2.9.2/include/openssl/conf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/lhash.h /usr/local/Cellar/libressl/2.9.2/include/openssl/stack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/safestack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bn.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bio.h /usr/local/Cellar/libressl/2.9.2/include/openssl/crypto.h /usr/local/Cellar/libressl/2.9.2/include/openssl/srtp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/evp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.9.2/include/openssl/buffer.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.9.2/include/openssl/err.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.9.2/include/openssl/objects.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslv.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509_vfy.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio-ssl-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Vapor.build/Content/QueryContainer~partial.swiftdoc : /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/FileIO.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/FormDataCoder+HTTP.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionData.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/Thread.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/URLEncoded.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Deprecated.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/ServeCommand.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/RoutesCommand.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/BootCommand.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Method.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionCache.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/ResponseCodable.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Request/RequestCodable.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Middleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/Middleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/CORSMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/FileMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/DateMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/ErrorMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionsMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+LazyMiddleware.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/Response.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/AnyResponse.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Middleware/MiddlewareConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/NIOServerConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/SessionsConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/ContentConfig.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Request/HTTPMethod+String.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Path.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/JSONCoder+Custom.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/Request+Session.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/Session.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Application.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/RouteCollection.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Function.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Services/VaporProvider.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/Responder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/BasicResponder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/ApplicationResponder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/WebSocketResponder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/PlaintextEncoder.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/HTTPMessageContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/ParametersContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/ContentContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/QueryContainer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/EngineRouter.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/Server.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/NIOServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Server/RunningServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/WebSocketServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/NIOWebSocketServer.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Error/Error.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Logging/Logger+LogError.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Error/AbortError.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/Sessions.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/KeyedCacheSessions.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Sessions/MemorySessions.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/ContentCoders.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Utilities/Exports.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/HTTPStatus.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Response/Redirect.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/SingleValueGet.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Services/Config+Default.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Commands/CommandConfig+Default.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Services/Services+Default.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Client/Client.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Client/FoundationClient.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/WebSocketClient.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/WebSocket/NIOWebSocketClient.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Routing/Router+Content.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Content/Content.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Error/Abort.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/Request/Request.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/vapor/Sources/Vapor/View/Vapor+View.swift /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOHTTP1.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/HTTP.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Command.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Console.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Logging.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Routing.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/URLEncodedForm.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Validation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/WebSocket.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/NIOWebSocket.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/TemplateKit.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/Multipart.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOSHA1/include/CNIOSHA1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/asn1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/tls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem2.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/2.9.2/include/openssl/md5.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509.h /usr/local/Cellar/libressl/2.9.2/include/openssl/sha.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rsa.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOZlib/include/CNIOZlib.h /usr/local/Cellar/libressl/2.9.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/hmac.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ec.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/2.9.2/include/openssl/rand.h /usr/local/Cellar/libressl/2.9.2/include/openssl/conf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/2.9.2/include/openssl/dh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/2.9.2/include/openssl/lhash.h /usr/local/Cellar/libressl/2.9.2/include/openssl/stack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/safestack.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ssl.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/2.9.2/include/openssl/pem.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bn.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/2.9.2/include/openssl/bio.h /usr/local/Cellar/libressl/2.9.2/include/openssl/crypto.h /usr/local/Cellar/libressl/2.9.2/include/openssl/srtp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/evp.h /usr/local/Cellar/libressl/2.9.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/2.9.2/include/openssl/buffer.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/2.9.2/include/openssl/err.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/2.9.2/include/openssl/objects.h /usr/local/Cellar/libressl/2.9.2/include/openssl/opensslv.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/2.9.2/include/openssl/x509_vfy.h /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/Jorge/Desktop/Projects/Web/Swift/kisiBootcamp/.build/checkouts/swift-nio-ssl-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
module metric.initiators.kerr;
import metric.interfaces;
import metric.coordinates.boyer;
import math;
import std.math;
import grtrace;
import dbg.draws;
class Kerr : Initiator
{
public Vectorf origin;
public BoyerLinguist coord; //TODO:Werify
public fpnum m;
public fpnum j;
public fpnum Rs;
public fpnum a;
public fpnum a2;
public fpnum r_plus;
struct CachedData
{
fpnum r2;
fpnum r;
fpnum theta;
fpnum sin_theta;
fpnum sin2_theta;
fpnum sin3_theta;
fpnum cos_theta;
fpnum cos2_theta;
fpnum cot_theta;
fpnum delta;
fpnum A;
fpnum sigma;
fpnum sigma2;
fpnum sigma3;
}
private CachedData* cache = null;
this(fpnum mass, fpnum angular_momentum, Vectorf orig)
{
m = mass;
Rs = 2 * m;
origin = orig;
j = angular_momentum;
if (mass == 0)
a = 0;
else
a = angular_momentum / m;
a2 = a * a;
coord = new BoyerLinguist(origin, a);
r_plus = Rs / 2 + sqrt((Rs * Rs) / 4 - a2);
}
this(const Kerr o)
{
origin = o.origin;
coord = new BoyerLinguist(o.coord);
m = o.m;
j = o.j;
Rs = o.Rs;
a = o.a;
a2 = o.a2;
r_plus = o.r_plus;
}
@property Initiator clone() const
{
auto cloned = new Kerr(this);
cloned.cache = new CachedData;
return cloned;
}
@property Initiator cloneParams() const
{
return new Kerr(this);
}
@nogc nothrow size_t getCacheSize() const
{
return CachedData.sizeof;
}
@nogc nothrow void setCacheBuffer(ubyte* prt)
{
cache = cast(CachedData*) prt;
}
void prepareForRequest(Vectorf point)
{
with (cache)
{
Vectorf tmp = point - origin;
fpnum B = (*tmp) - a2;
fpnum C = a2 * tmp.z * tmp.z;
r = sqrt((B + sqrt(B * B + 4 * C)) / 2);
theta = acos(tmp.z / r);
r2 = r * r;
sin_theta = sin(theta);
sin2_theta = sin_theta * sin_theta;
sin3_theta = sin2_theta * sin_theta;
cos_theta = cos(theta);
cos2_theta = cos_theta * cos_theta;
cot_theta = cos_theta / sin_theta;
delta = r2 - Rs * r + a2;
A = (r2 + a2) * (r2 + a2) - a2 * delta * sin2_theta;
sigma = r2 + a2 * cos2_theta;
sigma2 = sigma * sigma;
sigma3 = sigma2 * sigma;
}
}
@property Metric4 getMetricAtPoint() const
{
with (cache)
{
auto met = Metric4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
met[0, 0] = -(1 - (Rs * r) / sigma);
met[0, 3] = -(2 * Rs * a * r * sin2_theta) / sigma;
met[1, 1] = sigma / delta;
met[2, 2] = sigma;
met[3, 3] = (r2 + a2 + (Rs * a2 * r * sin2_theta) / sigma) * sin2_theta;
return met;
}
}
@property Metric4 getLocalMetricAtPoint() const
{
with (cache)
{
return Metric4(-1, 0, 0, 0, (r2 + a2 * cos2_theta) / (r2 + a2), 0, 0,
r2 + a2 * cos2_theta, 0, (r2 + a2) * sin2_theta);
}
}
@property Metric4[3] getDerivativesAtPoint() const
{
assert(0, "NIY");
}
@property Metric4[4] getChristoffelSymbolsAtPoint() const
{
with (cache)
{
Metric4 time, radius, theta, phi;
time = radius = theta = phi = Metric4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
radius[0, 0] = (Rs * delta * (r2 - a2 * cos2_theta)) / (2 * sigma3);
theta[0, 0] = -(Rs * a2 * r * sin_theta * cos_theta) / sigma3;
time[0, 1] = (Rs * (r2 + a2) * (r2 - a2 * cos2_theta)) / (2 * sigma2 * delta);
phi[0, 1] = (Rs * a * (r2 - a2 * cos2_theta)) / (2 * sigma2 * delta);
time[0, 2] = -(Rs * a2 * r * sin_theta * cos_theta) / sigma2;
phi[0, 2] = -(Rs * a * r * cot_theta) / sigma2;
radius[0, 3] = -(delta * Rs * a * sin2_theta * (r2 - a2 * cos2_theta)) / (2 * sigma3);
theta[0, 3] = (Rs * a * r * (r2 + a2) * sin_theta * cos_theta) / sigma3;
radius[1, 1] = (2 * r * a2 * sin2_theta - Rs * (r2 - a2 * cos2_theta)) / (
2 * sigma * delta);
theta[1, 1] = (a2 * sin_theta * cos_theta) / (sigma * delta);
radius[1, 2] = -(a2 * sin_theta * cos_theta) / sigma;
theta[1, 2] = r / sigma;
radius[2, 2] = -(r * delta) / sigma;
theta[2, 2] = -(a2 * sin_theta * cos_theta) / sigma;
phi[2, 3] = (cot_theta / sigma2) * (sigma2 + Rs * a2 * r * sin2_theta);
time[2, 3] = (Rs * a2 * a * r * sin3_theta * cos_theta) / sigma2;
time[1, 3] = (Rs * a * sin2_theta * (a2 * cos2_theta * (a2 - r2) - r2 * (a2 + 3 * r2))) / (
2 * sigma2 * delta);
phi[1, 3] = (2 * r * sigma2 + Rs * (a2 * a2 * sin2_theta * cos2_theta - r2 * (
sigma + r2 + a2))) / (2 * sigma2 * delta);
radius[3, 3] = ((delta * sin2_theta) / (2 * sigma3)) * (
-2 * r * sigma2 + Rs * a2 * sin2_theta * (r2 - a2 * cos2_theta));
theta[3, 3] = -((sin_theta * cos_theta) / sigma3) * (
A * sigma + (r2 + a2) * Rs * a2 * r * sin2_theta);
return [time, radius, theta, phi];
}
}
//locally nonrotating frame
@property Matrix4f getTetradsElementsAtPoint() const //localy nonrotating frame
{
with (cache)
{
fpnum e0 = sqrt(A / (sigma * delta));
auto res = Matrix4f(e0, 0, 0, ((Rs * a * r) / A) * e0, 0,
sqrt(((r2 + a2 * cos2_theta) / (r2 + a2)) * (delta / sigma)),
0, 0, 0, 0, 1, 0, 0, 0, 0, sqrt((r2 + a2) * (sigma / A)));
return res;
}
}
@property Matrix4f getInverseTetradsElementsAtPoint() const
{
with (cache)
{
// sage-math inverse :P
fpnum e0 = sqrt(A / (sigma * delta));
fpnum x = e0;
fpnum y = ((Rs * a * r) / A) * e0;
fpnum z = sqrt(((r2 + a2 * cos2_theta) / (r2 + a2)) * (delta / sigma));
fpnum w = sqrt((r2 + a2) * (sigma / A));
return Matrix4f(1.0 / x, 0, 0, -y / (w * x), 0, 1.0 / z, 0, 0, 0, 0,
1, 0, 0, 0, 0, 1.0 / w);
}
}
@property Matrix4f[4] getDerivativesOfInverseTetradsElementsAtPoint() const
{
with (cache)
{
/*auto deriv_normal_t = Matrix4f(
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0);*/
auto d_r_delta = 2 * r - Rs;
auto d_r_sigma = 2 * r;
auto d_r_A = 2 * (r2 + a2) * 2 * r - a2 * (d_r_delta) * sin2_theta;
auto dr_00 = (1 / (2 * sqrt(A / (sigma * delta)))) * ((d_r_A * sigma * delta - A * (
d_r_sigma * delta + sigma * d_r_delta)) / ((sigma * delta) * (sigma * delta)));
auto dr_03 = Rs * a * ((r * dr_00) / A + (sqrt(A / (sigma * delta))) * (
(A - r * d_r_A) / (A * A)));
auto dr_11 = 2 * Rs * ((r2 - a2) / ((r2 + a2) * (r2 + a2))) * sqrt(
1 - ((Rs * r) / (r2 + a2)));
auto dr_33 = (1 / (2 * sqrt((r2 + a2) * sigma / A))) * (
(A * ((r2 + a2) * d_r_sigma + 2 * r * sigma) - (r2 + a2) * sigma * d_r_A) / (
A * A));
auto d_theta_A = -2 * a2 * delta * sin_theta * cos_theta;
auto d_theta_sigma = -2 * a2 * sin_theta * cos_theta;
auto theta_common = (1 / (2 * sqrt(A / (sigma * delta)))) * (
(d_theta_A * sigma * delta - A * d_theta_sigma * delta) / (
(delta * sigma) * (delta * sigma)));
/*auto deriv_normal_theta = Matrix4f(
theta_common, 0, 0, (Rs*a*r)*(theta_common*A - sqrt(A/(sigma*delta))*d_theta_A)/(A*A),
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, (sqrt(r2+a2))*( (1/(2*sqrt(sigma/A)))*((d_theta_sigma*A - sigma*d_theta_A)/(A*A)) ) );*/
/*auto deriv_normal_phi = Matrix4f(
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0);*/
Matrix4f inverse_tetrad = getInverseTetradsElementsAtPoint;
fpnum a = inverse_tetrad.at!(0);
fpnum b = inverse_tetrad.at!(3);
fpnum c = inverse_tetrad.at!(5);
fpnum d = inverse_tetrad.at!(15);
fpnum x, y, z, w;
Matrix4f t_mat = Matrix4f.Zero; //(inverse_tetrad*deriv_normal_t*inverse_tetrad);
/*
IT*DerR*IT =
[ a^2*x 0 0 a*b*x + (b*w + a*y)*d]
[ 0 c^2*z 0 0]
[ 0 0 0 0]
[ 0 0 0 d^2*w]
IT*DerT*IT =
[ a^2*x 0 0 a*b*x + (a*y + b*z)*d]
[ 0 0 0 0]
[ 0 0 0 0]
[ 0 0 0 d^2*z]
*/
x = dr_00;
y = dr_03;
z = dr_11;
w = dr_33;
//Matrix4f r_mat = (inverse_tetrad*deriv_normal_r*inverse_tetrad);
//Matrix4f theta_mat = (inverse_tetrad*deriv_normal_theta*inverse_tetrad);
Matrix4f r_mat = Matrix4f(a * a * x, 0, 0,
a * b * x + (b * w + a * y) * d, 0, c * c * z, 0, 0, 0, 0,
0, 0, 0, 0, 0, d * d * w);
x = theta_common;
y = (Rs * a * r) * (theta_common * A - sqrt(A / (sigma * delta)) * d_theta_A) / (A * A);
z = (sqrt(r2 + a2)) * ((1 / (2 * sqrt(sigma / A))) * (
(d_theta_sigma * A - sigma * d_theta_A) / (A * A)));
w = 0.0;
Matrix4f theta_mat = Matrix4f(a * a * x, 0, 0,
a * b * x + (a * y + b * z) * d, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, d * d * z);
Matrix4f phi_mat = Matrix4f.Zero; //(inverse_tetrad*deriv_normal_phi*inverse_tetrad);
Matrix4f[4] res = [t_mat, r_mat, theta_mat, phi_mat];
for (byte mat = 0; mat < 4; mat++)
{
for (byte i = 0; i < 16; i++)
{
res[mat][i] = -res[mat][i];
}
}
return res;
}
}
@property bool isInForbidenZone() const
{
with (cache)
{
if (r <= r_plus)
return true;
else
return false;
}
}
@property CoordinateChanger coordinate_system() const
{
return cast(CoordinateChanger) coord;
}
DebugDraw[string] returnDebugRenderObjects() const
{
DebugDraw[string] res;
//TODO:Implement
res["@event_horizon"] = DebugDraw(DrawType.Sphere, Rs, 0,
new Plane(origin, vectorf(0, 0, 0)), null);
res["@ergosphere"] = DebugDraw(DrawType.Sphere, Rs, 0, new Plane(origin,
vectorf(0, 0, 0)), null);
return null;
}
fpnum[string] returnConstantsOfMotion(Vectorf point, Vectorf dir) //TODO: Implement
{
fpnum[string] res;
return res;
}
}
|
D
|
module portal_carpet;
import std.random;
import std.stdio;
import std.string;
import game;
import sgogl;
import animation;
import vector;
import ground;
import agent;
import validatable;
class Portal_carpet_1 : Ground {
static bool type_initialized = false;
static uint image_1;
static void initialize_type(){
if(!type_initialized){
type_initialized = true;
image_1 = gr_load_image("assets/grounds/carpet/portal_carpet_1.png".toStringz, 0);
}
}
bool onq = false;
this(){
animation = new Animation([image_1], 1.0f, Vector2f(0,0), Vector2f(1,1));
}
override string name(){ return "Portal Carpet"; }
override string description(){ return "Ancient carpet woven before the world fell apart. It is commonly laid under portals"; }
override string standard_article(){ return "a"; }
}
|
D
|
/*
* Database - Database abstraction layer for D programing language.
*
* Copyright (C) 2017 Shanghai Putao Technology Co., Ltd
*
* Developer: HuntLabs
*
* Licensed under the Apache-2.0 License.
*
*/
import std.stdio;
import hunt.logging;
import hunt.database;
import std.datetime;
void main() {
writeln("PostgreSQL demo.");
string sql;
int result;
Statement statement;
RowSet rs;
Database db = new Database(
"postgresql://postgres:123456@10.1.11.44:5432/postgres?charset=utf-8");
// //
// writeln("============= Delete ==================");
// sql = `DELETE From public.test where id=1;`;
// result = db.execute(sql);
// tracef("result: %d", result);
// //
// writeln("============= Insert ==================");
// sql = `INSERT INTO public.test(id, val) VALUES (1, 1);`;
// result = db.execute(sql);
// tracef("result: %d", result);
// //
// writeln("============= Update ==================");
// DateTime dt = cast(DateTime) Clock.currTime;
// statement = db.prepare("Update test SET val = :val where id=:id");
// statement.setParameter("id", 1);
// // statement.setParameter("val", dt.toISOExtString());
// statement.setParameter("val", "{$escaped}");
// result = statement.execute();
// tracef("result: %d", result);
// //
// writeln("============= Select ==================");
// statement = db.prepare("SELECT * FROM public.test where id=:id limit 10");
// statement.setParameter("id", 1);
// rs = statement.query();
// foreach (Row row; rs) {
// writeln(row);
// }
//
// writeln("============= Binding ==================");
// statement = db.prepare("SELECT * FROM public.test limit 10");
// rs = statement.query();
// TestEntity[] testEntities = rs.bind!TestEntity();
// foreach (TestEntity t; testEntities) {
// writeln(t);
// }
//
// writeln("============= Simple Binding ==================");
// statement = db.prepare("SELECT * FROM public.test limit 10");
// rs = statement.query();
// TestEntity[] testEntities = rs.bind!TestEntity();
// foreach (TestEntity t; testEntities) {
// writeln(t);
// }
// //
// writeln("============= Class Binding ==================");
// statement = db.prepare("SELECT * FROM test limit 10");
// rs = statement.query();
// ClassEntity[] testEntities = rs.bind!ClassEntity();
// foreach (ClassEntity t; testEntities) {
// writeln(t);
// }
//
writeln("============= Class Binding ==================");
sql = `SELECT a.id as immutable__as__id, a.message as immutable__as__message,
b.id as world__as__id, b.randomnumber as world__as__randomnumber
FROM immutable as a LEFT JOIN world as b on a.id = b.id where a.id=1;`;
statement = db.prepare(sql);
rs = statement.query();
Immutable[] testEntities = rs.bind!(Immutable, (a, b) => a ~ "__as__" ~ b)();
foreach (Immutable t; testEntities) {
writeln(t);
}
db.close();
getchar();
}
import hunt.database.base.Annotations;
import std.conv;
import std.format;
struct TestEntity {
int id;
string val;
}
// Inherit
class EntityBase {
@Column("val")
string value;
}
class ClassEntity : EntityBase {
int id;
string desc;
override string toString() {
return format("id=%d, value=%s, desc=%s", id, value, desc);
}
}
// Join
@Table("immutable")
class Immutable {
int id;
string message;
World world;
override string toString() {
return format("id=%d, message=%s, world={%s}", id, message, world.to!string());
}
}
@Table("world")
class World {
@Ignore("Repeated column")
int id;
string randomnumber;
// int randomnumber;
// float randomnumber;
override string toString() {
return format("id=%d, randomnumber=%s", id, randomnumber);
}
}
|
D
|
/**
* Credentials Manager
*
* Copyright:
* (C) 2011,2012 Jack Lloyd
* (C) 2014-2015 Etienne Cimon
*
* License:
* Botan is released under the Simplified BSD License (see LICENSE.md)
*/
module botan.tls.credentials_manager;
import botan.constants;
static if (BOTAN_HAS_TLS):
import botan.cert.x509.x509cert;
import botan.cert.x509.certstor;
import botan.math.bigint.bigint;
import botan.pubkey.pk_keys;
import botan.algo_base.symkey;
import botan.tls.credentials_manager;
import botan.cert.x509.x509path;
import botan.utils.types;
/**
* Interface for a credentials manager.
*
* A type is a fairly static value that represents the general nature
* of the transaction occuring. Currently used values are "tls-client"
* and "tls-server". Context represents a hostname, email address,
* username, or other identifier.
*/
abstract class TLSCredentialsManager
{
public:
/**
* Return a list of the certificates of CAs that we trust in this
* type/context.
*
* Params:
* type = specifies the type of operation occuring
*
* context = specifies a context relative to type. For instance
* for type "tls-client", context specifies the servers name.
*/
abstract Vector!CertificateStore
trustedCertificateAuthorities(in string type, in string context)
{
return Vector!CertificateStore();
}
/**
* Check the certificate chain is valid up to a trusted root, and
* optionally (if hostname != "") that the hostname given is
* consistent with the leaf certificate.
*
* This function should throw new an exception derived from
* $(D Exception) with an informative what() result if the
* certificate chain cannot be verified.
* Params:
* type = specifies the type of operation occuring
* purported_hostname = specifies the purported hostname
* cert_chain = specifies a certificate chain leading to a
* trusted root CA certificate.
*/
abstract void verifyCertificateChain(in string type,
in string purported_hostname,
const ref Vector!X509Certificate cert_chain)
{
if (cert_chain.empty)
throw new InvalidArgument("Certificate chain was empty");
auto trusted_CAs = trustedCertificateAuthorities(type, purported_hostname);
PathValidationRestrictions restrictions;
auto result = x509PathValidate(cert_chain,
restrictions,
trusted_CAs);
if (!result.successfulValidation())
throw new Exception("Certificate validation failure: " ~ result.resultString());
if (!certInSomeStore(trusted_CAs, result.trustRoot()))
throw new Exception("Certificate chain roots in unknown/untrusted CA");
if (purported_hostname != "" && !cert_chain[0].matchesDnsName(purported_hostname))
throw new Exception("Certificate did not match hostname");
}
/**
* Return a cert chain we can use, ordered from leaf to root,
* or else an empty vector.
*
* It is assumed that the caller can get the private key of the
* leaf with privateKeyFor
*
* Params:
* cert_key_types = specifies the key types desired ("RSA",
* "DSA", "ECDSA", etc), or empty if there
* is no preference by the caller.
*
* type = specifies the type of operation occuring
*
* context = specifies a context relative to type.
*/
abstract Vector!X509Certificate certChain(const ref Vector!string cert_key_types,
in string type,
in string context)
{
return Vector!X509Certificate();
}
/// ditto
final Vector!X509Certificate certChain(T : string[])(auto ref T cert_key_types, in string type, in string context)
{
return certChain(Vector!string(cert_key_types), type, context);
}
/**
* Return a cert chain we can use, ordered from leaf to root,
* or else an empty vector.
*
* It is assumed that the caller can get the private key of the
* leaf with privateKeyFor
*
* Params:
* cert_key_type = specifies the type of key requested
* ("RSA", "DSA", "ECDSA", etc)
*
* type = specifies the type of operation occuring
*
* context = specifies a context relative to type.
*/
abstract Vector!X509Certificate certChainSingleType(in string cert_key_type,
in string type,
in string context)
{
Vector!string cert_types;
cert_types.pushBack(cert_key_type);
return certChain(cert_types, type, context);
}
/**
*
* Params:
* cert = as returned by cert_chain
* type = specifies the type of operation occuring
* context = specifies a context relative to type.
*
* Returns: private key associated with this certificate if we should
* use it with this context.
*
* Notes: this object should retain ownership of the returned key;
* it should not be deleted by the caller.
*/
abstract PrivateKey privateKeyFor(in X509Certificate cert, in string type, in string context)
{
return null;
}
/**
* Params:
* type = specifies the type of operation occuring
* context = specifies a context relative to type.
* Returns: true if we should attempt SRP authentication
*/
abstract bool attemptSrp(in string type, in string context)
{
return false;
}
/**
* Params:
* type = specifies the type of operation occuring
* context = specifies a context relative to type.
* Returns: identifier for client-side SRP auth, if available
for this type/context. Should return empty string
if password auth not desired/available.
*/
abstract string srpIdentifier(in string type, in string context)
{
return "";
}
/**
* Params:
* type = specifies the type of operation occuring
* context = specifies a context relative to type.
* identifier = specifies what identifier we want the
* password for. This will be a value previously returned
* by srp_identifier.
* Returns: password for client-side SRP auth, if available
for this identifier/type/context.
*/
abstract string srpPassword(in string type,
in string context,
in string identifier)
{
return "";
}
/**
* Retrieve SRP verifier parameters
*/
abstract bool srpVerifier(in string type,
in string context,
in string identifier,
ref string group_name,
ref BigInt verifier,
ref Vector!ubyte salt,
bool generate_fake_on_unknown)
{
return false;
}
/**
* Params:
* type = specifies the type of operation occuring
* context = specifies a context relative to type.
* Returns: the PSK identity hint for this type/context
*/
abstract string pskIdentityHint(in string type, in string context)
{
return "";
}
/**
* Params:
* type = specifies the type of operation occuring
* context = specifies a context relative to type.
* identity_hint = was passed by the server (but may be empty)
* Returns: the PSK identity we want to use
*/
abstract string pskIdentity(in string type, in string context, in string identity_hint)
{
return "";
}
/// Override and return true to signal PSK usage
abstract bool hasPsk() {
return false;
}
/**
* Params:
* type = specifies the type of operation occuring
* context = specifies a context relative to type.
* identity = is a PSK identity previously returned by
psk_identity for the same type and context.
* Returns: the PSK used for identity, or throw new an exception if no
* key exists
*/
abstract SymmetricKey psk(in string type, in string context, in string identity)
{
throw new InternalError("No PSK set for identity " ~ identity);
}
}
bool certInSomeStore(const ref Vector!CertificateStore trusted_CAs, in X509Certificate trust_root)
{
foreach (const ref CertificateStore CAs; trusted_CAs[])
if (CAs.certificateKnown(trust_root))
return true;
return false;
}
|
D
|
module graphic.internal.recol;
import std.string;
import basics.alleg5;
import file.filename;
import graphic.color;
import graphic.cutbit;
import graphic.internal.getters;
import graphic.internal.names;
import graphic.internal.vars;
import hardware.tharsis;
package:
void eidrecol(Cutbit cutbit, in SpecialRecol magicnr)
in {
assert (magicnr != SpecialRecol.spritesheets,
"Don't do anything for magicnr == SpecialRecol.spritesheets."
~ " This function is about GUI recoloring without player colors."
~ " Player-dependant GUI code is with the skill button rocoloring.");
}
do {
makeColorDicts();
version (tharsisprofiling)
auto zone = Zone(profiler, "eidrecol magicnr = %d".format(magicnr));
if (! cutbit || ! cutbit.valid)
return;
Albit bitmap = cutbit.albit;
if (magicnr == SpecialRecol.ordinary) {
auto region = al_lock_bitmap(bitmap,
ALLEGRO_PIXEL_FORMAT.ALLEGRO_PIXEL_FORMAT_ANY,
ALLEGRO_LOCK_READWRITE);
assert (region, "can't lock bitmap despite SpecialRecol.ordinary");
}
scope (exit)
if (magicnr == SpecialRecol.ordinary)
al_unlock_bitmap(bitmap);
auto targetBitmap = TargetBitmap(bitmap);
immutable bmp_yl = al_get_bitmap_height(bitmap);
final switch (magicnr) {
case SpecialRecol.ordinary:
for (int y = 0; y < bmp_yl; ++y)
applyToRow(y > cutbit.yl ? dictGuiLight
: dictGuiNormal, bitmap, y);
break;
case SpecialRecol.spritesheets:
assert (false, "See in-contract.");
case SpecialRecol.skillButtonIcons:
recolorAllShadows(bitmap);
for (int y = cutbit.yl + 1; y < bmp_yl; ++y) // only row 1 (of 0, 1)
dictGuiNormalNoShadow.applyToRow(bitmap, y);
break;
case SpecialRecol.panelInfoIcons:
recolorAllShadows(bitmap);
for (int y = cutbit.yl + 1; y < 2 * (cutbit.yl + 1); ++y)
dictGuiNormalNoShadow.applyToRow(bitmap, y);
break;
}
}
Cutbit lockThenRecolor(SpecialRecol magicnr)(
Cutbit sourceCb,
in Style st
) {
// We assume sourceCb to be unlocked, and are going to lock it
// in this function.
if (! sourceCb || ! sourceCb.valid)
return nullCutbit;
Albit lix = sourceCb.albit;
assert (lix);
immutable int lixXl = al_get_bitmap_width (lix);
immutable int lixYl = al_get_bitmap_height(lix);
immutable colBreak = al_get_pixel(lix, lixXl - 1, 0);
void recolorTargetForStyle()
{
version (tharsisprofiling)
auto zone = Zone(profiler, format("recolor-one-bmp-%d", magicnr));
Alcol[Alcol] recolArray = generateRecolArray(st);
Y_LOOP: for (int y = 0; y < lixYl; y++) {
static if (magicnr == SpecialRecol.skillButtonIcons) {
// The skill button icons have two rows: the first has the
// skills in player colors, the second has them greyed out.
// Ignore the second row here.
if (y >= sourceCb.yl + 1)
break Y_LOOP;
}
else static if (magicnr == SpecialRecol.panelInfoIcons) {
// Skip all x pixels in the second row of the little icons.
if (y >= sourceCb.yl + 1 && y < 2 * (sourceCb.yl + 1))
continue Y_LOOP;
}
X_LOOP: for (int x = 0; x < lixXl; x++) {
immutable Alcol col = al_get_pixel(lix, x, y);
static if (magicnr == SpecialRecol.spritesheets) {
// on two consecutive pixels with colBreak, skip for speed
if (col == colBreak && x < lixXl - 1
&& al_get_pixel(lix, x+1, y) == colBreak)
// bad: immediately begin next row, because
// we may have separating colBreak-colored
// frames in the file.
// good: immediately begin next frame. We have already
// advanced into the frame by 1 pixel, as we have
// seen two
x += sourceCb.xl;
}
if (Alcol* colPtr = (col in recolArray))
al_put_pixel(x, y, *colPtr);
}
}
}
// end function recolorForStyle
// now invoke the above code on the single wanted Lix style
Cutbit targetCb = new Cutbit(sourceCb);
version (tharsisprofiling)
auto zone = Zone(profiler, format("recolor-one-foreach-%d", magicnr));
auto lock = LockReadOnly(lix);
auto lock2 = LockReadWrite(targetCb.albit); // see [1] at end of function
auto targetBitmap = TargetBitmap(targetCb.albit);
recolorTargetForStyle();
if (magicnr == SpecialRecol.spritesheets && ! eyesOnSpritesheet)
findEyesOnSpritesheet(sourceCb, colBreak);
/*
* eidrecol() invoked with magicnr != SpecialRecol.ordinary
* expects an already-locked bitmap.
*/
static if (magicnr != SpecialRecol.spritesheets)
eidrecol(targetCb, magicnr);
return targetCb;
/* [1]: Why do we lock targetCb.albit at all?
* I have no idea why we are doing this (2016-03). recolorTargetForStyle
* runs extremely slowly if we don't lock targetCb.albit, even though we
* only write to it. Speculation: al_put_pixel is slow on RAM bitmaps.
*
* We would have to lock targetCb.albit as read-write when going into
* the eidrecol function. So we don't lose anything by locking it earlier.
*/
}
void makeAlcol3DforStyle(in Style st)
{
assert (! alcol3DforStyles[st].isValid, "don't initialize twice");
// Initialize with a default, so we don't query the image several times
// if the image fails to exist
with (alcol3DforStyles[st])
l = m = d = color.white;
Cutbit rclCb = InternalImage.styleRecol.getInternalMutable;
assert (rclCb);
Albit recol = rclCb.albit;
if (recol is null || al_get_bitmap_height(recol) < st - 1) {
logRecoloringError(recol, 0, st);
return;
}
if (al_get_bitmap_width(recol) < 8 + 1) {
logRecoloringError(recol, 8, st);
return;
}
auto lock = LockReadOnly(recol);
with (alcol3DforStyles[st]) {
l = al_get_pixel(recol, 6, st + 1); // st + 1 because row 0 has the
m = al_get_pixel(recol, 7, st + 1); // colors from the source file,
d = al_get_pixel(recol, 8, st + 1); // they don't belong to any style
}
}
// ############################################################################
private:
Alcol[Alcol] dictGuiLight, dictGuiNormal, dictGuiNormalNoShadow;
void makeColorDicts()
{
// I don't dare to make these at compile time, unsure whether Alcol's
// bitwise interpretation depends on color mode chosen by Allegro 5
if (dictGuiLight != null)
return;
dictGuiLight[color.black] = color.transp;
dictGuiLight[color.guiFileSha] = color.guiSha;
dictGuiLight[color.guiFileD] = color.guiPicOn.d;
dictGuiLight[color.guiFileM] = color.guiPicOn.m;
dictGuiLight[color.guiFileL] = color.guiPicOn.l;
dictGuiNormal[color.black] = color.transp;
dictGuiNormal[color.guiFileSha] = color.guiSha;
dictGuiNormal[color.guiFileD] = color.guiPic.d;
dictGuiNormal[color.guiFileM] = color.guiPic.m;
dictGuiNormal[color.guiFileL] = color.guiPic.l;
dictGuiNormalNoShadow = dictGuiNormal.dup;
dictGuiNormalNoShadow.remove(color.guiFileSha);
}
void applyToAllRows(Alcol[Alcol] dict, Albit bitmap)
{
foreach (int row; 0 .. al_get_bitmap_height(bitmap))
dict.applyToRow(bitmap, row);
}
void applyToRow(Alcol[Alcol] dict, Albit bitmap, int row)
{
// We assume the bitmap to be locked for speed!
foreach (int x; 0 .. al_get_bitmap_width(bitmap)) {
immutable Alcol c = al_get_pixel(bitmap, x, row);
if (auto newCol = c in dict)
al_put_pixel(x, row, *newCol);
}
}
void recolorAllShadows(Albit bitmap)
{
foreach (int y; 0 .. al_get_bitmap_height(bitmap))
foreach (int x; 0 .. al_get_bitmap_width(bitmap)) {
immutable Alcol c = al_get_pixel(bitmap, x, y);
if (c == color.guiFileSha)
al_put_pixel(x, y, color.guiSha);
}
}
Alcol[Alcol] generateRecolArray(in Style st)
{
Cutbit rclCb = InternalImage.styleRecol.getInternalMutable;
assert (rclCb);
Albit recol = rclCb.albit;
if (recol is null) {
logRecoloringError(null, 0, st);
return null;
}
auto lock = LockReadOnly(recol);
Alcol[Alcol] recolArray;
if (st < al_get_bitmap_height(recol) - 1)
foreach (x; 0 .. al_get_bitmap_width(recol))
// The first row (y == 0) contains the source pixels. First style
// (garden) is at y == 1. Thus, target colors are at y == st + 1.
recolArray[al_get_pixel(recol, x, 0)] =
al_get_pixel(recol, x, st + 1);
else
logRecoloringError(recol, 0, st);
return recolArray;
}
void logRecoloringError(
Albit recol, // if null, image doesn't exist, say that
in int x, // if > 0, then we tried to read that pixel and it doesn't exist
in Style st,
) {
import file.log;
import std.conv;
logf("Error with the recoloring map %s:",
InternalImage.styleRecol.toBasename);
if (recol is null) {
logf(" -> File doesn't exist or format not supported.");
return;
}
if (st >= al_get_bitmap_height(recol) - 1)
logf(" -> Height is %d, but for style `%s', we need height >= %d.",
al_get_bitmap_height(recol), styleToString(st), st + 1);
if (x > 0)
logf(" -> Width is %d, but we need width >= %d.",
al_get_bitmap_width(recol), x + 1, ".");
}
void findEyesOnSpritesheet(in Cutbit spri, in Alcol colBreak)
{
// We assume spri's Albit to be locked already!
// spri are the unrecolored sprites directly loaded from file.
assert (spri);
assert (! eyesOnSpritesheet, "don't find the eyes twice");
version (tharsisprofiling) {
import hardware.tharsis;
auto zo = Zone(profiler, "eye matrix creation");
}
assert (spri && spri.xfs > 1 && spri.yfs > 1, "need Lix sprites for eyes");
eyesOnSpritesheet = new typeof(eyesOnSpritesheet)(spri.xfs, spri.yfs);
immutable eyeCol = color.lixFileEye;
foreach (int yf; 0 .. spri.yfs)
FRAME_LOOP: foreach (int xf; 0 .. spri.xfs) {
foreach (int y; 0 .. spri.yl)
foreach (int x; 0 .. spri.xl) {
Alcol c = spri.get_pixel(xf, yf, Point(x, y));
if (c == eyeCol) {
// found one eye. Maybe use average of two eyes?
if (x + 2 < spri.xl && spri.get_pixel(xf, yf,
Point(x + 2, y)) == eyeCol)
eyesOnSpritesheet.set(xf, yf, Point(x + 1, y));
else
eyesOnSpritesheet.set(xf, yf, Point(x, y));
continue FRAME_LOOP;
}
else if (c == colBreak)
continue FRAME_LOOP;
}
// We didn't find an eye.
// Sometimes, the lix covers her eyes with her hands.
assert (eyesOnSpritesheet.get(xf, yf) == Point.init);
if (xf > 0) {
// Use the previous frame's eye position then.
eyesOnSpritesheet.set(xf, yf, eyesOnSpritesheet.get(xf-1, yf));
}
else {
// The miner has this problem in the first frame. Hardcode:
eyesOnSpritesheet.set(xf, yf, Point(17, 13));
}
}
}
|
D
|
//------------------------------------------------------------------------------
// Copyright 2007-2011 Mentor Graphics Corporation
// Copyright 2007-2011 Cadence Design Systems, Inc.
// Copyright 2010-2011 Synopsys, Inc.
// Copyright 2014 Coverify Systems Technology
// All Rights Reserved Worldwide
//
// Licensed under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in
// writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See
// the License for the specific language governing
// permissions and limitations under the License.
//------------------------------------------------------------------------------
module uvm.base.uvm_object_defines;
import uvm.base.uvm_object: uvm_object;
import uvm.base.uvm_component: uvm_component;
import uvm.base.uvm_root: uvm_root;
import uvm.base.uvm_registry: uvm_component_registry;
import uvm.base.uvm_factory: uvm_object_wrapper;
import uvm.seq.uvm_sequence_item: uvm_sequence_item;
import uvm.seq.uvm_sequence_base: uvm_sequence_base;
import uvm.base.uvm_object_globals;
public string uvm_object_utils_string()() {
return "mixin uvm_object_utils!(typeof(this));";
}
mixin template uvm_object_utils(T=void)
{
import uvm.meta.meta;
static if(is(T == void)) {
alias typeof(this) U;
}
else {
alias T U;
}
mixin uvm_object_registry_mixin!(U, qualifiedTypeName!U);
mixin m_uvm_object_create_func!(U);
mixin m_uvm_get_type_name_func!(U);
mixin m_uvm_field_auto_utils!(U);
mixin Randomization;
// `uvm_field_utils_begin(U)
}
// mixin template uvm_object_param_utils(T=void)
// {
// static if(is(T == void)) {
// alias typeof(this) U;
// }
// else {
// alias T U;
// }
// mixin m_uvm_object_registry_param!(U);
// mixin m_uvm_object_create_func!(U);
// // `uvm_field_utils_begin(U)
// }
string uvm_component_utils_string()() {
return "mixin uvm_component_utils!(typeof(this));";
}
mixin template uvm_component_utils(T=void)
{
static if(is(T == void)) {
alias typeof(this) U;
}
else {
alias T U;
}
static if(! is(U: uvm_root)) { // do not register uvm_roots with factory
import uvm.meta.meta;
mixin uvm_component_registry_mixin!(U, qualifiedTypeName!U);
}
mixin m_uvm_get_type_name_func!(U);
mixin uvm_component_auto_build_mixin;
mixin uvm_component_auto_elab_mixin;
}
mixin template uvm_component_auto_build_mixin()
{
// overriding function that calls the generic function for automatic
// object construction
override void _uvm__auto_build() {
debug(UVM_AUTO) {
import std.stdio;
writeln("Building .... : ", get_full_name);
}
._uvm__auto_build!(0, typeof(this))(this);
}
}
mixin template uvm_component_auto_elab_mixin()
{
// overriding function that calls the generic function for automatic
// object construction
override void _uvm__auto_elab() {
debug(UVM_AUTO) {
import std.stdio;
writeln("Elaborating .... : ", get_full_name);
}
._uvm__auto_elab!(0, typeof(this))(this);
}
}
// mixin template uvm_component_param_utils(T=void)
// {
// static if(is(T == void)) {
// alias typeof(this) U;
// }
// else {
// alias T U;
// }
// mixin m_uvm_component_registry_param!(U);
// }
// MACRO: `uvm_object_registry
//
// Register a uvm_object-based class with the factory
//
//| `uvm_object_registry(T,S)
//
// Registers a uvm_object-based class ~T~ and lookup
// string ~S~ with the factory. ~S~ typically is the
// name of the class in quotes. The <`uvm_object_utils>
// family of macros uses this macro.
mixin template uvm_object_registry_mixin(T, string S)
{
alias uvm_object_registry!(T,S) type_id;
static public type_id get_type() {
return type_id.get();
}
override public uvm_object_wrapper get_object_type() {
return type_id.get();
}
}
// MACRO: `uvm_component_registry
//
// Registers a uvm_component-based class with the factory
//
//| `uvm_component_registry(T,S)
//
// Registers a uvm_component-based class ~T~ and lookup
// string ~S~ with the factory. ~S~ typically is the
// name of the class in quotes. The <`uvm_object_utils>
// family of macros uses this macro.
mixin template uvm_component_registry_mixin(T, string S)
{
alias uvm_component_registry!(T,S) type_id;
static public type_id get_type() {
return type_id.get();
}
override public uvm_object_wrapper get_object_type() {
return type_id.get();
}
}
// uvm_new_func
// ------------
mixin template uvm_new_func()
{
public this (string name, uvm_component parent) {
super(name, parent);
}
}
//-----------------------------------------------------------------------------
// INTERNAL MACROS - in support of *_utils macros -- do not use directly
//-----------------------------------------------------------------------------
// m_uvm_object_create_func
// ------------------------
mixin template m_uvm_object_create_func(T) {
override public uvm_object create (string name="") {
T tmp;
version(UVM_OBJECT_MUST_HAVE_CONSTRUCTOR) {
if (name=="") tmp = new T();
else tmp = new T(name);
}
else {
tmp = new T();
if (name!="") tmp.set_name(name);
}
return tmp;
}
}
// m_uvm_get_type_name_func
// ----------------------
mixin template m_uvm_get_type_name_func(T) {
import uvm.meta.meta;
enum string type_name = qualifiedTypeName!T;
override public string get_type_name () {
return type_name;
}
}
// // m_uvm_object_registry_internal
// // ------------------------------
// //This is needed due to an issue in of passing down strings
// //created by args to lower level macros.
// mixin template m_uvm_object_registry_internal(T, string S)
// {
// alias uvm_object_registry!(T, S) type_id;
// static public type_id get_type() {
// return type_id.get();
// }
// // do not make static since we need to override this method
// override public uvm_object_wrapper get_object_type() {
// return type_id.get();
// }
// }
// m_uvm_object_registry_param
// ---------------------------
// mixin template m_uvm_object_registry_param(T)
// {
// alias uvm_object_registry!T type_id;
// static public type_id get_type() {
// return type_id.get();
// }
// override public uvm_object_wrapper get_object_type() {
// return type_id.get();
// }
// }
// m_uvm_component_registry_internal
// ---------------------------------
//This is needed due to an issue in of passing down strings
//created by args to lower level macros.
mixin template m_uvm_component_registry_internal(T, string S)
{
alias uvm_component_registry!(T,S) type_id;
static public type_id get_type() {
return type_id.get();
}
override public uvm_object_wrapper get_object_type() {
return type_id.get();
}
}
// versions of the uvm_component_registry macros to be used with
// parameterized classes
// m_uvm_component_registry_param
// ------------------------------
// mixin template m_uvm_component_registry_param(T)
// {
// alias uvm_component_registry!T type_id;
// static public type_id get_type() {
// return type_id.get();
// }
// override public uvm_object_wrapper get_object_type() {
// return type_id.get();
// }
// }
mixin template m_uvm_field_auto_utils(T)
{
void uvm_field_auto_all_fields(alias F, size_t I=0, T)(T lhs, T rhs) {
static if(I < lhs.tupleof.length) {
if(F!(I)(lhs, rhs)) {
// shortcircuit useful for compare etc
return;
}
uvm_field_auto_all_fields!(F, I+1)(lhs, rhs);
}
else static if(is(T B == super) // && B.length > 0
) {
alias BASE = B[0];
static if(! (is(BASE == uvm_component) ||
is(BASE == uvm_object) ||
is(BASE == uvm_sequence_item) ||
is(BASE == uvm_sequence_base))) {
BASE lhs_ = lhs;
BASE rhs_ = rhs;
uvm_field_auto_all_fields!(F, 0)(lhs_, rhs_);
}
}
}
override void uvm_field_auto_setint(string field_name,
uvm_bitstream_t value) {
}
override void uvm_field_auto_setint(string field_name,
ulong value) {
}
// return true if a match occured
void uvm_set_local(size_t I=0, T, U)(T t, U value, string regx,
string prefix="",
ref bool status = false) {
static if(I < t.tupleof.length) {
enum int FLAGS = uvm_field_auto_get_flags!(t, I);
alias E = typeof(t.tupleof[I]);
string name = prefix ~ __traits(identifier, T.tupleof[I]);
static if(FLAGS & UVM_READONLY) {
if(uvm_is_match(regx, name)) {
uvm_report_warning("RDONLY",
format("Readonly argument match %s is ignored",
name),
UVM_NONE);
}
}
else {
if(uvm_is_match(regx, name)) {
uvm_report_info("STRMTC", "set_object()" ~ ": Matched string " ~
regx ~ " to field " ~ name,
UVM_LOW);
static if(is(U: E)) {
t.tupleof[I] = value;
status = true;
}
else static if(is(E: U) && is(U: Object)) {
if(t.tupleof[i] == cast(E) value) {
status = true;
}
}
else {
t.tupleof[I] = cast(E) value;
status = true;
}
}
}
}
}
// Copy
override void uvm_field_auto_copy(uvm_object rhs) {
auto rhs_ = cast(T) rhs;
if(rhs_ is null) {
uvm_error("uvm_field_auto_copy", "cast failed, check type compatability");
}
uvm_field_auto_all_fields!uvm_field_auto_copy_field(this, rhs_);
}
// copy the Ith field
bool uvm_field_auto_copy_field(size_t I=0, T)(T lhs, T rhs) {
enum int FLAGS = uvm_field_auto_get_flags!(lhs, I);
if(FLAGS & UVM_COPY &&
!(FLAGS & UVM_NOCOPY)) {
lhs.tupleof[I] = rhs.tupleof[I];
}
return false;
}
// Comparison
override void uvm_field_auto_compare(uvm_object rhs) {
auto rhs_ = cast(T) rhs;
if(rhs_ is null) {
uvm_error("uvm_field_auto_compare", "cast failed, check type compatability");
}
uvm_field_auto_all_fields!uvm_field_auto_compare_field(this, rhs_);
}
// compare the Ith field
bool uvm_field_auto_compare_field(size_t I=0, T)(T lhs, T rhs) {
import std.traits: isIntegral;
enum int FLAGS = uvm_field_auto_get_flags!(lhs, I);
static if(FLAGS & UVM_COMPARE &&
!(FLAGS & UVM_NOCOMPARE)) {
auto comparer = m_uvm_status_container.comparer;
alias typeof(lhs.tupleof[I]) U;
static if(isBitVector!U) {
if(! lhs.tupleof[I].isLogicEqual(rhs.tupleof[I])) {
comparer.compare_field(__traits(identifier, T.tupleof[I]),
lhs.tupleof[I], rhs.tupleof[I]);
}
}
else // static if(isIntegral!U || isBoolean!U )
{
if(lhs.tupleof[I] != rhs.tupleof[I]) {
comparer.compare_field(__traits(identifier, T.tupleof[I]),
lhs.tupleof[I], rhs.tupleof[I]);
}
}
// else {
// static assert(false, "compare not implemented yet for: " ~
// qualifiedTypeName!U);
// }
if(comparer.result && (comparer.show_max <= comparer.result)) {
// shortcircuit
return true;
}
}
return false;
}
}
template uvm_field_auto_get_flags(alias t, size_t I) {
alias typeof(t) T;
enum int class_flags =
uvm_field_auto_acc_flags!(__traits(getAttributes, T));
enum int FLAGS =
uvm_field_auto_acc_flags!(__traits(getAttributes, t.tupleof[I]));
enum int uvm_field_auto_get_flags = FLAGS | class_flags;
}
template uvm_field_auto_acc_flags(A...)
{
static if(A.length is 0) enum int uvm_field_auto_acc_flags = 0;
else static if(is(typeof(A[0]) == uvm_recursion_policy_enum) ||
is(typeof(A[0]) == uvm_field_auto_enum)) {
enum int uvm_field_auto_acc_flags = A[0] |
uvm_field_auto_acc_flags!(A[1..$]);
}
else {
enum int uvm_field_auto_acc_flags = uvm_field_auto_acc_flags!(A[1..$]);
}
}
|
D
|
// Written in the D programming language.
/** This module is used to manipulate _path strings.
All functions, with the exception of $(LREF expandTilde) (and in some
cases $(LREF absolutePath) and $(LREF relativePath)), are pure
string manipulation functions; they don't depend on any state outside
the program, nor do they perform any actual file system actions.
This has the consequence that the module does not make any distinction
between a _path that points to a directory and a _path that points to a
file, and it does not know whether or not the object pointed to by the
_path actually exists in the file system.
To differentiate between these cases, use $(XREF file,isDir) and
$(XREF file,exists).
Note that on Windows, both the backslash ($(D '\')) and the slash ($(D '/'))
are in principle valid directory separators. This module treats them
both on equal footing, but in cases where a $(I new) separator is
added, a backslash will be used. Furthermore, the $(LREF buildNormalizedPath)
function will replace all slashes with backslashes on that platform.
In general, the functions in this module assume that the input paths
are well-formed. (That is, they should not contain invalid characters,
they should follow the file system's _path format, etc.) The result
of calling a function on an ill-formed _path is undefined. When there
is a chance that a _path or a file name is invalid (for instance, when it
has been input by the user), it may sometimes be desirable to use the
$(LREF isValidFilename) and $(LREF isValidPath) functions to check
this.
Authors:
Lars Tandle Kyllingstad,
$(WEB digitalmars.com, Walter Bright),
Grzegorz Adam Hankiewicz,
Thomas Kühne,
$(WEB erdani.org, Andrei Alexandrescu)
Copyright:
Copyright (c) 2000–2011, the authors. All rights reserved.
License:
$(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0)
Source:
$(PHOBOSSRC std/_path.d)
Macros:
WIKI = Phobos/StdPath
*/
module std.path;
import std.algorithm;
import std.array;
import std.conv;
import std.file: getcwd;
import std.string;
import std.traits;
version(Posix)
{
import core.exception;
import core.stdc.errno;
import core.sys.posix.pwd;
import core.sys.posix.stdlib;
}
/** String used to separate directory names in a path. Under
POSIX this is a slash, under Windows a backslash.
*/
version(Posix) enum string dirSeparator = "/";
else version(Windows) enum string dirSeparator = "\\";
else static assert (0, "unsupported platform");
/** Path separator string. A colon under POSIX, a semicolon
under Windows.
*/
version(Posix) enum string pathSeparator = ":";
else version(Windows) enum string pathSeparator = ";";
else static assert (0, "unsupported platform");
/** Determine whether the given character is a directory separator.
On Windows, this includes both $(D '\') and $(D '/').
On POSIX, it's just $(D '/').
*/
bool isDirSeparator(dchar c) @safe pure nothrow
{
if (c == '/') return true;
version(Windows) if (c == '\\') return true;
return false;
}
/* Determine whether the given character is a drive separator.
On Windows, this is true if c is the ':' character that separates
the drive letter from the rest of the path. On POSIX, this always
returns false.
*/
private bool isDriveSeparator(dchar c) @safe pure nothrow
{
version(Windows) return c == ':';
else return false;
}
/* Combines the isDirSeparator and isDriveSeparator tests. */
version(Windows) private bool isSeparator(dchar c) @safe pure nothrow
{
return isDirSeparator(c) || isDriveSeparator(c);
}
version(Posix) private alias isDirSeparator isSeparator;
/* Helper function that determines the position of the last
drive/directory separator in a string. Returns -1 if none
is found.
*/
private sizediff_t lastSeparator(C)(in C[] path) @safe pure nothrow
if (isSomeChar!C)
{
auto i = (cast(sizediff_t) path.length) - 1;
while (i >= 0 && !isSeparator(path[i])) --i;
return i;
}
version (Windows)
{
private bool isUNC(C)(in C[] path) @safe pure nothrow if (isSomeChar!C)
{
return path.length >= 3 && isDirSeparator(path[0]) && isDirSeparator(path[1])
&& !isDirSeparator(path[2]);
}
private sizediff_t uncRootLength(C)(in C[] path) @safe pure nothrow if (isSomeChar!C)
in { assert (isUNC(path)); }
body
{
sizediff_t i = 3;
while (i < path.length && !isDirSeparator(path[i])) ++i;
if (i < path.length)
{
auto j = i;
do { ++j; } while (j < path.length && isDirSeparator(path[j]));
if (j < path.length)
{
do { ++j; } while (j < path.length && !isDirSeparator(path[j]));
i = j;
}
}
return i;
}
private bool hasDrive(C)(in C[] path) @safe pure nothrow if (isSomeChar!C)
{
return path.length >= 2 && isDriveSeparator(path[1]);
}
private bool isDriveRoot(C)(in C[] path) @safe pure nothrow if (isSomeChar!C)
{
return path.length >= 3 && isDriveSeparator(path[1])
&& isDirSeparator(path[2]);
}
}
/* Helper functions that strip leading/trailing slashes and backslashes
from a path.
*/
private inout(C)[] ltrimDirSeparators(C)(inout(C)[] path) @safe pure nothrow
if (isSomeChar!C)
{
int i = 0;
while (i < path.length && isDirSeparator(path[i])) ++i;
return path[i .. $];
}
private inout(C)[] rtrimDirSeparators(C)(inout(C)[] path) @safe pure nothrow
if (isSomeChar!C)
{
auto i = (cast(sizediff_t) path.length) - 1;
while (i >= 0 && isDirSeparator(path[i])) --i;
return path[0 .. i+1];
}
private inout(C)[] trimDirSeparators(C)(inout(C)[] path) @safe pure nothrow
if (isSomeChar!C)
{
return ltrimDirSeparators(rtrimDirSeparators(path));
}
/** This $(D enum) is used as a template argument to functions which
compare file names, and determines whether the comparison is
case sensitive or not.
*/
enum CaseSensitive : bool
{
/// File names are case insensitive
no = false,
/// File names are case sensitive
yes = true,
/** The default (or most common) setting for the current platform.
That is, $(D no) on Windows and Mac OS X, and $(D yes) on all
POSIX systems except OS X (Linux, *BSD, etc.).
*/
osDefault = osDefaultCaseSensitivity
}
version (Windows) private enum osDefaultCaseSensitivity = false;
else version (OSX) private enum osDefaultCaseSensitivity = false;
else version (Posix) private enum osDefaultCaseSensitivity = true;
else static assert (0);
/** Returns the name of a file, without any leading directory
and with an optional suffix chopped off.
If $(D suffix) is specified, it will be compared to $(D path)
using $(D filenameCmp!cs),
where $(D cs) is an optional template parameter determining whether
the comparison is case sensitive or not. See the
$(LREF filenameCmp) documentation for details.
Examples:
---
assert (baseName("dir/file.ext") == "file.ext");
assert (baseName("dir/file.ext", ".ext") == "file");
assert (baseName("dir/file.ext", ".xyz") == "file.ext");
assert (baseName("dir/filename", "name") == "file");
assert (baseName("dir/subdir/") == "subdir");
version (Windows)
{
assert (baseName(`d:file.ext`) == "file.ext");
assert (baseName(`d:\dir\file.ext`) == "file.ext");
}
---
Note:
This function only strips away the specified suffix. If you want
to remove the extension from a path, regardless of what the extension
is, use $(LREF stripExtension).
If you want the filename without leading directories and without
an extension, combine the functions like this:
---
assert (baseName(stripExtension("dir/file.ext")) == "file");
---
Standards:
This function complies with
$(LINK2 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/basename.html,
the POSIX requirements for the 'basename' shell utility)
(with suitable adaptations for Windows paths).
*/
inout(C)[] baseName(C)(inout(C)[] path)
@trusted pure //TODO: nothrow (BUG 5700)
if (isSomeChar!C)
{
auto p1 = stripDrive(path);
if (p1.empty)
{
version (Windows) if (isUNC(path))
{
return cast(typeof(return)) dirSeparator.dup;
}
return null;
}
auto p2 = rtrimDirSeparators(p1);
if (p2.empty) return p1[0 .. 1];
return p2[lastSeparator(p2)+1 .. $];
}
/// ditto
inout(C)[] baseName(CaseSensitive cs = CaseSensitive.osDefault, C, C1)
(inout(C)[] path, in C1[] suffix)
@safe pure //TODO: nothrow (because of filenameCmp())
if (isSomeChar!C && isSomeChar!C1)
{
auto p = baseName(path);
if (p.length > suffix.length
&& filenameCmp!cs(p[$-suffix.length .. $], suffix) == 0)
{
return p[0 .. $-suffix.length];
}
else return p;
}
unittest
{
assert (baseName("").empty);
assert (baseName("file.ext"w) == "file.ext");
assert (baseName("file.ext"d, ".ext") == "file");
assert (baseName("file", "file"w.dup) == "file");
assert (baseName("dir/file.ext"d.dup) == "file.ext");
assert (baseName("dir/file.ext", ".ext"d) == "file");
assert (baseName("dir/file"w, "file"d) == "file");
assert (baseName("dir///subdir////") == "subdir");
assert (baseName("dir/subdir.ext/", ".ext") == "subdir");
assert (baseName("dir/subdir/".dup, "subdir") == "subdir");
assert (baseName("/"w.dup) == "/");
assert (baseName("//"d.dup) == "/");
assert (baseName("///") == "/");
assert (baseName!(CaseSensitive.yes)("file.ext", ".EXT") == "file.ext");
assert (baseName!(CaseSensitive.no)("file.ext", ".EXT") == "file");
version (Windows)
{
assert (baseName(`dir\file.ext`) == `file.ext`);
assert (baseName(`dir\file.ext`, `.ext`) == `file`);
assert (baseName(`dir\file`, `file`) == `file`);
assert (baseName(`d:file.ext`) == `file.ext`);
assert (baseName(`d:file.ext`, `.ext`) == `file`);
assert (baseName(`d:file`, `file`) == `file`);
assert (baseName(`dir\\subdir\\\`) == `subdir`);
assert (baseName(`dir\subdir.ext\`, `.ext`) == `subdir`);
assert (baseName(`dir\subdir\`, `subdir`) == `subdir`);
assert (baseName(`\`) == `\`);
assert (baseName(`\\`) == `\`);
assert (baseName(`\\\`) == `\`);
assert (baseName(`d:\`) == `\`);
assert (baseName(`d:`).empty);
assert (baseName(`\\server\share\file`) == `file`);
assert (baseName(`\\server\share\`) == `\`);
assert (baseName(`\\server\share`) == `\`);
}
assert (baseName(stripExtension("dir/file.ext")) == "file");
static assert (baseName("dir/file.ext") == "file.ext");
static assert (baseName("dir/file.ext", ".ext") == "file");
}
/** Returns the directory part of a path. On Windows, this
includes the drive letter if present.
Examples:
---
assert (dirName("file") == ".");
assert (dirName("dir/file") == "dir");
assert (dirName("/file") == "/");
assert (dirName("dir/subdir/") == "dir");
version (Windows)
{
assert (dirName("d:file") == "d:");
assert (dirName(`d:\dir\file`) == `d:\dir`);
assert (dirName(`d:\file`) == `d:\`);
assert (dirName(`dir\subdir\`) == `dir`);
}
---
Standards:
This function complies with
$(LINK2 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/dirname.html,
the POSIX requirements for the 'dirname' shell utility)
(with suitable adaptations for Windows paths).
*/
C[] dirName(C)(C[] path)
//TODO: @safe (BUG 6169) pure nothrow (because of to())
if (isSomeChar!C)
{
if (path.empty) return to!(typeof(return))(".");
auto p = rtrimDirSeparators(path);
if (p.empty) return path[0 .. 1];
version (Windows)
{
if (isUNC(p) && uncRootLength(p) == p.length)
return p;
if (p.length == 2 && isDriveSeparator(p[1]) && path.length > 2)
return path[0 .. 3];
}
auto i = lastSeparator(p);
if (i == -1) return to!(typeof(return))(".");
if (i == 0) return p[0 .. 1];
version (Windows)
{
// If the directory part is either d: or d:\, don't
// chop off the last symbol.
if (isDriveSeparator(p[i]) || isDriveSeparator(p[i-1]))
return p[0 .. i+1];
}
// Remove any remaining trailing (back)slashes.
return rtrimDirSeparators(p[0 .. i]);
}
unittest
{
assert (dirName("") == ".");
assert (dirName("file"w) == ".");
assert (dirName("dir/"d) == ".");
assert (dirName("dir///") == ".");
assert (dirName("dir/file"w.dup) == "dir");
assert (dirName("dir///file"d.dup) == "dir");
assert (dirName("dir/subdir/") == "dir");
assert (dirName("/dir/file"w) == "/dir");
assert (dirName("/file"d) == "/");
assert (dirName("/") == "/");
assert (dirName("///") == "/");
version (Windows)
{
assert (dirName(`dir\`) == `.`);
assert (dirName(`dir\\\`) == `.`);
assert (dirName(`dir\file`) == `dir`);
assert (dirName(`dir\\\file`) == `dir`);
assert (dirName(`dir\subdir\`) == `dir`);
assert (dirName(`\dir\file`) == `\dir`);
assert (dirName(`\file`) == `\`);
assert (dirName(`\`) == `\`);
assert (dirName(`\\\`) == `\`);
assert (dirName(`d:`) == `d:`);
assert (dirName(`d:file`) == `d:`);
assert (dirName(`d:\`) == `d:\`);
assert (dirName(`d:\file`) == `d:\`);
assert (dirName(`d:\dir\file`) == `d:\dir`);
assert (dirName(`\\server\share\dir\file`) == `\\server\share\dir`);
assert (dirName(`\\server\share\file`) == `\\server\share`);
assert (dirName(`\\server\share\`) == `\\server\share`);
assert (dirName(`\\server\share`) == `\\server\share`);
}
static assert (dirName("dir/file") == "dir");
}
/** Returns the root directory of the specified path, or $(D null) if the
path is not rooted.
Examples:
---
assert (rootName("foo") is null);
assert (rootName("/foo") == "/");
version (Windows)
{
assert (rootName(`\foo`) == `\`);
assert (rootName(`c:\foo`) == `c:\`);
assert (rootName(`\\server\share\foo`) == `\\server\share`);
}
---
*/
inout(C)[] rootName(C)(inout(C)[] path) @safe pure nothrow if (isSomeChar!C)
{
if (path.empty) return null;
version (Posix)
{
if (isDirSeparator(path[0])) return path[0 .. 1];
}
else version (Windows)
{
if (isDirSeparator(path[0]))
{
if (isUNC(path)) return path[0 .. uncRootLength(path)];
else return path[0 .. 1];
}
else if (path.length >= 3 && isDriveSeparator(path[1]) &&
isDirSeparator(path[2]))
{
return path[0 .. 3];
}
}
else static assert (0, "unsupported platform");
assert (!isRooted(path));
return null;
}
unittest
{
assert (rootName("") is null);
assert (rootName("foo") is null);
assert (rootName("/") == "/");
assert (rootName("/foo/bar") == "/");
version (Windows)
{
assert (rootName("d:foo") is null);
assert (rootName(`d:\foo`) == `d:\`);
assert (rootName(`\\server\share\foo`) == `\\server\share`);
assert (rootName(`\\server\share`) == `\\server\share`);
}
}
/** Returns the drive of a path, or $(D null) if the drive
is not specified. In the case of UNC paths, the network share
is returned.
Always returns $(D null) on POSIX.
Examples:
---
version (Windows)
{
assert (driveName(`d:\file`) == "d:");
assert (driveName(`\\server\share\file`) == `\\server\share`);
assert (driveName(`dir\file`).empty);
}
---
*/
inout(C)[] driveName(C)(inout(C)[] path) @safe pure nothrow
if (isSomeChar!C)
{
version (Windows)
{
if (hasDrive(path))
return path[0 .. 2];
else if (isUNC(path))
return path[0 .. uncRootLength(path)];
}
return null;
}
unittest
{
version (Posix) assert (driveName("c:/foo").empty);
version (Windows)
{
assert (driveName(`dir\file`).empty);
assert (driveName(`d:file`) == "d:");
assert (driveName(`d:\file`) == "d:");
assert (driveName("d:") == "d:");
assert (driveName(`\\server\share\file`) == `\\server\share`);
assert (driveName(`\\server\share\`) == `\\server\share`);
assert (driveName(`\\server\share`) == `\\server\share`);
static assert (driveName(`d:\file`) == "d:");
}
}
/** Strip the drive from a Windows path. On POSIX, this is a noop.
Example:
---
version (Windows)
{
assert (stripDrive(`d:\dir\file`) == `\dir\file`);
assert (stripDrive(`\\server\share\dir\file`) == `\dir\file`);
}
---
*/
inout(C)[] stripDrive(C)(inout(C)[] path) @safe pure nothrow if (isSomeChar!C)
{
version(Windows)
{
if (hasDrive(path)) return path[2 .. $];
else if (isUNC(path)) return path[uncRootLength(path) .. $];
}
return path;
}
unittest
{
version(Windows)
{
assert (stripDrive(`d:\dir\file`) == `\dir\file`);
assert (stripDrive(`\\server\share\dir\file`) == `\dir\file`);
static assert (stripDrive(`d:\dir\file`) == `\dir\file`);
}
version(Posix)
{
assert (stripDrive(`d:\dir\file`) == `d:\dir\file`);
}
}
/* Helper function that returns the position of the filename/extension
separator dot in path. If not found, returns -1.
*/
private sizediff_t extSeparatorPos(C)(in C[] path) @safe pure nothrow
if (isSomeChar!C)
{
auto i = (cast(sizediff_t) path.length) - 1;
while (i >= 0 && !isSeparator(path[i]))
{
if (path[i] == '.' && i > 0 && !isSeparator(path[i-1])) return i;
--i;
}
return -1;
}
/** Get the _extension part of a file name, including the dot.
If there is no _extension, $(D null) is returned.
Examples:
---
assert (extension("file").empty);
assert (extension("file.ext") == ".ext");
assert (extension("file.ext1.ext2") == ".ext2");
assert (extension("file.") == ".");
assert (extension(".file").empty);
assert (extension(".file.ext") == ".ext");
---
*/
inout(C)[] extension(C)(inout(C)[] path) @safe pure nothrow if (isSomeChar!C)
{
auto i = extSeparatorPos(path);
if (i == -1) return null;
else return path[i .. $];
}
unittest
{
assert (extension("file").empty);
assert (extension("file.") == ".");
assert (extension("file.ext"w) == ".ext");
assert (extension("file.ext1.ext2"d) == ".ext2");
assert (extension(".foo".dup).empty);
assert (extension(".foo.ext"w.dup) == ".ext");
assert (extension("dir/file"d.dup).empty);
assert (extension("dir/file.") == ".");
assert (extension("dir/file.ext") == ".ext");
assert (extension("dir/file.ext1.ext2"w) == ".ext2");
assert (extension("dir/.foo"d).empty);
assert (extension("dir/.foo.ext".dup) == ".ext");
version(Windows)
{
assert (extension(`dir\file`).empty);
assert (extension(`dir\file.`) == ".");
assert (extension(`dir\file.ext`) == `.ext`);
assert (extension(`dir\file.ext1.ext2`) == `.ext2`);
assert (extension(`dir\.foo`).empty);
assert (extension(`dir\.foo.ext`) == `.ext`);
assert (extension(`d:file`).empty);
assert (extension(`d:file.`) == ".");
assert (extension(`d:file.ext`) == `.ext`);
assert (extension(`d:file.ext1.ext2`) == `.ext2`);
assert (extension(`d:.foo`).empty);
assert (extension(`d:.foo.ext`) == `.ext`);
}
static assert (extension("file").empty);
static assert (extension("file.ext") == ".ext");
}
/** Return the path with the extension stripped off.
Examples:
---
assert (stripExtension("file") == "file");
assert (stripExtension("file.ext") == "file");
assert (stripExtension("file.ext1.ext2") == "file.ext1");
assert (stripExtension("file.") == "file");
assert (stripExtension(".file") == ".file");
assert (stripExtension(".file.ext") == ".file");
assert (stripExtension("dir/file.ext") == "dir/file");
---
*/
inout(C)[] stripExtension(C)(inout(C)[] path) @safe pure nothrow
if (isSomeChar!C)
{
auto i = extSeparatorPos(path);
if (i == -1) return path;
else return path[0 .. i];
}
unittest
{
assert (stripExtension("file") == "file");
assert (stripExtension("file.ext"w) == "file");
assert (stripExtension("file.ext1.ext2"d) == "file.ext1");
assert (stripExtension(".foo".dup) == ".foo");
assert (stripExtension(".foo.ext"w.dup) == ".foo");
assert (stripExtension("dir/file"d.dup) == "dir/file");
assert (stripExtension("dir/file.ext") == "dir/file");
assert (stripExtension("dir/file.ext1.ext2"w) == "dir/file.ext1");
assert (stripExtension("dir/.foo"d) == "dir/.foo");
assert (stripExtension("dir/.foo.ext".dup) == "dir/.foo");
version(Windows)
{
assert (stripExtension("dir\\file") == "dir\\file");
assert (stripExtension("dir\\file.ext") == "dir\\file");
assert (stripExtension("dir\\file.ext1.ext2") == "dir\\file.ext1");
assert (stripExtension("dir\\.foo") == "dir\\.foo");
assert (stripExtension("dir\\.foo.ext") == "dir\\.foo");
assert (stripExtension("d:file") == "d:file");
assert (stripExtension("d:file.ext") == "d:file");
assert (stripExtension("d:file.ext1.ext2") == "d:file.ext1");
assert (stripExtension("d:.foo") == "d:.foo");
assert (stripExtension("d:.foo.ext") == "d:.foo");
}
static assert (stripExtension("file") == "file");
static assert (stripExtension("file.ext"w) == "file");
}
/** Set the extension of a filename.
If the filename already has an extension, it is replaced. If not, the
extension is simply appended to the filename. Including the dot in the
extension is optional.
This function normally allocates a new string (the possible exception
being case when path is immutable and doesn't already have an extension).
Examples:
---
assert (setExtension("file", "ext") == "file.ext");
assert (setExtension("file", ".ext") == "file.ext");
assert (setExtension("file.old", "new") == "file.new");
assert (setExtension("file.old", ".new") == "file.new");
---
*/
immutable(Unqual!C1)[] setExtension(C1, C2)(in C1[] path, in C2[] ext)
@trusted pure nothrow
if (isSomeChar!C1 && !is(C1 == immutable) && is(Unqual!C1 == Unqual!C2))
{
if (ext.length > 0 && ext[0] == '.')
return cast(typeof(return))(stripExtension(path)~ext);
else
return cast(typeof(return))(stripExtension(path)~'.'~ext);
}
///ditto
immutable(C1)[] setExtension(C1, C2)(immutable(C1)[] path, const(C2)[] ext)
@trusted pure nothrow
if (isSomeChar!C1 && is(Unqual!C1 == Unqual!C2))
{
// Optimised for the case where path is immutable and has no extension
if (ext.length > 0 && ext[0] == '.') ext = ext[1 .. $];
auto i = extSeparatorPos(path);
if (i == -1)
{
path ~= '.';
path ~= ext;
return path;
}
else if (i == path.length - 1)
{
path ~= ext;
return path;
}
else
{
return cast(typeof(return))(path[0 .. i+1] ~ ext);
}
}
unittest
{
assert (setExtension("file", "ext") == "file.ext");
assert (setExtension("file"w, ".ext"w) == "file.ext");
assert (setExtension("file."d, "ext"d) == "file.ext");
assert (setExtension("file.", ".ext") == "file.ext");
assert (setExtension("file.old"w, "new"w) == "file.new");
assert (setExtension("file.old"d, ".new"d) == "file.new");
assert (setExtension("file"w.dup, "ext"w) == "file.ext");
assert (setExtension("file"w.dup, ".ext"w) == "file.ext");
assert (setExtension("file."w, "ext"w.dup) == "file.ext");
assert (setExtension("file."w, ".ext"w.dup) == "file.ext");
assert (setExtension("file.old"d.dup, "new"d) == "file.new");
assert (setExtension("file.old"d.dup, ".new"d) == "file.new");
static assert (setExtension("file", "ext") == "file.ext");
static assert (setExtension("file.old", "new") == "file.new");
static assert (setExtension("file"w.dup, "ext"w) == "file.ext");
static assert (setExtension("file.old"d.dup, "new"d) == "file.new");
}
/** Set the extension of a filename, but only if it doesn't
already have one.
Including the dot in the extension is optional.
This function always allocates a new string, except in the case when
path is immutable and already has an extension.
Examples:
---
assert (defaultExtension("file", "ext") == "file.ext");
assert (defaultExtension("file", ".ext") == "file.ext");
assert (defaultExtension("file.", "ext") == "file.");
assert (defaultExtension("file.old", "new") == "file.old");
assert (defaultExtension("file.old", ".new") == "file.old");
---
*/
immutable(Unqual!C1)[] defaultExtension(C1, C2)(in C1[] path, in C2[] ext)
@trusted pure // TODO: nothrow (because of to())
if (isSomeChar!C1 && is(Unqual!C1 == Unqual!C2))
{
auto i = extSeparatorPos(path);
if (i == -1)
{
if (ext.length > 0 && ext[0] == '.')
return cast(typeof(return))(path~ext);
else
return cast(typeof(return))(path~'.'~ext);
}
else return to!(typeof(return))(path);
}
unittest
{
assert (defaultExtension("file", "ext") == "file.ext");
assert (defaultExtension("file", ".ext") == "file.ext");
assert (defaultExtension("file.", "ext") == "file.");
assert (defaultExtension("file.old", "new") == "file.old");
assert (defaultExtension("file.old", ".new") == "file.old");
assert (defaultExtension("file"w.dup, "ext"w) == "file.ext");
assert (defaultExtension("file.old"d.dup, "new"d) == "file.old");
static assert (defaultExtension("file", "ext") == "file.ext");
static assert (defaultExtension("file.old", "new") == "file.old");
static assert (defaultExtension("file"w.dup, "ext"w) == "file.ext");
static assert (defaultExtension("file.old"d.dup, "new"d) == "file.old");
}
/** Joins one or more path components.
The given path components are concatenated with each other,
and if necessary, directory separators are inserted between
them. If any of the path components are rooted (see
$(LREF isRooted)) the preceding path components will be dropped.
Examples:
---
version (Posix)
{
assert (buildPath("foo", "bar", "baz") == "foo/bar/baz");
assert (buildPath("/foo/", "bar") == "/foo/bar");
assert (buildPath("/foo", "/bar") == "/bar");
}
version (Windows)
{
assert (buildPath("foo", "bar", "baz") == `foo\bar\baz`);
assert (buildPath(`c:\foo`, "bar") == `c:\foo\bar`);
assert (buildPath("foo", `d:\bar`) == `d:\bar`);
assert (buildPath("foo", `\bar`) == `\bar`);
}
---
*/
immutable(C)[] buildPath(C)(const(C)[][] paths...)
//TODO: @safe pure nothrow (because of reduce() and to())
if (isSomeChar!C)
{
static typeof(return) joinPaths(const(C)[] lhs, const(C)[] rhs)
@trusted //TODO: pure nothrow (because of to())
{
if (rhs.empty) return to!(typeof(return))(lhs);
if (lhs.empty || isRooted(rhs)) return to!(typeof(return))(rhs);
if (isDirSeparator(lhs[$-1]) || isDirSeparator(rhs[0]))
return cast(typeof(return))(lhs ~ rhs);
else
return cast(typeof(return))(lhs ~ dirSeparator ~ rhs);
}
return to!(typeof(return))(reduce!joinPaths(paths));
}
unittest
{
version (Posix)
{
assert (buildPath("foo") == "foo");
assert (buildPath("/foo/") == "/foo/");
assert (buildPath("foo", "bar") == "foo/bar");
assert (buildPath("foo", "bar", "baz") == "foo/bar/baz");
assert (buildPath("foo/".dup, "bar") == "foo/bar");
assert (buildPath("foo///", "bar".dup) == "foo///bar");
assert (buildPath("/foo"w, "bar"w) == "/foo/bar");
assert (buildPath("foo"w.dup, "/bar"w) == "/bar");
assert (buildPath("foo"w, "bar/"w.dup) == "foo/bar/");
assert (buildPath("/"d, "foo"d) == "/foo");
assert (buildPath(""d.dup, "foo"d) == "foo");
assert (buildPath("foo"d, ""d.dup) == "foo");
assert (buildPath("foo", "bar".dup, "baz") == "foo/bar/baz");
assert (buildPath("foo"w, "/bar"w, "baz"w.dup) == "/bar/baz");
static assert (buildPath("foo", "bar", "baz") == "foo/bar/baz");
static assert (buildPath("foo", "/bar", "baz") == "/bar/baz");
}
version (Windows)
{
assert (buildPath("foo") == "foo");
assert (buildPath(`\foo/`) == `\foo/`);
assert (buildPath("foo", "bar", "baz") == `foo\bar\baz`);
assert (buildPath("foo", `\bar`) == `\bar`);
assert (buildPath(`c:\foo`, "bar") == `c:\foo\bar`);
assert (buildPath("foo"w, `d:\bar`w.dup) == `d:\bar`);
static assert (buildPath("foo", "bar", "baz") == `foo\bar\baz`);
static assert (buildPath("foo", `c:\bar`, "baz") == `c:\bar\baz`);
}
}
/** Performs the same task as $(LREF buildPath),
while at the same time resolving current/parent directory
symbols ($(D ".") and $(D "..")) and removing superfluous
directory separators.
On Windows, slashes are replaced with backslashes.
Note that this function does not resolve symbolic links.
Examples:
---
version (Posix)
{
assert (buildNormalizedPath("/foo/./bar/..//baz/") == "/foo/baz");
assert (buildNormalizedPath("../foo/.") == "../foo");
assert (buildNormalizedPath("/foo", "bar/baz/") == "/foo/bar/baz");
assert (buildNormalizedPath("/foo", "/bar/..", "baz") == "/baz");
assert (buildNormalizedPath("foo/./bar", "../../", "../baz") == "../baz");
assert (buildNormalizedPath("/foo/./bar", "../../baz") == "/baz");
}
version (Windows)
{
assert (buildNormalizedPath(`c:\foo\.\bar/..\\baz\`) == `c:\foo\baz`);
assert (buildNormalizedPath(`..\foo\.`) == `..\foo`);
assert (buildNormalizedPath(`c:\foo`, `bar\baz\`) == `c:\foo\bar\baz`);
assert (buildNormalizedPath(`c:\foo`, `bar/..`) == `c:\foo`);
assert (buildNormalizedPath(`\\server\share\foo`, `..\bar`) == `\\server\share\bar`);
}
---
*/
immutable(C)[] buildNormalizedPath(C)(const(C)[][] paths...)
@trusted pure nothrow
if (isSomeChar!C)
{
// Check whether the resulting path will be absolute or rooted,
// calculate its maximum length, and discard segments we won't use.
typeof(paths[0]) rootElement;
int numPaths = 0;
bool seenAbsolute;
size_t segmentLengthSum = 0;
foreach (i; 0 .. paths.length)
{
auto p = paths[i];
if (p.empty) continue;
else if (isRooted(p))
{
immutable thisIsAbsolute = isAbsolute(p);
if (thisIsAbsolute || !seenAbsolute)
{
if (thisIsAbsolute) seenAbsolute = true;
rootElement = rootName(p);
paths[0] = p[rootElement.length .. $];
numPaths = 1;
segmentLengthSum = paths[0].length;
}
else
{
paths[0] = p;
numPaths = 1;
segmentLengthSum = p.length;
}
}
else
{
paths[numPaths++] = p;
segmentLengthSum += p.length;
}
}
if (rootElement.length + segmentLengthSum == 0) return null;
paths = paths[0 .. numPaths];
immutable rooted = !rootElement.empty;
assert (rooted || !seenAbsolute); // absolute => rooted
// Allocate memory for the resulting path, including room for
// extra dir separators
auto fullPath = new C[rootElement.length + segmentLengthSum + paths.length];
// Copy the root element into fullPath, and let relPart be
// the remaining slice.
typeof(fullPath) relPart;
if (rooted)
{
// For Windows, we also need to perform normalization on
// the root element.
version (Posix)
{
fullPath[0 .. rootElement.length] = rootElement[];
}
else version (Windows)
{
foreach (i, c; rootElement)
{
if (isDirSeparator(c))
{
static assert (dirSeparator.length == 1);
fullPath[i] = dirSeparator[0];
}
else fullPath[i] = c;
}
}
else static assert (0);
// If the root element doesn't end with a dir separator,
// we add one.
if (!isDirSeparator(rootElement[$-1]))
{
static assert (dirSeparator.length == 1);
fullPath[rootElement.length] = dirSeparator[0];
relPart = fullPath[rootElement.length + 1 .. $];
}
else
{
relPart = fullPath[rootElement.length .. $];
}
}
else relPart = fullPath;
// Now, we have ensured that all segments in path are relative to the
// root we found earlier.
bool hasParents = rooted;
sizediff_t i;
foreach (path; paths)
{
path = trimDirSeparators(path);
enum Prev { nonSpecial, dirSep, dot, doubleDot }
Prev prev = Prev.dirSep;
foreach (j; 0 .. path.length+1)
{
// Fake a dir separator between path segments
immutable c = (j == path.length ? dirSeparator[0] : path[j]);
if (isDirSeparator(c))
{
final switch (prev)
{
case Prev.doubleDot:
if (hasParents)
{
while (i > 0 && !isDirSeparator(relPart[i-1])) --i;
if (i > 0) --i; // skip the dir separator
while (i > 0 && !isDirSeparator(relPart[i-1])) --i;
if (i == 0) hasParents = rooted;
}
else
{
relPart[i++] = '.';
relPart[i++] = '.';
static assert (dirSeparator.length == 1);
relPart[i++] = dirSeparator[0];
}
break;
case Prev.dot:
while (i > 0 && !isDirSeparator(relPart[i-1])) --i;
break;
case Prev.nonSpecial:
static assert (dirSeparator.length == 1);
relPart[i++] = dirSeparator[0];
hasParents = true;
break;
case Prev.dirSep:
break;
}
prev = Prev.dirSep;
}
else if (c == '.')
{
final switch (prev)
{
case Prev.dirSep:
prev = Prev.dot;
break;
case Prev.dot:
prev = Prev.doubleDot;
break;
case Prev.doubleDot:
prev = Prev.nonSpecial;
relPart[i .. i+3] = "...";
i += 3;
break;
case Prev.nonSpecial:
relPart[i] = '.';
++i;
break;
}
}
else
{
final switch (prev)
{
case Prev.doubleDot:
relPart[i] = '.';
++i;
goto case;
case Prev.dot:
relPart[i] = '.';
++i;
break;
case Prev.dirSep: break;
case Prev.nonSpecial: break;
}
relPart[i] = c;
++i;
prev = Prev.nonSpecial;
}
}
}
// Return path, including root element and excluding the
// final dir separator.
immutable len = (relPart.ptr - fullPath.ptr) + (i > 0 ? i - 1 : 0);
fullPath = fullPath[0 .. len];
version (Windows)
{
// On Windows, if the path is on the form `\\server\share`,
// with no further segments, normalization will have turned it
// into `\\server\share\`. If so, we need to remove the final
// backslash.
if (isUNC(fullPath) && uncRootLength(fullPath) == fullPath.length - 1)
fullPath = fullPath[0 .. $-1];
}
return cast(typeof(return)) fullPath;
}
unittest
{
assert (buildNormalizedPath("") is null);
assert (buildNormalizedPath("foo") == "foo");
version (Posix)
{
assert (buildNormalizedPath("/", "foo", "bar") == "/foo/bar");
assert (buildNormalizedPath("foo", "bar", "baz") == "foo/bar/baz");
assert (buildNormalizedPath("foo", "bar/baz") == "foo/bar/baz");
assert (buildNormalizedPath("foo", "bar//baz///") == "foo/bar/baz");
assert (buildNormalizedPath("/foo", "bar/baz") == "/foo/bar/baz");
assert (buildNormalizedPath("/foo", "/bar/baz") == "/bar/baz");
assert (buildNormalizedPath("/foo/..", "/bar/./baz") == "/bar/baz");
assert (buildNormalizedPath("/foo/..", "bar/baz") == "/bar/baz");
assert (buildNormalizedPath("/foo/../../", "bar/baz") == "/bar/baz");
assert (buildNormalizedPath("/foo/bar", "../baz") == "/foo/baz");
assert (buildNormalizedPath("/foo/bar", "../../baz") == "/baz");
assert (buildNormalizedPath("/foo/bar", ".././/baz/..", "wee/") == "/foo/wee");
assert (buildNormalizedPath("//foo/bar", "baz///wee") == "/foo/bar/baz/wee");
static assert (buildNormalizedPath("/foo/..", "/bar/./baz") == "/bar/baz");
// Examples in docs:
assert (buildNormalizedPath("/foo", "bar/baz/") == "/foo/bar/baz");
assert (buildNormalizedPath("/foo", "/bar/..", "baz") == "/baz");
assert (buildNormalizedPath("foo/./bar", "../../", "../baz") == "../baz");
assert (buildNormalizedPath("/foo/./bar", "../../baz") == "/baz");
}
else version (Windows)
{
assert (buildNormalizedPath(`\`, `foo`, `bar`) == `\foo\bar`);
assert (buildNormalizedPath(`foo`, `bar`, `baz`) == `foo\bar\baz`);
assert (buildNormalizedPath(`foo`, `bar\baz`) == `foo\bar\baz`);
assert (buildNormalizedPath(`foo`, `bar\\baz\\\`) == `foo\bar\baz`);
assert (buildNormalizedPath(`\foo`, `bar\baz`) == `\foo\bar\baz`);
assert (buildNormalizedPath(`\foo`, `\bar\baz`) == `\bar\baz`);
assert (buildNormalizedPath(`\foo\..`, `\bar\.\baz`) == `\bar\baz`);
assert (buildNormalizedPath(`\foo\..`, `bar\baz`) == `\bar\baz`);
assert (buildNormalizedPath(`\foo\..\..\`, `bar\baz`) == `\bar\baz`);
assert (buildNormalizedPath(`\foo\bar`, `..\baz`) == `\foo\baz`);
assert (buildNormalizedPath(`\foo\bar`, `../../baz`) == `\baz`);
assert (buildNormalizedPath(`\foo\bar`, `..\.\/baz\..`, `wee\`) == `\foo\wee`);
assert (buildNormalizedPath(`c:\`, `foo`, `bar`) == `c:\foo\bar`);
assert (buildNormalizedPath(`c:foo`, `bar`, `baz`) == `c:foo\bar\baz`);
assert (buildNormalizedPath(`c:foo`, `bar\baz`) == `c:foo\bar\baz`);
assert (buildNormalizedPath(`c:foo`, `bar\\baz\\\`) == `c:foo\bar\baz`);
assert (buildNormalizedPath(`c:\foo`, `bar\baz`) == `c:\foo\bar\baz`);
assert (buildNormalizedPath(`c:\foo`, `\bar\baz`) == `c:\bar\baz`);
assert (buildNormalizedPath(`c:\foo\..`, `\bar\.\baz`) == `c:\bar\baz`);
assert (buildNormalizedPath(`c:\foo\..`, `bar\baz`) == `c:\bar\baz`);
assert (buildNormalizedPath(`c:\foo\..\..\`, `bar\baz`) == `c:\bar\baz`);
assert (buildNormalizedPath(`c:\foo\bar`, `..\baz`) == `c:\foo\baz`);
assert (buildNormalizedPath(`c:\foo\bar`, `..\..\baz`) == `c:\baz`);
assert (buildNormalizedPath(`c:\foo\bar`, `..\.\\baz\..`, `wee\`) == `c:\foo\wee`);
assert (buildNormalizedPath(`\\server\share`, `foo`, `bar`) == `\\server\share\foo\bar`);
assert (buildNormalizedPath(`\\server\share\`, `foo`, `bar`) == `\\server\share\foo\bar`);
assert (buildNormalizedPath(`\\server\share\foo`, `bar\baz`) == `\\server\share\foo\bar\baz`);
assert (buildNormalizedPath(`\\server\share\foo`, `\bar\baz`) == `\\server\share\bar\baz`);
assert (buildNormalizedPath(`\\server\share\foo\..`, `\bar\.\baz`) == `\\server\share\bar\baz`);
assert (buildNormalizedPath(`\\server\share\foo\..`, `bar\baz`) == `\\server\share\bar\baz`);
assert (buildNormalizedPath(`\\server\share\foo\..\..\`, `bar\baz`) == `\\server\share\bar\baz`);
assert (buildNormalizedPath(`\\server\share\foo\bar`, `..\baz`) == `\\server\share\foo\baz`);
assert (buildNormalizedPath(`\\server\share\foo\bar`, `..\..\baz`) == `\\server\share\baz`);
assert (buildNormalizedPath(`\\server\share\foo\bar`, `..\.\\baz\..`, `wee\`) == `\\server\share\foo\wee`);
static assert (buildNormalizedPath(`\foo\..\..\`, `bar\baz`) == `\bar\baz`);
// Examples in docs:
assert (buildNormalizedPath(`c:\foo`, `bar\baz\`) == `c:\foo\bar\baz`);
assert (buildNormalizedPath(`c:\foo`, `bar/..`) == `c:\foo`);
assert (buildNormalizedPath(`\\server\share\foo`, `..\bar`) == `\\server\share\bar`);
}
else static assert (0);
}
unittest
{
version (Posix)
{
// Trivial
assert (buildNormalizedPath("").empty);
assert (buildNormalizedPath("foo/bar") == "foo/bar");
// Correct handling of leading slashes
assert (buildNormalizedPath("/") == "/");
assert (buildNormalizedPath("///") == "/");
assert (buildNormalizedPath("////") == "/");
assert (buildNormalizedPath("/foo/bar") == "/foo/bar");
assert (buildNormalizedPath("//foo/bar") == "/foo/bar");
assert (buildNormalizedPath("///foo/bar") == "/foo/bar");
assert (buildNormalizedPath("////foo/bar") == "/foo/bar");
// Correct handling of single-dot symbol (current directory)
assert (buildNormalizedPath("/./foo") == "/foo");
assert (buildNormalizedPath("/foo/./bar") == "/foo/bar");
assert (buildNormalizedPath("./foo") == "foo");
assert (buildNormalizedPath("././foo") == "foo");
assert (buildNormalizedPath("foo/././bar") == "foo/bar");
// Correct handling of double-dot symbol (previous directory)
assert (buildNormalizedPath("/foo/../bar") == "/bar");
assert (buildNormalizedPath("/foo/../../bar") == "/bar");
assert (buildNormalizedPath("/../foo") == "/foo");
assert (buildNormalizedPath("/../../foo") == "/foo");
assert (buildNormalizedPath("/foo/..") == "/");
assert (buildNormalizedPath("/foo/../..") == "/");
assert (buildNormalizedPath("foo/../bar") == "bar");
assert (buildNormalizedPath("foo/../../bar") == "../bar");
assert (buildNormalizedPath("../foo") == "../foo");
assert (buildNormalizedPath("../../foo") == "../../foo");
assert (buildNormalizedPath("../foo/../bar") == "../bar");
assert (buildNormalizedPath(".././../foo") == "../../foo");
assert (buildNormalizedPath("foo/bar/..") == "foo");
assert (buildNormalizedPath("/foo/../..") == "/");
// The ultimate path
assert (buildNormalizedPath("/foo/../bar//./../...///baz//") == "/.../baz");
static assert (buildNormalizedPath("/foo/../bar//./../...///baz//") == "/.../baz");
}
else version (Windows)
{
// Trivial
assert (buildNormalizedPath("").empty);
assert (buildNormalizedPath(`foo\bar`) == `foo\bar`);
assert (buildNormalizedPath("foo/bar") == `foo\bar`);
// Correct handling of absolute paths
assert (buildNormalizedPath("/") == `\`);
assert (buildNormalizedPath(`\`) == `\`);
assert (buildNormalizedPath(`\\\`) == `\`);
assert (buildNormalizedPath(`\\\\`) == `\`);
assert (buildNormalizedPath(`\foo\bar`) == `\foo\bar`);
assert (buildNormalizedPath(`\\foo`) == `\\foo`);
assert (buildNormalizedPath(`\\foo\\`) == `\\foo`);
assert (buildNormalizedPath(`\\foo/bar`) == `\\foo\bar`);
assert (buildNormalizedPath(`\\\foo\bar`) == `\foo\bar`);
assert (buildNormalizedPath(`\\\\foo\bar`) == `\foo\bar`);
assert (buildNormalizedPath(`c:\`) == `c:\`);
assert (buildNormalizedPath(`c:\foo\bar`) == `c:\foo\bar`);
assert (buildNormalizedPath(`c:\\foo\bar`) == `c:\foo\bar`);
// Correct handling of single-dot symbol (current directory)
assert (buildNormalizedPath(`\./foo`) == `\foo`);
assert (buildNormalizedPath(`\foo/.\bar`) == `\foo\bar`);
assert (buildNormalizedPath(`.\foo`) == `foo`);
assert (buildNormalizedPath(`./.\foo`) == `foo`);
assert (buildNormalizedPath(`foo\.\./bar`) == `foo\bar`);
// Correct handling of double-dot symbol (previous directory)
assert (buildNormalizedPath(`\foo\..\bar`) == `\bar`);
assert (buildNormalizedPath(`\foo\../..\bar`) == `\bar`);
assert (buildNormalizedPath(`\..\foo`) == `\foo`);
assert (buildNormalizedPath(`\..\..\foo`) == `\foo`);
assert (buildNormalizedPath(`\foo\..`) == `\`);
assert (buildNormalizedPath(`\foo\../..`) == `\`);
assert (buildNormalizedPath(`foo\..\bar`) == `bar`);
assert (buildNormalizedPath(`foo\..\../bar`) == `..\bar`);
assert (buildNormalizedPath(`..\foo`) == `..\foo`);
assert (buildNormalizedPath(`..\..\foo`) == `..\..\foo`);
assert (buildNormalizedPath(`..\foo\..\bar`) == `..\bar`);
assert (buildNormalizedPath(`..\.\..\foo`) == `..\..\foo`);
assert (buildNormalizedPath(`foo\bar\..`) == `foo`);
assert (buildNormalizedPath(`\foo\..\..`) == `\`);
assert (buildNormalizedPath(`c:\foo\..\..`) == `c:\`);
// Correct handling of non-root path with drive specifier
assert (buildNormalizedPath(`c:foo`) == `c:foo`);
assert (buildNormalizedPath(`c:..\foo\.\..\bar`) == `c:..\bar`);
// The ultimate path
assert (buildNormalizedPath(`c:\foo\..\bar\\.\..\...\\\baz\\`) == `c:\...\baz`);
static assert (buildNormalizedPath(`c:\foo\..\bar\\.\..\...\\\baz\\`) == `c:\...\baz`);
}
else static assert (false);
}
/** Returns a bidirectional range that iterates over the elements of a path.
Examples:
---
assert (equal(pathSplitter("/"), ["/"]));
assert (equal(pathSplitter("/foo/bar"), ["/", "foo", "bar"]));
assert (equal(pathSplitter("//foo/bar"), ["//foo", "bar"]));
assert (equal(pathSplitter("foo/../bar//./"), ["foo", "..", "bar", "."]));
version (Windows)
{
assert (equal(pathSplitter(`foo\..\bar\/.\`), ["foo", "..", "bar", "."]));
assert (equal(pathSplitter("c:"), ["c:"]));
assert (equal(pathSplitter(`c:\foo\bar`), [`c:\`, "foo", "bar"]));
assert (equal(pathSplitter(`c:foo\bar`), ["c:foo", "bar"]));
}
---
*/
auto pathSplitter(C)(const(C)[] path) @safe pure nothrow
if (isSomeChar!C)
{
static struct PathSplitter
{
@safe pure nothrow:
@property empty() const { return _empty; }
@property front() const
{
assert (!empty, "PathSplitter: called front() on empty range");
return _front;
}
void popFront()
{
assert (!empty, "PathSplitter: called popFront() on empty range");
if (_path.empty)
{
if (_front is _back)
{
_empty = true;
_front = null;
_back = null;
}
else
{
_front = _back;
}
}
else
{
sizediff_t i = 0;
while (i < _path.length && !isDirSeparator(_path[i])) ++i;
_front = _path[0 .. i];
_path = ltrimDirSeparators(_path[i .. $]);
}
}
@property back() const
{
assert (!empty, "PathSplitter: called back() on empty range");
return _back;
}
void popBack()
{
assert (!empty, "PathSplitter: called popBack() on empty range");
if (_path.empty)
{
if (_front is _back)
{
_empty = true;
_front = null;
_back = null;
}
else
{
_back = _front;
}
}
else
{
auto i = (cast(sizediff_t) _path.length) - 1;
while (i >= 0 && !isDirSeparator(_path[i])) --i;
_back = _path[i + 1 .. $];
_path = rtrimDirSeparators(_path[0 .. i+1]);
}
}
@property auto save() { return this; }
private:
typeof(path) _path, _front, _back;
bool _empty;
this(typeof(path) p)
{
if (p.empty)
{
_empty = true;
return;
}
_path = p;
// If path is rooted, first element is special
version (Windows)
{
if (isUNC(_path))
{
auto i = uncRootLength(_path);
_front = _path[0 .. i];
_path = ltrimDirSeparators(_path[i .. $]);
}
else if (isDriveRoot(_path))
{
_front = _path[0 .. 3];
_path = ltrimDirSeparators(_path[3 .. $]);
}
else if (_path.length >= 1 && isDirSeparator(_path[0]))
{
_front = _path[0 .. 1];
_path = ltrimDirSeparators(_path[1 .. $]);
}
else
{
assert (!isRooted(_path));
popFront();
}
}
else version (Posix)
{
if (_path.length >= 1 && isDirSeparator(_path[0]))
{
_front = _path[0 .. 1];
_path = ltrimDirSeparators(_path[1 .. $]);
}
else
{
popFront();
}
}
else static assert (0);
if (_path.empty) _back = _front;
else
{
_path = rtrimDirSeparators(_path);
popBack();
}
}
}
return PathSplitter(path);
}
unittest
{
// equal2 verifies that the range is the same both ways, i.e.
// through front/popFront and back/popBack.
import std.range;
bool equal2(R1, R2)(R1 r1, R2 r2)
{
static assert (isBidirectionalRange!R1);
return equal(r1, r2) && equal(retro(r1), retro(r2));
}
assert (pathSplitter("").empty);
// Root directories
assert (equal2(pathSplitter("/"), ["/"]));
assert (equal2(pathSplitter("//"), ["/"]));
assert (equal2(pathSplitter("///"w), ["/"w]));
// Absolute paths
assert (equal2(pathSplitter("/foo/bar".dup), ["/", "foo", "bar"]));
// General
assert (equal2(pathSplitter("foo/bar"d.dup), ["foo"d, "bar"d]));
assert (equal2(pathSplitter("foo//bar"), ["foo", "bar"]));
assert (equal2(pathSplitter("foo/bar//"w), ["foo"w, "bar"w]));
assert (equal2(pathSplitter("foo/../bar//./"d), ["foo"d, ".."d, "bar"d, "."d]));
// save()
auto ps1 = pathSplitter("foo/bar/baz");
auto ps2 = ps1.save();
ps1.popFront();
assert (equal2(ps1, ["bar", "baz"]));
assert (equal2(ps2, ["foo", "bar", "baz"]));
// Platform specific
version (Posix)
{
assert (equal2(pathSplitter("//foo/bar"w.dup), ["/"w, "foo"w, "bar"w]));
}
version (Windows)
{
assert (equal2(pathSplitter(`\`), [`\`]));
assert (equal2(pathSplitter(`foo\..\bar\/.\`), ["foo", "..", "bar", "."]));
assert (equal2(pathSplitter("c:"), ["c:"]));
assert (equal2(pathSplitter(`c:\foo\bar`), [`c:\`, "foo", "bar"]));
assert (equal2(pathSplitter(`c:foo\bar`), ["c:foo", "bar"]));
assert (equal2(pathSplitter(`\\foo\bar`), [`\\foo\bar`]));
assert (equal2(pathSplitter(`\\foo\bar\\`), [`\\foo\bar`]));
assert (equal2(pathSplitter(`\\foo\bar\baz`), [`\\foo\bar`, "baz"]));
}
// CTFE
// Fails due to BUG 6416
//static assert (equal(pathSplitter("/foo/bar".dup), ["/", "foo", "bar"]));
}
/** Determines whether a path starts at a root directory.
On POSIX, this function returns true if and only if the path starts
with a slash (/).
---
version (Posix)
{
assert (isRooted("/"));
assert (isRooted("/foo"));
assert (!isRooted("foo"));
assert (!isRooted("../foo"));
}
---
On Windows, this function returns true if the path starts at
the root directory of the current drive, of some other drive,
or of a network drive.
---
version (Windows)
{
assert (isRooted(`\`));
assert (isRooted(`\foo`));
assert (isRooted(`d:\foo`));
assert (isRooted(`\\foo\bar`));
assert (!isRooted("foo"));
assert (!isRooted("d:foo"));
}
---
*/
bool isRooted(C)(in C[] path) @safe pure nothrow if (isSomeChar!C)
{
if (path.length >= 1 && isDirSeparator(path[0])) return true;
version (Posix) return false;
else version (Windows) return isAbsolute(path);
}
unittest
{
assert (isRooted("/"));
assert (isRooted("/foo"));
assert (!isRooted("foo"));
assert (!isRooted("../foo"));
version (Windows)
{
assert (isRooted(`\`));
assert (isRooted(`\foo`));
assert (isRooted(`d:\foo`));
assert (isRooted(`\\foo\bar`));
assert (!isRooted("foo"));
assert (!isRooted("d:foo"));
}
static assert (isRooted("/foo"));
static assert (!isRooted("foo"));
}
/** Determines whether a path is absolute or not.
Examples:
On POSIX, an absolute path starts at the root directory.
(In fact, $(D _isAbsolute) is just an alias for $(LREF isRooted).)
---
version (Posix)
{
assert (isAbsolute("/"));
assert (isAbsolute("/foo"));
assert (!isAbsolute("foo"));
assert (!isAbsolute("../foo"));
}
---
On Windows, an absolute path starts at the root directory of
a specific drive. Hence, it must start with $(D "d:\") or $(D "d:/"),
where $(D d) is the drive letter. Alternatively, it may be a
network path, i.e. a path starting with a double (back)slash.
---
version (Windows)
{
assert (isAbsolute(`d:\`));
assert (isAbsolute(`d:\foo`));
assert (isAbsolute(`\\foo\bar`));
assert (!isAbsolute(`\`));
assert (!isAbsolute(`\foo`));
assert (!isAbsolute("d:foo"));
}
---
*/
version (StdDdoc) bool isAbsolute(C)(in C[] path) @safe pure nothrow
if (isSomeChar!C);
else version (Windows) bool isAbsolute(C)(in C[] path) @safe pure nothrow
if (isSomeChar!C)
{
return isDriveRoot(path) || isUNC(path);
}
else version (Posix) alias isRooted isAbsolute;
unittest
{
assert (!isAbsolute("foo"));
assert (!isAbsolute("../foo"w));
static assert (!isAbsolute("foo"));
version (Posix)
{
assert (isAbsolute("/"d));
assert (isAbsolute("/foo".dup));
static assert (isAbsolute("/foo"));
}
version (Windows)
{
assert (isAbsolute("d:\\"w));
assert (isAbsolute("d:\\foo"d));
assert (isAbsolute("\\\\foo\\bar"));
assert (!isAbsolute("\\"w.dup));
assert (!isAbsolute("\\foo"d.dup));
assert (!isAbsolute("d:"));
assert (!isAbsolute("d:foo"));
static assert (isAbsolute(`d:\foo`));
}
}
/** Translate $(D path) into an absolute _path.
This means:
$(UL
$(LI If $(D path) is empty, return $(D null).)
$(LI If $(D path) is already absolute, return it.)
$(LI Otherwise, append $(D path) to $(D base) and return
the result. If $(D base) is not specified, the current
working directory is used.)
)
Examples:
---
version (Posix)
{
assert (absolutePath("some/file", "/foo/bar") == "/foo/bar/some/file");
assert (absolutePath("../file", "/foo/bar") == "/foo/bar/../file");
assert (absolutePath("/some/file", "/foo/bar") == "/some/file");
}
version (Windows)
{
assert (absolutePath(`some\file`, `c:\foo\bar`) == `c:\foo\bar\some\file`);
assert (absolutePath(`..\file`, `c:\foo\bar`) == `c:\foo\bar\..\file`);
assert (absolutePath(`c:\some\file`, `c:\foo\bar`) == `c:\some\file`);
}
---
Throws:
$(D Exception) if the specified _base directory is not absolute.
*/
string absolutePath(string path, string base = getcwd())
// TODO: @safe (BUG 6405) pure (because of buildPath())
{
if (path.empty) return null;
if (isAbsolute(path)) return path;
if (!isAbsolute(base)) throw new Exception("Base directory must be absolute");
return buildPath(base, path);
}
unittest
{
version (Posix)
{
assert (absolutePath("some/file", "/foo/bar") == "/foo/bar/some/file");
assert (absolutePath("../file", "/foo/bar") == "/foo/bar/../file");
assert (absolutePath("/some/file", "/foo/bar") == "/some/file");
static assert (absolutePath("some/file", "/foo/bar") == "/foo/bar/some/file");
}
version (Windows)
{
assert (absolutePath(`some\file`, `c:\foo\bar`) == `c:\foo\bar\some\file`);
assert (absolutePath(`..\file`, `c:\foo\bar`) == `c:\foo\bar\..\file`);
assert (absolutePath(`c:\some\file`, `c:\foo\bar`) == `c:\some\file`);
static assert (absolutePath(`some\file`, `c:\foo\bar`) == `c:\foo\bar\some\file`);
}
import std.exception;
assertThrown(absolutePath("bar", "foo"));
}
/** Translate $(D path) into a relative _path.
The returned _path is relative to $(D base), which is by default
taken to be the current working directory. If specified,
$(D base) must be an absolute _path, and it is always assumed
to refer to a directory. If $(D path) and $(D base) refer to
the same directory, the function returns $(D ".").
The following algorithm is used:
$(OL
$(LI If $(D path) is a relative directory, return it unaltered.)
$(LI Find a common root between $(D path) and $(D base).
If there is no common root, return $(D path) unaltered.)
$(LI Prepare a string with as many $(D "../") or $(D "..\") as
necessary to reach the common root from base path.)
$(LI Append the remaining segments of $(D path) to the string
and return.)
)
In the second step, path components are compared using $(D filenameCmp!cs),
where $(D cs) is an optional template parameter determining whether
the comparison is case sensitive or not. See the
$(LREF filenameCmp) documentation for details.
Examples:
---
assert (relativePath("foo") == "foo");
version (Posix)
{
assert (relativePath("foo", "/bar") == "foo");
assert (relativePath("/foo/bar", "/foo/bar") == ".");
assert (relativePath("/foo/bar", "/foo/baz") == "../bar");
assert (relativePath("/foo/bar/baz", "/foo/woo/wee") == "../../bar/baz");
assert (relativePath("/foo/bar/baz", "/foo/bar") == "baz");
}
version (Windows)
{
assert (relativePath("foo", `c:\bar`) == "foo");
assert (relativePath(`c:\foo\bar`, `c:\foo\bar`) == ".");
assert (relativePath(`c:\foo\bar`, `c:\foo\baz`) == `..\bar`);
assert (relativePath(`c:\foo\bar\baz`, `c:\foo\woo\wee`) == `..\..\bar\baz`);
assert (relativePath(`c:\foo\bar\baz`, `c:\foo\bar`) == "baz");
assert (relativePath(`c:\foo\bar`, `d:\foo`) == `c:\foo\bar`);
}
---
Throws:
$(D Exception) if the specified _base directory is not absolute.
*/
string relativePath(CaseSensitive cs = CaseSensitive.osDefault)
(string path, string base = getcwd())
//TODO: @safe (object.reserve(T[]) should be @trusted)
{
if (!isAbsolute(path)) return path;
if (!isAbsolute(base)) throw new Exception("Base directory must be absolute");
// Find common root with current working directory
string result;
if (!__ctfe) result.reserve(base.length + path.length);
auto basePS = pathSplitter(base);
auto pathPS = pathSplitter(path);
if (filenameCmp!cs(basePS.front, pathPS.front) != 0) return path;
basePS.popFront();
pathPS.popFront();
while (!basePS.empty && !pathPS.empty
&& filenameCmp!cs(basePS.front, pathPS.front) == 0)
{
basePS.popFront();
pathPS.popFront();
}
// Append as many "../" as necessary to reach common base from path
while (!basePS.empty)
{
result ~= "..";
result ~= dirSeparator;
basePS.popFront();
}
// Append the remainder of path
while (!pathPS.empty)
{
result ~= pathPS.front;
result ~= dirSeparator;
pathPS.popFront();
}
// base == path
if (result.empty) return ".";
// Strip off last path separator
return result[0 .. $-1];
}
unittest
{
import std.exception;
assert (relativePath("foo") == "foo");
version (Posix)
{
assert (relativePath("foo", "/bar") == "foo");
assert (relativePath("/foo/bar", "/foo/bar") == ".");
assert (relativePath("/foo/bar", "/foo/baz") == "../bar");
assert (relativePath("/foo/bar/baz", "/foo/woo/wee") == "../../bar/baz");
assert (relativePath("/foo/bar/baz", "/foo/bar") == "baz");
assertThrown(relativePath("/foo", "bar"));
// TODO: pathSplitter() is not CTFEable
//static assert (relativePath("/foo/bar", "/foo/baz") == "../bar");
}
else version (Windows)
{
assert (relativePath("foo", `c:\bar`) == "foo");
assert (relativePath(`c:\foo\bar`, `c:\foo\bar`) == ".");
assert (relativePath(`c:\foo\bar`, `c:\foo\baz`) == `..\bar`);
assert (relativePath(`c:\foo\bar\baz`, `c:\foo\woo\wee`) == `..\..\bar\baz`);
assert (relativePath(`c:/foo/bar/baz`, `c:\foo\woo\wee`) == `..\..\bar\baz`);
assert (relativePath(`c:\foo\bar\baz`, `c:\foo\bar`) == "baz");
assert (relativePath(`c:\foo\bar`, `d:\foo`) == `c:\foo\bar`);
assert (relativePath(`\\foo\bar`, `c:\foo`) == `\\foo\bar`);
assertThrown(relativePath(`c:\foo`, "bar"));
// TODO: pathSplitter() is not CTFEable
//static assert (relativePath(`c:\foo\bar`, `c:\foo\baz`) == `..\bar`);
}
else static assert (0);
}
/** Compare filename characters and return $(D < 0) if $(D a < b), $(D 0) if
$(D a == b) and $(D > 0) if $(D a > b).
This function can perform a case-sensitive or a case-insensitive
comparison. This is controlled through the $(D cs) template parameter
which, if not specified, is given by
$(LREF CaseSensitive)$(D .osDefault).
On Windows, the backslash and slash characters ($(D '\') and $(D '/'))
are considered equal.
Examples:
---
assert (filenameCharCmp('a', 'a') == 0);
assert (filenameCharCmp('a', 'b') < 0);
assert (filenameCharCmp('b', 'a') > 0);
version (linux)
{
// Same as calling filenameCharCmp!(CaseSensitive.yes)(a, b)
assert (filenameCharCmp('A', 'a') < 0);
assert (filenameCharCmp('a', 'A') > 0);
}
version (Windows)
{
// Same as calling filenameCharCmp!(CaseSensitive.no)(a, b)
assert (filenameCharCmp('a', 'A') == 0);
assert (filenameCharCmp('a', 'B') < 0);
assert (filenameCharCmp('A', 'b') < 0);
}
---
*/
int filenameCharCmp(CaseSensitive cs = CaseSensitive.osDefault)(dchar a, dchar b)
@safe pure nothrow
{
if (isDirSeparator(a) && isDirSeparator(b)) return 0;
static if (!cs)
{
import std.uni;
a = toLower(a);
b = toLower(b);
}
return cast(int)(a - b);
}
unittest
{
assert (filenameCharCmp!(CaseSensitive.yes)('a', 'a') == 0);
assert (filenameCharCmp!(CaseSensitive.yes)('a', 'b') < 0);
assert (filenameCharCmp!(CaseSensitive.yes)('b', 'a') > 0);
assert (filenameCharCmp!(CaseSensitive.yes)('A', 'a') < 0);
assert (filenameCharCmp!(CaseSensitive.yes)('a', 'A') > 0);
assert (filenameCharCmp!(CaseSensitive.no)('a', 'a') == 0);
assert (filenameCharCmp!(CaseSensitive.no)('a', 'b') < 0);
assert (filenameCharCmp!(CaseSensitive.no)('b', 'a') > 0);
assert (filenameCharCmp!(CaseSensitive.no)('A', 'a') == 0);
assert (filenameCharCmp!(CaseSensitive.no)('a', 'A') == 0);
assert (filenameCharCmp!(CaseSensitive.no)('a', 'B') < 0);
assert (filenameCharCmp!(CaseSensitive.no)('B', 'a') > 0);
assert (filenameCharCmp!(CaseSensitive.no)('A', 'b') < 0);
assert (filenameCharCmp!(CaseSensitive.no)('b', 'A') > 0);
version (Posix) assert (filenameCharCmp('\\', '/') != 0);
version (Windows) assert (filenameCharCmp('\\', '/') == 0);
}
/** Compare file names and return
$(D < 0) if $(D filename1 < filename2),
$(D 0) if $(D filename1 == filename2) and
$(D > 0) if $(D filename1 > filename2).
Individual characters are compared using $(D filenameCharCmp!cs),
where $(D cs) is an optional template parameter determining whether
the comparison is case sensitive or not. See the
$(LREF filenameCharCmp) documentation for details.
Examples:
---
assert (filenameCmp("abc", "abc") == 0);
assert (filenameCmp("abc", "abd") < 0);
assert (filenameCmp("abc", "abb") > 0);
assert (filenameCmp("abc", "abcd") < 0);
assert (filenameCmp("abcd", "abc") > 0);
version (linux)
{
// Same as calling filenameCmp!(CaseSensitive.yes)(filename1, filename2)
assert (filenameCmp("Abc", "abc") < 0);
assert (filenameCmp("abc", "Abc") > 0);
}
version (Windows)
{
// Same as calling filenameCmp!(CaseSensitive.no)(filename1, filename2)
assert (filenameCmp("Abc", "abc") == 0);
assert (filenameCmp("abc", "Abc") == 0);
assert (filenameCmp("Abc", "abD") < 0);
assert (filenameCmp("abc", "AbB") > 0);
}
---
*/
int filenameCmp(CaseSensitive cs = CaseSensitive.osDefault, C1, C2)
(const(C1)[] filename1, const(C2)[] filename2)
@safe pure //TODO: nothrow (because of std.array.front())
if (isSomeChar!C1 && isSomeChar!C2)
{
for (;;)
{
if (filename1.empty) return -(cast(int) !filename2.empty);
if (filename2.empty) return (cast(int) !filename1.empty);
auto c = filenameCharCmp!cs(filename1.front, filename2.front);
if (c != 0) return c;
filename1.popFront();
filename2.popFront();
}
assert (0);
}
unittest
{
assert (filenameCmp!(CaseSensitive.yes)("abc", "abc") == 0);
assert (filenameCmp!(CaseSensitive.yes)("abc", "abd") < 0);
assert (filenameCmp!(CaseSensitive.yes)("abc", "abb") > 0);
assert (filenameCmp!(CaseSensitive.yes)("abc", "abcd") < 0);
assert (filenameCmp!(CaseSensitive.yes)("abcd", "abc") > 0);
assert (filenameCmp!(CaseSensitive.yes)("Abc", "abc") < 0);
assert (filenameCmp!(CaseSensitive.yes)("abc", "Abc") > 0);
assert (filenameCmp!(CaseSensitive.no)("abc", "abc") == 0);
assert (filenameCmp!(CaseSensitive.no)("abc", "abd") < 0);
assert (filenameCmp!(CaseSensitive.no)("abc", "abb") > 0);
assert (filenameCmp!(CaseSensitive.no)("abc", "abcd") < 0);
assert (filenameCmp!(CaseSensitive.no)("abcd", "abc") > 0);
assert (filenameCmp!(CaseSensitive.no)("Abc", "abc") == 0);
assert (filenameCmp!(CaseSensitive.no)("abc", "Abc") == 0);
assert (filenameCmp!(CaseSensitive.no)("Abc", "abD") < 0);
assert (filenameCmp!(CaseSensitive.no)("abc", "AbB") > 0);
version (Posix) assert (filenameCmp(`abc\def`, `abc/def`) != 0);
version (Windows) assert (filenameCmp(`abc\def`, `abc/def`) == 0);
}
/** Matches a pattern against a path.
Some characters of pattern have a special meaning (they are
$(I meta-characters)) and can't be escaped. These are:
$(BOOKTABLE,
$(TR $(TD $(D *))
$(TD Matches 0 or more instances of any character.))
$(TR $(TD $(D ?))
$(TD Matches exactly one instance of any character.))
$(TR $(TD $(D [)$(I chars)$(D ]))
$(TD Matches one instance of any character that appears
between the brackets.))
$(TR $(TD $(D [!)$(I chars)$(D ]))
$(TD Matches one instance of any character that does not
appear between the brackets after the exclamation mark.))
$(TR $(TD $(D {)$(I string1)$(D ,)$(I string2)$(D ,)…$(D }))
$(TD Matches either of the specified strings.))
)
Individual characters are compared using $(D filenameCharCmp!cs),
where $(D cs) is an optional template parameter determining whether
the comparison is case sensitive or not. See the
$(LREF filenameCharCmp) documentation for details.
Note that directory
separators and dots don't stop a meta-character from matching
further portions of the path.
Returns:
$(D true) if pattern matches path, $(D false) otherwise.
See_also:
$(LINK2 http://en.wikipedia.org/wiki/Glob_%28programming%29,Wikipedia: _glob (programming))
Examples:
-----
assert (globMatch("foo.bar", "*"));
assert (globMatch("foo.bar", "*.*"));
assert (globMatch(`foo/foo\bar`, "f*b*r"));
assert (globMatch("foo.bar", "f???bar"));
assert (globMatch("foo.bar", "[fg]???bar"));
assert (globMatch("foo.bar", "[!gh]*bar"));
assert (globMatch("bar.fooz", "bar.{foo,bif}z"));
assert (globMatch("bar.bifz", "bar.{foo,bif}z"));
version (Windows)
{
// Same as calling globMatch!(CaseSensitive.no)(path, pattern)
assert (globMatch("foo", "Foo"));
assert (globMatch("Goo.bar", "[fg]???bar"));
}
version (linux)
{
// Same as calling globMatch!(CaseSensitive.yes)(path, pattern)
assert (!globMatch("foo", "Foo"));
assert (!globMatch("Goo.bar", "[fg]???bar"));
}
-----
*/
bool globMatch(CaseSensitive cs = CaseSensitive.osDefault, C)
(const(C)[] path, const(C)[] pattern)
@safe pure nothrow
if (isSomeChar!C)
in
{
// Verify that pattern[] is valid
assert(balancedParens(pattern, '[', ']', 0));
assert(balancedParens(pattern, '{', '}', 0));
}
body
{
size_t ni; // current character in path
foreach (ref pi; 0 .. pattern.length)
{
C pc = pattern[pi];
switch (pc)
{
case '*':
if (pi + 1 == pattern.length)
return true;
foreach (j; ni .. path.length)
{
if (globMatch!(cs, C)(path[j .. path.length],
pattern[pi + 1 .. pattern.length]))
return true;
}
return false;
case '?':
if (ni == path.length)
return false;
ni++;
break;
case '[':
if (ni == path.length)
return false;
auto nc = path[ni];
ni++;
auto not = false;
pi++;
if (pattern[pi] == '!')
{
not = true;
pi++;
}
auto anymatch = false;
while (1)
{
pc = pattern[pi];
if (pc == ']')
break;
if (!anymatch && (filenameCharCmp!cs(nc, pc) == 0))
anymatch = true;
pi++;
}
if (anymatch == not)
return false;
break;
case '{':
// find end of {} section
auto piRemain = pi;
for (; piRemain < pattern.length
&& pattern[piRemain] != '}'; piRemain++)
{}
if (piRemain < pattern.length) piRemain++;
pi++;
while (pi < pattern.length)
{
auto pi0 = pi;
pc = pattern[pi];
// find end of current alternative
for (; pi<pattern.length && pc!='}' && pc!=','; pi++)
{
pc = pattern[pi];
}
if (pi0 == pi)
{
if (globMatch!(cs, C)(path[ni..$], pattern[piRemain..$]))
{
return true;
}
pi++;
}
else
{
if (globMatch!(cs, C)(path[ni..$],
pattern[pi0..pi-1]
~ pattern[piRemain..$]))
{
return true;
}
}
if (pc == '}')
{
break;
}
}
return false;
default:
if (ni == path.length)
return false;
if (filenameCharCmp!cs(pc, path[ni]) != 0)
return false;
ni++;
break;
}
}
assert(ni <= path.length);
return ni == path.length;
}
unittest
{
assert (globMatch!(CaseSensitive.no)("foo", "Foo"));
assert (!globMatch!(CaseSensitive.yes)("foo", "Foo"));
assert(globMatch("foo", "*"));
assert(globMatch("foo.bar"w, "*"w));
assert(globMatch("foo.bar"d, "*.*"d));
assert(globMatch("foo.bar", "foo*"));
assert(globMatch("foo.bar"w, "f*bar"w));
assert(globMatch("foo.bar"d, "f*b*r"d));
assert(globMatch("foo.bar", "f???bar"));
assert(globMatch("foo.bar"w, "[fg]???bar"w));
assert(globMatch("foo.bar"d, "[!gh]*bar"d));
assert(!globMatch("foo", "bar"));
assert(!globMatch("foo"w, "*.*"w));
assert(!globMatch("foo.bar"d, "f*baz"d));
assert(!globMatch("foo.bar", "f*b*x"));
assert(!globMatch("foo.bar", "[gh]???bar"));
assert(!globMatch("foo.bar"w, "[!fg]*bar"w));
assert(!globMatch("foo.bar"d, "[fg]???baz"d));
assert(!globMatch("foo.di", "*.d")); // test issue 6634: triggered bad assertion
assert(globMatch("foo.bar", "{foo,bif}.bar"));
assert(globMatch("bif.bar"w, "{foo,bif}.bar"w));
assert(globMatch("bar.foo"d, "bar.{foo,bif}"d));
assert(globMatch("bar.bif", "bar.{foo,bif}"));
assert(globMatch("bar.fooz"w, "bar.{foo,bif}z"w));
assert(globMatch("bar.bifz"d, "bar.{foo,bif}z"d));
assert(globMatch("bar.foo", "bar.{biz,,baz}foo"));
assert(globMatch("bar.foo"w, "bar.{biz,}foo"w));
assert(globMatch("bar.foo"d, "bar.{,biz}foo"d));
assert(globMatch("bar.foo", "bar.{}foo"));
assert(globMatch("bar.foo"w, "bar.{ar,,fo}o"w));
assert(globMatch("bar.foo"d, "bar.{,ar,fo}o"d));
assert(globMatch("bar.o", "bar.{,ar,fo}o"));
static assert(globMatch("foo.bar", "[!gh]*bar"));
}
/** Checks that the given file or directory name is valid.
This function returns $(D true) if and only if $(D filename) is not
empty, not too long, and does not contain invalid characters.
The maximum length of $(D filename) is given by the constant
$(D core.stdc.stdio.FILENAME_MAX). (On Windows, this number is
defined as the maximum number of UTF-16 code points, and the
test will therefore only yield strictly correct results when
$(D filename) is a string of $(D wchar)s.)
On Windows, the following criteria must be satisfied
($(LINK2 http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx,source)):
$(UL
$(LI $(D filename) must not contain any characters whose integer
representation is in the range 0-31.)
$(LI $(D filename) must not contain any of the following $(I reserved
characters): <>:"/\|?*)
$(LI $(D filename) may not end with a space ($(D ' ')) or a period
($(D '.')).)
)
On POSIX, $(D filename) may not contain a forward slash ($(D '/')) or
the null character ($(D '\0')).
*/
bool isValidFilename(C)(in C[] filename) @safe pure nothrow if (isSomeChar!C)
{
import core.stdc.stdio;
if (filename.length == 0 || filename.length >= FILENAME_MAX) return false;
foreach (c; filename)
{
version (Windows)
{
switch (c)
{
case 0:
..
case 31:
case '<':
case '>':
case ':':
case '"':
case '/':
case '\\':
case '|':
case '?':
case '*':
return false;
default:
}
}
else version (Posix)
{
if (c == 0 || c == '/') return false;
}
else static assert (0);
}
version (Windows)
{
if (filename[$-1] == '.' || filename[$-1] == ' ') return false;
}
// All criteria passed
return true;
}
unittest
{
auto valid = ["foo"];
auto invalid = ["", "foo\0bar", "foo/bar"];
auto pfdep = [`foo\bar`, "*.txt"];
version (Windows) invalid ~= pfdep;
else version (Posix) valid ~= pfdep;
else static assert (0);
import std.typetuple;
foreach (T; TypeTuple!(char[], const(char)[], string, wchar[],
const(wchar)[], wstring, dchar[], const(dchar)[], dstring))
{
foreach (fn; valid)
assert (isValidFilename(to!T(fn)));
foreach (fn; invalid)
assert (!isValidFilename(to!T(fn)));
}
}
/** Checks whether $(D path) is a valid _path.
Generally, this function checks that $(D path) is not empty, and that
each component of the path either satisfies $(LREF isValidFilename)
or is equal to $(D ".") or $(D "..").
It does $(I not) check whether the _path points to an existing file
or directory; use $(XREF file,exists) for this purpose.
On Windows, some special rules apply:
$(UL
$(LI If the second character of $(D path) is a colon ($(D ':')),
the first character is interpreted as a drive letter, and
must be in the range A-Z (case insensitive).)
$(LI If $(D path) is on the form $(D `\\$(I server)\$(I share)\...`)
(UNC path), $(LREF isValidFilename) is applied to $(I server)
and $(I share) as well.)
$(LI If $(D path) starts with $(D `\\?\`) (long UNC path), the
only requirement for the rest of the string is that it does
not contain the null character.)
$(LI If $(D path) starts with $(D `\\.\`) (Win32 device namespace)
this function returns $(D false); such paths are beyond the scope
of this module.)
)
*/
bool isValidPath(C)(in C[] path) @safe pure nothrow if (isSomeChar!C)
{
if (path.empty) return false;
// Check whether component is "." or "..", or whether it satisfies
// isValidFilename.
bool isValidComponent(in C[] component) @safe pure nothrow
{
assert (component.length > 0);
if (component[0] == '.')
{
if (component.length == 1) return true;
else if (component.length == 2 && component[1] == '.') return true;
}
return isValidFilename(component);
}
if (path.length == 1)
return isDirSeparator(path[0]) || isValidComponent(path);
const(C)[] remainder;
version (Windows)
{
if (isDirSeparator(path[0]) && isDirSeparator(path[1]))
{
// Some kind of UNC path
if (path.length < 5)
{
// All valid UNC paths must have at least 5 characters
return false;
}
else if (path[2] == '?')
{
// Long UNC path
if (!isDirSeparator(path[3])) return false;
foreach (c; path[4 .. $])
{
if (c == '\0') return false;
}
return true;
}
else if (path[2] == '.')
{
// Win32 device namespace not supported
return false;
}
else
{
// Normal UNC path, i.e. \\server\share\...
size_t i = 2;
while (i < path.length && !isDirSeparator(path[i])) ++i;
if (i == path.length || !isValidFilename(path[2 .. i]))
return false;
++i; // Skip a single dir separator
size_t j = i;
while (j < path.length && !isDirSeparator(path[j])) ++j;
if (!isValidFilename(path[i .. j])) return false;
remainder = path[j .. $];
}
}
else if (isDriveSeparator(path[1]))
{
import std.ascii;
if (!isAlpha(path[0])) return false;
remainder = path[2 .. $];
}
else
{
remainder = path;
}
}
else version (Posix)
{
remainder = path;
}
else static assert (0);
assert (remainder !is null);
remainder = ltrimDirSeparators(remainder);
// Check that each component satisfies isValidComponent.
while (!remainder.empty)
{
size_t i = 0;
while (i < remainder.length && !isDirSeparator(remainder[i])) ++i;
assert (i > 0);
if (!isValidComponent(remainder[0 .. i])) return false;
remainder = ltrimDirSeparators(remainder[i .. $]);
}
// All criteria passed
return true;
}
unittest
{
assert (isValidPath("/foo/bar"));
assert (!isValidPath("/foo\0/bar"));
version (Windows)
{
assert (isValidPath(`c:\`));
assert (isValidPath(`c:\foo`));
assert (isValidPath(`c:\foo\.\bar\\\..\`));
assert (!isValidPath(`!:\foo`));
assert (!isValidPath(`c::\foo`));
assert (!isValidPath(`c:\foo?`));
assert (!isValidPath(`c:\foo.`));
assert (isValidPath(`\\server\share`));
assert (isValidPath(`\\server\share\foo`));
assert (isValidPath(`\\server\share\\foo`));
assert (!isValidPath(`\\\server\share\foo`));
assert (!isValidPath(`\\server\\share\foo`));
assert (!isValidPath(`\\ser*er\share\foo`));
assert (!isValidPath(`\\server\sha?e\foo`));
assert (!isValidPath(`\\server\share\|oo`));
assert (isValidPath(`\\?\<>:"?*|/\..\.`));
assert (!isValidPath("\\\\?\\foo\0bar"));
assert (!isValidPath(`\\.\PhysicalDisk1`));
}
}
/** Performs tilde expansion in paths on POSIX systems.
On Windows, this function does nothing.
There are two ways of using tilde expansion in a path. One
involves using the tilde alone or followed by a path separator. In
this case, the tilde will be expanded with the value of the
environment variable $(D HOME). The second way is putting
a username after the tilde (i.e. $(D ~john/Mail)). Here,
the username will be searched for in the user database
(i.e. $(D /etc/passwd) on Unix systems) and will expand to
whatever path is stored there. The username is considered the
string after the tilde ending at the first instance of a path
separator.
Note that using the $(D ~user) syntax may give different
values from just $(D ~) if the environment variable doesn't
match the value stored in the user database.
When the environment variable version is used, the path won't
be modified if the environment variable doesn't exist or it
is empty. When the database version is used, the path won't be
modified if the user doesn't exist in the database or there is
not enough memory to perform the query.
Returns:
$(D inputPath) with the tilde expanded, or just $(D inputPath)
if it could not be expanded.
For Windows, $(D expandTilde) merely returns its argument $(D inputPath).
Examples:
-----
void processFile(string path)
{
// Allow calling this function with paths such as ~/foo
auto fullPath = expandTilde(path);
...
}
-----
*/
string expandTilde(string inputPath)
{
version(Posix)
{
/* Joins a path from a C string to the remainder of path.
The last path separator from c_path is discarded. The result
is joined to path[char_pos .. length] if char_pos is smaller
than length, otherwise path is not appended to c_path.
*/
static string combineCPathWithDPath(char* c_path, string path, size_t char_pos)
{
assert(c_path != null);
assert(path.length > 0);
assert(char_pos >= 0);
// Search end of C string
size_t end = core.stdc.string.strlen(c_path);
// Remove trailing path separator, if any
if (end && isDirSeparator(c_path[end - 1]))
end--;
// Create our own copy, as lifetime of c_path is undocumented
string cp = c_path[0 .. end].idup;
// Do we append something from path?
if (char_pos < path.length)
cp ~= path[char_pos .. $];
return cp;
}
// Replaces the tilde from path with the environment variable HOME.
static string expandFromEnvironment(string path)
{
assert(path.length >= 1);
assert(path[0] == '~');
// Get HOME and use that to replace the tilde.
auto home = core.stdc.stdlib.getenv("HOME");
if (home == null)
return path;
return combineCPathWithDPath(home, path, 1);
}
// Replaces the tilde from path with the path from the user database.
static string expandFromDatabase(string path)
{
assert(path.length > 2 || (path.length == 2 && !isDirSeparator(path[1])));
assert(path[0] == '~');
// Extract username, searching for path separator.
string username;
auto last_char = std.algorithm.countUntil(path, dirSeparator[0]);
if (last_char == -1)
{
username = path[1 .. $] ~ '\0';
last_char = username.length + 1;
}
else
{
username = path[1 .. last_char] ~ '\0';
}
assert(last_char > 1);
// Reserve C memory for the getpwnam_r() function.
passwd result;
int extra_memory_size = 5 * 1024;
void* extra_memory;
while (1)
{
extra_memory = core.stdc.stdlib.malloc(extra_memory_size);
if (extra_memory == null)
goto Lerror;
// Obtain info from database.
passwd *verify;
setErrno(0);
if (getpwnam_r(cast(char*) username.ptr, &result, cast(char*) extra_memory, extra_memory_size,
&verify) == 0)
{
// Failure if verify doesn't point at result.
if (verify != &result)
// username is not found, so return path[]
goto Lnotfound;
break;
}
if (errno != ERANGE)
goto Lerror;
// extra_memory isn't large enough
core.stdc.stdlib.free(extra_memory);
extra_memory_size *= 2;
}
path = combineCPathWithDPath(result.pw_dir, path, last_char);
Lnotfound:
core.stdc.stdlib.free(extra_memory);
return path;
Lerror:
// Errors are going to be caused by running out of memory
if (extra_memory)
core.stdc.stdlib.free(extra_memory);
onOutOfMemoryError();
return null;
}
// Return early if there is no tilde in path.
if (inputPath.length < 1 || inputPath[0] != '~')
return inputPath;
if (inputPath.length == 1 || isDirSeparator(inputPath[1]))
return expandFromEnvironment(inputPath);
else
return expandFromDatabase(inputPath);
}
else version(Windows)
{
// Put here real windows implementation.
return inputPath;
}
else
{
static assert(0); // Guard. Implement on other platforms.
}
}
version(unittest) import std.process: environment;
unittest
{
version (Posix)
{
// Retrieve the current home variable.
auto oldHome = environment.get("HOME");
// Testing when there is no environment variable.
environment.remove("HOME");
assert(expandTilde("~/") == "~/");
assert(expandTilde("~") == "~");
// Testing when an environment variable is set.
environment["HOME"] = "dmd/test";
assert(expandTilde("~/") == "dmd/test/");
assert(expandTilde("~") == "dmd/test");
// The same, but with a variable ending in a slash.
environment["HOME"] = "dmd/test/";
assert(expandTilde("~/") == "dmd/test/");
assert(expandTilde("~") == "dmd/test");
// Recover original HOME variable before continuing.
if (oldHome !is null) environment["HOME"] = oldHome;
else environment.remove("HOME");
// Test user expansion for root. Are there unices without /root?
version (OSX)
assert(expandTilde("~root") == "/var/root", expandTilde("~root"));
else
assert(expandTilde("~root") == "/root", expandTilde("~root"));
version (OSX)
assert(expandTilde("~root/") == "/var/root/", expandTilde("~root/"));
else
assert(expandTilde("~root/") == "/root/", expandTilde("~root/"));
assert(expandTilde("~Idontexist/hey") == "~Idontexist/hey");
}
}
// =============================================================================
// Everything below this line is from an old version of std.path, and is
// scheduled for deprecation in February 2012.
// =============================================================================
import std.algorithm, std.array, std.conv, std.file, std.process, std.string,
std.traits;
import core.stdc.errno, core.stdc.stdlib;
version(Posix)
{
private import core.sys.posix.pwd;
private import core.exception : onOutOfMemoryError;
}
version(Windows)
{
/* * String used to separate directory names in a path. Under
* Windows this is a backslash, under Linux a slash. */
enum string sep = "\\";
/* * Alternate version of sep[] used in Windows (a slash). Under
* Linux this is empty. */
enum string altsep = "/";
/* * Path separator string. A semi colon under Windows, a colon
* under Linux. */
enum string pathsep = ";";
/* * String used to separate lines, \r\n under Windows and \n
* under Linux. */
enum string linesep = "\r\n"; // / String used to separate lines.
enum string curdir = "."; // / String representing the current directory.
enum string pardir = ".."; // / String representing the parent directory.
static assert(sep.length == 1 && altsep.length == 1);
private bool isSep(dchar ch) {
return ch == sep[0] || ch == altsep[0];
}
private bool isSepOrDriveSep(dchar ch) {
return isSep(ch) || ch == ':';
}
}
version(Posix)
{
/* * String used to separate directory names in a path. Under
* Windows this is a backslash, under Linux a slash. */
enum string sep = "/";
/* * Alternate version of sep[] used in Windows (a slash). Under
* Linux this is empty. */
enum string altsep = "";
/* * Path separator string. A semi colon under Windows, a colon
* under Linux. */
enum string pathsep = ":";
/* * String used to separate lines, \r\n under Windows and \n
* under Linux. */
enum string linesep = "\n";
enum string curdir = "."; // / String representing the current directory.
enum string pardir = ".."; // / String representing the parent directory.
static assert(sep.length == 1 && altsep.length == 0);
private bool isSep(dchar ch) {
return ch == sep[0];
}
}
/******************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF filenameCmp) instead.)
*
* Compare file names.
* Returns:
* <table border=1 cellpadding=4 cellspacing=0>
* <tr> <td> < 0 <td> filename1 < filename2
* <tr> <td> = 0 <td> filename1 == filename2
* <tr> <td> > 0 <td> filename1 > filename2
* </table>
*/
int fcmp(alias pred = "a < b", S1, S2)(S1 s1, S2 s2)
if (isSomeString!S1 && isSomeString!S2)
{
version (Windows) return std.string.icmp(s1, s2);
version (Posix) return std.algorithm.cmp(s1, s2);
}
/***************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF extension) instead.)
*
* Extracts the extension from a filename or path.
*
* This function will search fullname from the end until the
* first dot, path separator or first character of fullname is
* reached. Under Windows, the drive letter separator (<i>colon</i>)
* also terminates the search.
*
* Returns: If a dot was found, characters to its right are
* returned. If a path separator was found, or fullname didn't
* contain any dots or path separators, returns null.
*
* Throws: Nothing.
*
* Examples:
* -----
* version(Windows)
* {
* getExt(r"d:\path\foo.bat") // "bat"
* getExt(r"d:\path.two\bar") // null
* }
* version(Posix)
* {
* getExt(r"/home/user.name/bar.") // ""
* getExt(r"d:\\path.two\\bar") // "two\\bar"
* getExt(r"/home/user/.resource") // "resource"
* }
* -----
*/
string getExt()(string fullname)
{
auto i = fullname.length;
while (i > 0)
{
if (fullname[i - 1] == '.')
return fullname[i .. $];
i--;
version(Windows)
{
if (isSepOrDriveSep(fullname[i]))
break;
}
else version(Posix)
{
if (isSep(fullname[i]))
break;
}
else
{
static assert(0);
}
}
return null;
}
version (OldStdPathUnittest) unittest
{
debug(path) printf("path.getExt.unittest\n");
string result;
version (Windows)
result = getExt("d:\\path\\foo.bat");
version (Posix)
result = getExt("/path/foo.bat");
auto i = cmp(result, "bat");
assert(i == 0);
version (Windows)
result = getExt("d:\\path\\foo.");
version (Posix)
result = getExt("d/path/foo.");
i = cmp(result, "");
assert(i == 0);
version (Windows)
result = getExt("d:\\path\\foo");
version (Posix)
result = getExt("d/path/foo");
i = cmp(result, "");
assert(i == 0);
version (Windows)
result = getExt("d:\\path.bar\\foo");
version (Posix)
result = getExt("/path.bar/foo");
i = cmp(result, "");
assert(i == 0);
result = getExt("foo");
i = cmp(result, "");
assert(i == 0);
}
/***************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF stripExtension) instead.)
*
* Returns the extensionless version of a filename or path.
*
* This function will search fullname from the end until the
* first dot, path separator or first character of fullname is
* reached. Under Windows, the drive letter separator (<i>colon</i>)
* also terminates the search.
*
* Returns: If a dot was found, characters to its left are
* returned. If a path separator was found, or fullname didn't
* contain any dots or path separators, returns null.
*
* Throws: Nothing.
*
* Examples:
* -----
* version(Windows)
* {
* getName(r"d:\path\foo.bat") => "d:\path\foo"
* getName(r"d:\path.two\bar") => null
* }
* version(Posix)
* {
* getName("/home/user.name/bar.") => "/home/user.name/bar"
* getName(r"d:\path.two\bar") => "d:\path"
* getName("/home/user/.resource") => "/home/user/"
* }
* -----
*/
string getName()(string fullname)
{
auto i = fullname.length;
while (i > 0)
{
if (fullname[i - 1] == '.')
return fullname[0 .. i - 1];
i--;
version(Windows)
{
if (isSepOrDriveSep(fullname[i]))
break;
}
else version(Posix)
{
if (isSep(fullname[i]))
break;
}
else
{
static assert(0);
}
}
return null;
}
version (OldStdPathUnittest) unittest
{
debug(path) printf("path.getName.unittest\n");
string result;
result = getName("foo.bar");
auto i = cmp(result, "foo");
assert(i == 0);
result = getName("d:\\path.two\\bar");
version (Windows)
i = cmp(result, "");
version (Posix)
i = cmp(result, "d:\\path");
assert(i == 0);
}
/***************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF baseName) instead.)
*
* Extracts the base name of a path and optionally chops off a
* specific suffix.
*
* This function will search $(D_PARAM fullname) from the end until
* the first path separator or first character of $(D_PARAM fullname)
* is reached. Under Windows, the drive letter separator ($(I colon))
* also terminates the search. After the search has ended, keep the
* portion to the right of the separator if found, or the entire
* $(D_PARAM fullname) otherwise. If the kept portion has suffix
* $(D_PARAM extension), remove that suffix. Return the remaining string.
*
* Returns: The portion of $(D_PARAM fullname) left after the path
* part and the extension part, if any, have been removed.
*
* Throws: Nothing.
*
* Examples:
* -----
* version(Windows)
* {
* basename(r"d:\path\foo.bat") => "foo.bat"
* basename(r"d:\path\foo", ".bat") => "foo"
* }
* version(Posix)
* {
* basename("/home/user.name/bar.") => "bar."
* basename("/home/user.name/bar.", ".") => "bar"
* }
* -----
*/
Char[] basename(Char, ExtChar = immutable(char))(
Char[] fullname, ExtChar[] extension = null)
if (isSomeChar!Char && isSomeChar!ExtChar)
out (result)
{
assert(result.length <= fullname.length);
}
body
{
auto i = fullname.length;
for (; i > 0; i--)
{
version(Windows)
{
if (isSepOrDriveSep(fullname[i - 1]))
break;
}
else version(Posix)
{
if (isSep(fullname[i - 1]))
break;
}
else
{
static assert(0);
}
}
return chomp(fullname[i .. $],
extension.length ? extension : "");
}
/* * Alias for $(D_PARAM basename), kept for backward
* compatibility. New code should use $(D_PARAM basename). */
alias basename getBaseName;
version (OldStdPathUnittest) unittest
{
debug(path) printf("path.basename.unittest\n");
string result;
version (Windows)
result = basename("d:\\path\\foo.bat");
version (Posix)
result = basename("/path/foo.bat");
//printf("result = '%.*s'\n", result);
assert(result == "foo.bat");
version (Windows)
result = basename("a\\b");
version (Posix)
result = basename("a/b");
assert(result == "b");
version (Windows)
result = basename("a\\b.cde", ".cde");
version (Posix)
result = basename("a/b.cde", ".cde");
assert(result == "b");
version (Windows)
{
assert(basename("abc/xyz") == "xyz");
assert(basename("abc/") == "");
assert(basename("C:/a/b") == "b");
assert(basename(`C:\a/b`) == "b");
}
assert(basename("~/dmd.conf"w, ".conf"d) == "dmd");
assert(basename("~/dmd.conf"d, ".conf"d) == "dmd");
assert(basename("dmd.conf"w.dup, ".conf"d.dup) == "dmd");
}
/***************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF dirName) instead.)
*
* Extracts the directory part of a path.
*
* This function will search $(D fullname) from the end until the
* first path separator or first character of $(D fullname) is
* reached. Under Windows, the drive letter separator ($(I colon))
* also terminates the search.
*
* Returns: If a path separator was found, all the characters to its
* left without any trailing path separators are returned. Otherwise,
* $(D ".") is returned.
*
* The found path separator will be included in the returned string
* if and only if it represents the root.
*
* Throws: Nothing.
*
* Examples:
* -----
* version(Windows)
* {
* assert(dirname(r"d:\path\foo.bat") == r"d:\path");
* assert(dirname(r"d:\path") == r"d:\");
* assert(dirname("d:foo.bat") == "d:.");
* assert(dirname("foo.bat") == ".");
* }
* version(Posix)
* {
* assert(dirname("/home/user") == "/home");
* assert(dirname("/home") == "/");
* assert(dirname("user") == ".");
* }
* -----
*/
Char[] dirname(Char)(Char[] fullname)
if (isSomeChar!Char)
{
alias immutable(Char)[] ImmString;
Char[] s = fullname;
version (Posix)
{
enum ImmString sep = .sep;
enum ImmString curdir = .curdir;
for (; !s.empty; s.popBack)
{
if (s.endsWith(sep))
break;
}
if (s.empty)
{
return to!(Char[])(curdir);
}
// remove excess non-root slashes: "/home//" --> "/home"
while (s.length > sep.length && s.endsWith(sep))
{
s.popBack;
}
return s;
}
else version (Windows)
{
enum ImmString sep = .sep;
enum ImmString altsep = .altsep;
enum ImmString curdir = .curdir;
enum ImmString drvsep = ":";
bool foundSep;
for (; !s.empty; s.popBack)
{
if (uint withWhat = s.endsWith(sep, altsep, drvsep))
{
foundSep = (withWhat != 3);
break;
}
}
if (!foundSep)
{
return to!(Char[])(s.empty ? curdir : s ~ curdir);
}
// remove excess non-root separators: "C:\\" --> "C:\"
while (s.endsWith(sep) || s.endsWith(altsep))
{
auto ss = s.save;
s.popBack;
if (s.empty || s.endsWith(drvsep))
{
s = ss; // preserve path separator representing root
break;
}
}
return s;
}
else // unknown platform
{
static assert(0);
}
}
version (OldStdPathUnittest) unittest
{
assert(dirname("") == ".");
assert(dirname("fileonly") == ".");
version (Posix)
{
assert(dirname("/path/to/file") == "/path/to");
assert(dirname("/home") == "/");
assert(dirname("/dev/zero"w) == "/dev");
assert(dirname("/dev/null"d) == "/dev");
assert(dirname(".login"w.dup) == ".");
assert(dirname(".login"d.dup) == ".");
// doc example
assert(dirname("/home/user") == "/home");
assert(dirname("/home") == "/");
assert(dirname("user") == ".");
}
version (Windows)
{
assert(dirname(r"\path\to\file") == r"\path\to");
assert(dirname(r"\foo") == r"\");
assert(dirname(r"c:\foo") == r"c:\");
assert(dirname("\\Windows"w) == "\\");
assert(dirname("\\Users"d) == "\\");
assert(dirname("ntuser.dat"w.dup) == ".");
assert(dirname("ntuser.dat"d.dup) == ".");
// doc example
assert(dirname(r"d:\path\foo.bat") == r"d:\path");
assert(dirname(r"d:\path") == "d:\\");
assert(dirname("d:foo.bat") == "d:.");
assert(dirname("foo.bat") == ".");
}
{
// fixed-length strings
char[4] u = "abcd";
wchar[4] w = "abcd";
dchar[4] d = "abcd";
assert(dirname(u) == ".");
assert(dirname(w) == "."w);
assert(dirname(d) == "."d);
}
}
/* * Alias for $(D_PARAM dirname), kept for backward
* compatibility. New code should use $(D_PARAM dirname). */
alias dirname getDirName;
version (OldStdPathUnittest) unittest
{
string filename = "foo/bar";
auto d = getDirName(filename);
assert(d == "foo");
}
version (OldStdPathUnittest) unittest // dirname + basename
{
static immutable Common_dirbasename_testcases =
[
[ "/usr/lib" , "/usr" , "lib" ],
[ "/usr/" , "/usr" , "" ],
[ "/usr" , "/" , "usr" ],
[ "/" , "/" , "" ],
[ "var/run" , "var" , "run" ],
[ "var/" , "var" , "" ],
[ "var" , "." , "var" ],
[ "." , "." , "." ],
[ "/usr///lib", "/usr" , "lib" ],
[ "///usr///" , "///usr" , "" ],
[ "///usr" , "/" , "usr" ],
[ "///" , "/" , "" ],
[ "var///run" , "var" , "run" ],
[ "var///" , "var" , "" ],
[ "a/b/c" , "a/b" , "c" ],
[ "a///c" , "a" , "c" ],
[ "/\u7A74" , "/" , "\u7A74" ],
[ "/\u7A74/." , "/\u7A74", "." ]
];
static immutable Windows_dirbasename_testcases =
Common_dirbasename_testcases ~
[
[ "C:\\Users\\7mi", "C:\\Users", "7mi" ],
[ "C:\\Users\\" , "C:\\Users", "" ],
[ "C:\\Users" , "C:\\" , "Users" ],
[ "C:\\" , "C:\\" , "" ],
[ "C:Temp" , "C:." , "Temp" ],
[ "C:" , "C:." , "" ],
[ "\\dmd\\src" , "\\dmd" , "src" ],
[ "\\dmd\\" , "\\dmd" , "" ],
[ "\\dmd" , "\\" , "dmd" ],
[ "C:/Users/7mi" , "C:/Users" , "7mi" ],
[ "C:/Users/" , "C:/Users" , "" ],
[ "C:/Users" , "C:/" , "Users" ],
[ "C:/" , "C:/" , "" ],
[ "C:\\//WinNT" , "C:\\" , "WinNT" ],
[ "C://\\WinNT" , "C:/" , "WinNT" ],
[ `a\b\c` , `a\b` , "c" ],
[ `a\\\c` , "a" , "c" ]
];
version (Windows)
alias Windows_dirbasename_testcases testcases;
else
alias Common_dirbasename_testcases testcases;
foreach (tc; testcases)
{
string path = tc[0];
string dir = tc[1];
string base = tc[2];
assert(path.dirname == dir);
assert(path.basename == base);
}
}
/*********************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF driveName) instead.)
*
* Extracts the drive letter of a path.
*
* This function will search fullname for a colon from the beginning.
*
* Returns: If a colon is found, all the characters to its left
* plus the colon are returned. Otherwise, null is returned.
*
* Under Linux, this function always returns null immediately.
*
* Throws: Nothing.
*
* Examples:
* -----
* getDrive(r"d:\path\foo.bat") => "d:"
* -----
*/
Char[] getDrive(Char)(Char[] fullname) if (isSomeChar!Char)
// out(result)
// {
// assert(result.length <= fullname.length);
// }
body
{
version(Windows)
{
foreach (i; 0 .. fullname.length)
{
if (fullname[i] == ':')
return fullname[0 .. i + 1];
}
return null;
}
else version(Posix)
{
return null;
}
else
{
static assert(0);
}
}
/*****************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF defaultExtension) instead.)
*
* Appends a default extension to a filename.
*
* This function first searches filename for an extension and
* appends ext if there is none. ext should not have any leading
* dots, one will be inserted between filename and ext if filename
* doesn't already end with one.
*
* Returns: filename if it contains an extension, otherwise filename
* + ext.
*
* Throws: Nothing.
*
* Examples:
* -----
* defaultExt("foo.txt", "raw") => "foo.txt"
* defaultExt("foo.", "raw") => "foo.raw"
* defaultExt("bar", "raw") => "bar.raw"
* -----
*/
string defaultExt()(string filename, string ext)
{
string existing;
existing = getExt(filename);
if (existing.length == 0)
{
// Check for filename ending in '.'
if (filename.length && filename[$ - 1] == '.')
filename ~= ext;
else
filename = filename ~ "." ~ ext;
}
return filename;
}
/*****************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF setExtension) instead.)
*
* Adds or replaces an extension to a filename.
*
* This function first searches filename for an extension and
* replaces it with ext if found. If there is no extension, ext
* will be appended. ext should not have any leading dots, one will
* be inserted between filename and ext if filename doesn't already
* end with one.
*
* Returns: filename + ext if filename is extensionless. Otherwise
* strips filename's extension off, appends ext and returns the
* result.
*
* Throws: Nothing.
*
* Examples:
* -----
* addExt("foo.txt", "raw") => "foo.raw"
* addExt("foo.", "raw") => "foo.raw"
* addExt("bar", "raw") => "bar.raw"
* -----
*/
string addExt()(string filename, string ext)
{
string existing;
existing = getExt(filename);
if (existing.length == 0)
{
// Check for filename ending in '.'
if (filename.length && filename[$ - 1] == '.')
filename ~= ext;
else
filename = filename ~ "." ~ ext;
}
else
{
filename = filename[0 .. $ - existing.length] ~ ext;
}
return filename;
}
/**************************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF isAbsolute) instead.)
*
* Checks if path is absolute.
*
* Returns: non-zero if the path starts from the root directory (Linux) or
* drive letter and root directory (Windows),
* zero otherwise.
*
* Throws: Nothing.
*
* Examples:
* -----
* version(Windows)
* {
* isabs(r"relative\path") => 0
* isabs(r"\relative\path") => 0
* isabs(r"d:\absolute") => 1
* }
* version(Posix)
* {
* isabs("/home/user") => 1
* isabs("foo") => 0
* }
* -----
*/
bool isabs()(in char[] path)
{
auto d = getDrive(path);
version (Windows)
{
return d.length < path.length && isSep(path[d.length]);
}
else version (Posix)
{
return d.length < path.length && isSep(path[d.length]);
}
else
{
static assert(0);
}
}
version (OldStdPathUnittest) unittest
{
debug(path) printf("path.isabs.unittest\n");
version (Windows)
{
assert(!isabs(r"relative\path"));
assert(isabs(r"\relative\path"));
assert(isabs(r"d:\absolute"));
}
version (Posix)
{
assert(isabs("/home/user"));
assert(!isabs("foo"));
}
}
/**
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF absolutePath) instead.)
*
* Converts a relative path into an absolute path.
*/
string rel2abs()(string path)
{
if (!path.length || isabs(path))
{
return path;
}
auto myDir = getcwd;
if (path.startsWith(curdir))
{
auto p = path[curdir.length .. $];
if (p.startsWith(sep))
path = p[sep.length .. $];
else if (altsep.length && p.startsWith(altsep))
path = p[altsep.length .. $];
else if (!p.length)
path = null;
}
return myDir.endsWith(sep) || path.length
? join(myDir, path)
: myDir;
}
version (OldStdPathUnittest) unittest
{
version (Posix)
{
auto myDir = getcwd();
scope(exit) std.file.chdir(myDir);
std.file.chdir("/");
assert(rel2abs(".") == "/", rel2abs("."));
assert(rel2abs("bin") == "/bin", rel2abs("bin"));
assert(rel2abs("./bin") == "/bin", rel2abs("./bin"));
std.file.chdir("bin");
assert(rel2abs(".") == "/bin", rel2abs("."));
}
}
/**************************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF buildPath) instead.)
*
* Joins two or more path components.
*
* If p1 doesn't have a trailing path separator, one will be appended
* to it before concatenating p2.
*
* Returns: p1 ~ p2. However, if p2 is an absolute path, only p2
* will be returned.
*
* Throws: Nothing.
*
* Examples:
* -----
* version(Windows)
* {
* join(r"c:\foo", "bar") => r"c:\foo\bar"
* join("foo", r"d:\bar") => r"d:\bar"
* }
* version(Posix)
* {
* join("/foo/", "bar") => "/foo/bar"
* join("/foo", "/bar") => "/bar"
* }
* -----
*/
string join()(const(char)[] p1, const(char)[] p2, const(char)[][] more...)
{
if (more.length)
{
// more than two components present
return join(join(p1, p2), more[0], more[1 .. $]);
}
// Focus on exactly two components
if (!p2.length)
return p1.idup;
if (!p1.length)
return p2.idup;
version (Posix)
{
if (isabs(p2)) return p2.idup;
if (p1.endsWith(sep) || altsep.length && p1.endsWith(altsep))
{
return cast(string) (p1 ~ p2);
}
return cast(string) (p1 ~ sep ~ p2);
}
else version (Windows)
{
string p;
const(char)[] d1;
if (getDrive(p2))
{
p = p2.idup;
}
else
{
d1 = getDrive(p1);
if (p1.length == d1.length)
{
p = cast(string) (p1 ~ p2);
}
else if (isSep(p2[0]))
{
if (d1.length == 0)
p = p2.idup;
else if (isSep(p1[$ - 1]))
p = cast(string) (p1 ~ p2[1 .. $]);
else
p = cast(string) (p1 ~ p2);
}
else if (isSep(p1[$ - 1]))
{
p = cast(string) (p1 ~ p2);
}
else
{
p = cast(string)(p1 ~ sep ~ p2);
}
}
return p;
}
else // unknown platform
{
static assert(0);
}
}
version (OldStdPathUnittest) unittest
{
debug(path) printf("path.join.unittest\n");
string p;
sizediff_t i;
p = join("foo", "bar");
version (Windows)
i = cmp(p, "foo\\bar");
version (Posix)
i = cmp(p, "foo/bar");
assert(i == 0);
version (Windows)
{ p = join("foo\\", "bar");
i = cmp(p, "foo\\bar");
}
version (Posix)
{ p = join("foo/", "bar");
i = cmp(p, "foo/bar");
}
assert(i == 0);
version (Windows)
{ p = join("foo", "\\bar");
i = cmp(p, "\\bar");
}
version (Posix)
{ p = join("foo", "/bar");
i = cmp(p, "/bar");
}
assert(i == 0);
version (Windows)
{ p = join("foo\\", "\\bar");
i = cmp(p, "\\bar");
}
version (Posix)
{ p = join("foo/", "/bar");
i = cmp(p, "/bar");
}
assert(i == 0);
version(Windows)
{
p = join("d:", "bar");
i = cmp(p, "d:bar");
assert(i == 0);
p = join("d:\\", "bar");
i = cmp(p, "d:\\bar");
assert(i == 0);
p = join("d:\\", "\\bar");
i = cmp(p, "d:\\bar");
assert(i == 0);
p = join("d:\\foo", "bar");
i = cmp(p, "d:\\foo\\bar");
assert(i == 0);
p = join("d:", "\\bar");
i = cmp(p, "d:\\bar");
assert(i == 0);
p = join("foo", "d:");
i = cmp(p, "d:");
assert(i == 0);
p = join("foo", "d:\\");
i = cmp(p, "d:\\");
assert(i == 0);
p = join("foo", "d:\\bar");
i = cmp(p, "d:\\bar");
assert(i == 0);
assert(join("d","dmd","src") == "d\\dmd\\src");
}
assert (join("", "foo") == "foo");
assert (join("foo", "") == "foo");
}
/**********************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF filenameCharCmp) instead.)
*
* Matches filename characters.
*
* Under Windows, the comparison is done ignoring case. Under Linux
* an exact match is performed.
*
* Returns: non zero if c1 matches c2, zero otherwise.
*
* Throws: Nothing.
*
* Examples:
* -----
* version(Windows)
* {
* fncharmatch('a', 'b') => 0
* fncharmatch('A', 'a') => 1
* }
* version(Posix)
* {
* fncharmatch('a', 'b') => 0
* fncharmatch('A', 'a') => 0
* }
* -----
*/
bool fncharmatch()(dchar c1, dchar c2)
{
version (Windows)
{
if (c1 != c2)
{
if ('A' <= c1 && c1 <= 'Z')
c1 += cast(char)'a' - 'A';
if ('A' <= c2 && c2 <= 'Z')
c2 += cast(char)'a' - 'A';
return c1 == c2;
}
return true;
}
else version (Posix)
{
return c1 == c2;
}
else
{
static assert(0);
}
}
/*************************************
* $(RED Scheduled for deprecation in February 2012. Please use
* $(LREF globMatch) instead.)
*
* Matches a pattern against a filename.
*
* Some characters of pattern have special a meaning (they are
* <i>meta-characters</i>) and <b>can't</b> be escaped. These are:
* <p><table>
* <tr><td><b>*</b></td>
* <td>Matches 0 or more instances of any character.</td></tr>
* <tr><td><b>?</b></td>
* <td>Matches exactly one instances of any character.</td></tr>
* <tr><td><b>[</b><i>chars</i><b>]</b></td>
* <td>Matches one instance of any character that appears
* between the brackets.</td></tr>
* <tr><td><b>[!</b><i>chars</i><b>]</b></td>
* <td>Matches one instance of any character that does not appear
* between the brackets after the exclamation mark.</td></tr>
* </table><p>
* Internally individual character comparisons are done calling
* fncharmatch(), so its rules apply here too. Note that path
* separators and dots don't stop a meta-character from matching
* further portions of the filename.
*
* Returns: non zero if pattern matches filename, zero otherwise.
*
* See_Also: fncharmatch().
*
* Throws: Nothing.
*
* Examples:
* -----
* version(Windows)
* {
* fnmatch("foo.bar", "*") => 1
* fnmatch(r"foo/foo\bar", "f*b*r") => 1
* fnmatch("foo.bar", "f?bar") => 0
* fnmatch("Goo.bar", "[fg]???bar") => 1
* fnmatch(r"d:\foo\bar", "d*foo?bar") => 1
* }
* version(Posix)
* {
* fnmatch("Go*.bar", "[fg]???bar") => 0
* fnmatch("/foo*home/bar", "?foo*bar") => 1
* fnmatch("foobar", "foo?bar") => 1
* }
* -----
*/
bool fnmatch()(const(char)[] filename, const(char)[] pattern)
in
{
// Verify that pattern[] is valid
assert(balancedParens(pattern, '[', ']', 0));
assert(balancedParens(pattern, '{', '}', 0));
}
body
{
size_t ni; // current character in filename
foreach (pi; 0 .. pattern.length)
{
char pc = pattern[pi];
switch (pc)
{
case '*':
if (pi + 1 == pattern.length)
return true;
foreach (j; ni .. filename.length)
{
if (fnmatch(filename[j .. $],
pattern[pi + 1 .. $]))
return true;
}
return false;
case '?':
if (ni == filename.length)
return false;
ni++;
break;
case '[': {
if (ni == filename.length)
return false;
auto nc = filename[ni];
ni++;
auto not = false;
pi++;
if (pattern[pi] == '!')
{
not = true;
pi++;
}
auto anymatch = false;
while (1)
{
pc = pattern[pi];
if (pc == ']')
break;
if (!anymatch && fncharmatch(nc, pc))
anymatch = true;
pi++;
}
if (anymatch == not)
return false;
}
break;
case '{': {
// find end of {} section
auto piRemain = pi;
for (; piRemain < pattern.length
&& pattern[piRemain] != '}'; piRemain++)
{}
if (piRemain < pattern.length) piRemain++;
pi++;
while (pi < pattern.length)
{
auto pi0 = pi;
pc = pattern[pi];
// find end of current alternative
for (; pi<pattern.length && pc!='}' && pc!=','; pi++)
{
pc = pattern[pi];
}
if (pi0 == pi)
{
if (fnmatch(filename[ni..$], pattern[piRemain..$]))
{
return true;
}
pi++;
}
else
{
if (fnmatch(filename[ni..$],
pattern[pi0..pi-1]
~ pattern[piRemain..$]))
{
return true;
}
}
if (pc == '}')
{
break;
}
}
}
return false;
default:
if (ni == filename.length)
return false;
if (!fncharmatch(pc, filename[ni]))
return false;
ni++;
break;
}
}
assert(ni <= filename.length);
return ni == filename.length;
}
version (OldStdPathUnittest) unittest
{
debug(path) printf("path.fnmatch.unittest\n");
version (Windows)
assert(fnmatch("foo", "Foo"));
version (linux)
assert(!fnmatch("foo", "Foo"));
assert(fnmatch("foo", "*"));
assert(fnmatch("foo.bar", "*"));
assert(fnmatch("foo.bar", "*.*"));
assert(fnmatch("foo.bar", "foo*"));
assert(fnmatch("foo.bar", "f*bar"));
assert(fnmatch("foo.bar", "f*b*r"));
assert(fnmatch("foo.bar", "f???bar"));
assert(fnmatch("foo.bar", "[fg]???bar"));
assert(fnmatch("foo.bar", "[!gh]*bar"));
assert(!fnmatch("foo", "bar"));
assert(!fnmatch("foo", "*.*"));
assert(!fnmatch("foo.bar", "f*baz"));
assert(!fnmatch("foo.bar", "f*b*x"));
assert(!fnmatch("foo.bar", "[gh]???bar"));
assert(!fnmatch("foo.bar", "[!fg]*bar"));
assert(!fnmatch("foo.bar", "[fg]???baz"));
assert(!fnmatch("foo.di", "*.d")); // test issue 6634: triggered bad assertion
assert(fnmatch("foo.bar", "{foo,bif}.bar"));
assert(fnmatch("bif.bar", "{foo,bif}.bar"));
assert(fnmatch("bar.foo", "bar.{foo,bif}"));
assert(fnmatch("bar.bif", "bar.{foo,bif}"));
assert(fnmatch("bar.fooz", "bar.{foo,bif}z"));
assert(fnmatch("bar.bifz", "bar.{foo,bif}z"));
assert(fnmatch("bar.foo", "bar.{biz,,baz}foo"));
assert(fnmatch("bar.foo", "bar.{biz,}foo"));
assert(fnmatch("bar.foo", "bar.{,biz}foo"));
assert(fnmatch("bar.foo", "bar.{}foo"));
assert(fnmatch("bar.foo", "bar.{ar,,fo}o"));
assert(fnmatch("bar.foo", "bar.{,ar,fo}o"));
assert(fnmatch("bar.o", "bar.{,ar,fo}o"));
}
|
D
|
/*
* Hunt - A high-level D Programming Language Web framework that encourages rapid development and clean, pragmatic design.
*
* Copyright (C) 2015-2019, HuntLabs
*
* Website: https://www.huntlabs.net/
*
* Licensed under the Apache-2.0 License.
*
*/
module hunt.framework.websocket.server.WebSocketHttpRequestHandler;
// import java.io.IOException;
// import java.util.ArrayList;
// import java.util.HashMap;
// import java.util.List;
// import java.util.Map;
// import javax.servlet.ServletContext;
// import javax.servlet.ServletException;
// import javax.servlet.http.HttpServletRequest;
// import javax.servlet.http.HttpServletResponse;
import hunt.collection;
import hunt.logging;
// import hunt.framework.web.HttpRequestHandler;
// import hunt.framework.web.context.ServletContextAware;
// import hunt.framework.websocket.handler.ExceptionWebSocketHandlerDecorator;
// import hunt.framework.websocket.handler.LoggingWebSocketHandlerDecorator;
// import hunt.framework.websocket.server.HandshakeFailureException;
// import hunt.framework.websocket.server.HandshakeHandler;
// import hunt.framework.websocket.server.HandshakeInterceptor;
import hunt.framework.websocket.StandardWebSocketSession;
import hunt.framework.websocket.WebSocketMessageHandler;
// import hunt.http.codec.http.model.MetaData;
import hunt.http.codec.http.model;
import hunt.http.codec.http.stream;
import hunt.http.codec.websocket.frame.Frame;
import hunt.http.codec.websocket.frame.WebSocketFrame;
import hunt.http.codec.websocket.model.CloseStatus;
import hunt.http.codec.websocket.stream.WebSocketConnection;
import hunt.http.server.WebSocketHandler;
/**
* A {@link HttpRequestHandler} for processing WebSocket handshake requests.
*
* <p>This is the main class to use when configuring a server WebSocket at a specific URL.
* It is a very thin wrapper around a {@link WebSocketHandler} and a {@link HandshakeHandler},
* also adapting the {@link HttpServletRequest} and {@link HttpServletResponse} to
* {@link ServerHttpRequest} and {@link ServerHttpResponse}, respectively.
*
* @author Rossen Stoyanchev
* @since 4.0
*/
class WebSocketHttpRequestHandler : WebSocketHandler { // , Lifecycle, ServletContextAware
private WebSocketMessageHandler wsHandler;
private StandardWebSocketSession wsSession;
// private HandshakeHandler handshakeHandler;
// private List!(HandshakeInterceptor) interceptors = new ArrayList<>();
private bool running = false;
this(WebSocketMessageHandler wsHandler) {
// this(wsHandler, new DefaultHandshakeHandler());
this.wsHandler = wsHandler;
}
// this(WebSocketMessageHandler wsHandler, HandshakeHandler handshakeHandler) {
// assert(wsHandler, "wsHandler must not be null");
// assert(handshakeHandler, "handshakeHandler must not be null");
// this.wsHandler = wsHandler; // new ExceptionWebSocketHandlerDecorator(new LoggingWebSocketHandlerDecorator(wsHandler));
// this.handshakeHandler = handshakeHandler;
// }
/**
* Return the WebSocketHandler.
*/
WebSocketMessageHandler getWebSocketHandler() {
return this.wsHandler;
}
/**
* Return the HandshakeHandler.
*/
// HandshakeHandler getHandshakeHandler() {
// return this.handshakeHandler;
// }
/**
* Configure one or more WebSocket handshake request interceptors.
*/
// void setHandshakeInterceptors(List!(HandshakeInterceptor) interceptors) {
// this.interceptors.clear();
// if (interceptors !is null) {
// this.interceptors.addAll(interceptors);
// }
// }
/**
* Return the configured WebSocket handshake request interceptors.
*/
// List!(HandshakeInterceptor) getHandshakeInterceptors() {
// return this.interceptors;
// }
// override
// void setServletContext(ServletContext servletContext) {
// if (this.handshakeHandler instanceof ServletContextAware) {
// ((ServletContextAware) this.handshakeHandler).setServletContext(servletContext);
// }
// }
// override
// void start() {
// if (!isRunning()) {
// this.running = true;
// if (this.handshakeHandler instanceof Lifecycle) {
// ((Lifecycle) this.handshakeHandler).start();
// }
// }
// }
// override
// void stop() {
// if (isRunning()) {
// this.running = false;
// if (this.handshakeHandler instanceof Lifecycle) {
// ((Lifecycle) this.handshakeHandler).stop();
// }
// }
// }
// override
bool isRunning() {
return this.running;
}
override void onConnect(WebSocketConnection session) {
version(HUNT_DEBUG)
info("WebSocket connection on: ", session.getUpgradeRequest.getURI.toString());
this.wsSession.initializeNativeSession(session);
this.wsHandler.afterConnectionEstablished(this.wsSession);
}
override void onFrame(Frame frame, WebSocketConnection connection) {
this.wsHandler.handleMessage(this.wsSession, cast(WebSocketFrame)frame);
}
override void onError(Exception t, WebSocketConnection connection) {
this.wsHandler.handleTransportError(this.wsSession, t);
}
override
bool acceptUpgrade(HttpRequest request, HttpResponse response,
HttpOutputStream output, HttpConnection connection) {
// HandshakeInterceptorChain chain = new HandshakeInterceptorChain(this.interceptors, this.wsHandler);
// HandshakeFailureException failure = null;
try {
version(HUNT_DEBUG) {
info("Upgrade handshaking...");
trace(request.getMethod() ~ " " ~ request.getURIString());
}
version(Have_hunt_security) {
wsSession = new StandardWebSocketSession(request.getFields(), null,
connection.getTcpConnection().getLocalAddress(), connection.getTcpConnection().getRemoteAddress(), null); // user
} else {
wsSession = new StandardWebSocketSession(request.getFields(), null,
connection.getTcpConnection().getLocalAddress(), connection.getTcpConnection().getRemoteAddress());
}
// Map!(string, Object) attributes = new HashMap<>();
// if (!chain.applyBeforeHandshake(request, response, attributes)) {
// return;
// }
// this.handshakeHandler.doHandshake(request, response, this.wsHandler, attributes);
// chain.applyAfterHandshake(request, response, null);
// response.close();
}
// catch (HandshakeFailureException ex) {
// failure = ex;
// }
catch (Throwable ex) {
errorf("Uncaught failure for request " ~ request.getURI().toString() ~ "\n", ex);
// failure = new HandshakeFailureException("Uncaught failure for request " ~ request.getURI(), ex);
}
finally {
// if (failure !is null) {
// chain.applyAfterHandshake(request, response, failure);
// throw failure;
// }
}
return true;
}
}
|
D
|
/**
* Generate debug info in the CV4 debug format.
*
* Copyright: Copyright (C) 1999-2022 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/tocsym.d, _tocvdebug.d)
* Documentation: https://dlang.org/phobos/dmd_tocvdebug.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/tocvdebug.d
*/
module dmd.tocvdebug;
version (Windows)
{
import core.stdc.stdio;
import core.stdc.string;
import core.stdc.stddef;
import core.stdc.stdlib;
import core.stdc.time;
import dmd.root.array;
import dmd.root.rmem;
import dmd.aggregate;
import dmd.apply;
import dmd.astenums;
import dmd.dclass;
import dmd.declaration;
import dmd.denum;
import dmd.dmodule;
import dmd.dsymbol;
import dmd.dstruct;
import dmd.dtemplate;
import dmd.func;
import dmd.globals;
import dmd.id;
import dmd.mtype;
import dmd.target;
import dmd.toctype;
import dmd.visitor;
import dmd.backend.cc;
import dmd.backend.cdef;
import dmd.backend.cgcv;
import dmd.backend.code;
import dmd.backend.cv4;
import dmd.backend.dlist;
import dmd.backend.dt;
import dmd.backend.global;
import dmd.backend.obj;
import dmd.backend.oper;
import dmd.backend.ty;
import dmd.backend.type;
extern (C++):
/* The CV4 debug format is defined in:
* "CV4 Symbolic Debug Information Specification"
* rev 3.1 March 5, 1993
* Languages Business Unit
* Microsoft
*/
/******************************
* CV4 pg. 25
* Convert D visibility attribute to cv attribute.
*/
uint visibilityToCVAttr(Visibility.Kind vis) pure nothrow @safe @nogc
{
uint attribute;
final switch (vis)
{
case Visibility.Kind.private_: attribute = 1; break;
case Visibility.Kind.package_: attribute = 2; break;
case Visibility.Kind.protected_: attribute = 2; break;
case Visibility.Kind.public_: attribute = 3; break;
case Visibility.Kind.export_: attribute = 3; break;
case Visibility.Kind.undefined:
case Visibility.Kind.none:
//printf("vis = %d\n", vis);
assert(0);
}
return attribute;
}
uint cv4_memfunctypidx(FuncDeclaration fd)
{
//printf("cv4_memfunctypidx(fd = '%s')\n", fd.toChars());
type *t = Type_toCtype(fd.type);
if (AggregateDeclaration ad = fd.isMemberLocal())
{
// It's a member function, which gets a special type record
const idx_t thisidx = fd.isStatic()
? dttab4[TYvoid]
: (ad.handleType() ? cv4_typidx(Type_toCtype(ad.handleType())) : 0);
assert(thisidx);
uint nparam;
const idx_t paramidx = cv4_arglist(t,&nparam);
const ubyte call = cv4_callconv(t);
switch (config.fulltypes)
{
case CV4:
{
debtyp_t* d = debtyp_alloc(18);
ubyte *p = &d.data[0];
TOWORD(p,LF_MFUNCTION);
TOWORD(p + 2,cv4_typidx(t.Tnext));
TOWORD(p + 4,cv4_typidx(Type_toCtype(ad.type)));
TOWORD(p + 6,thisidx);
p[8] = call;
p[9] = 0; // reserved
TOWORD(p + 10,nparam);
TOWORD(p + 12,paramidx);
TOLONG(p + 14,0); // thisadjust
return cv_debtyp(d);
}
case CV8:
{
debtyp_t* d = debtyp_alloc(26);
ubyte *p = &d.data[0];
TOWORD(p,0x1009);
TOLONG(p + 2,cv4_typidx(t.Tnext));
TOLONG(p + 6,cv4_typidx(Type_toCtype(ad.type)));
TOLONG(p + 10,thisidx);
p[14] = call;
p[15] = 0; // reserved
TOWORD(p + 16,nparam);
TOLONG(p + 18,paramidx);
TOLONG(p + 22,0); // thisadjust
return cv_debtyp(d);
}
default:
assert(0);
}
}
return cv4_typidx(t);
}
enum CV4_NAMELENMAX = 0x3b9f; // found by trial and error
enum CV8_NAMELENMAX = 0xffff; // length record is 16-bit only
uint cv4_Denum(EnumDeclaration e)
{
//dbg_printf("cv4_Denum(%s)\n", e.toChars());
const uint property = (!e.members || !e.memtype || !e.memtype.isintegral())
? 0x80 // enum is forward referenced or non-integer
: 0;
// Compute the number of fields, and the length of the fieldlist record
CvFieldList mc = CvFieldList(0, 0);
if (!property)
{
for (size_t i = 0; i < e.members.dim; i++)
{
if (EnumMember sf = (*e.members)[i].isEnumMember())
{
const value = sf.value().toInteger();
// store only member's simple name
uint len = 4 + cv4_numericbytes(cast(uint)value) + cv_stringbytes(sf.toChars());
len = cv_align(null, len);
mc.count(len);
}
}
}
const id = e.toPrettyChars();
uint len;
debtyp_t *d;
const uint memtype = e.memtype ? cv4_typidx(Type_toCtype(e.memtype)) : 0;
switch (config.fulltypes)
{
case CV8:
len = 14;
d = debtyp_alloc(len + cv_stringbytes(id));
TOWORD(d.data.ptr,LF_ENUM_V3);
TOLONG(d.data.ptr + 6,memtype);
TOWORD(d.data.ptr + 4,property);
len += cv_namestring(d.data.ptr + len,id);
break;
case CV4:
len = 10;
d = debtyp_alloc(len + cv_stringbytes(id));
TOWORD(d.data.ptr,LF_ENUM);
TOWORD(d.data.ptr + 4,memtype);
TOWORD(d.data.ptr + 8,property);
len += cv_namestring(d.data.ptr + len,id);
break;
default:
assert(0);
}
const length_save = d.length;
d.length = 0; // so cv_debtyp() will allocate new
const idx_t typidx = cv_debtyp(d);
d.length = length_save; // restore length
TOWORD(d.data.ptr + 2, mc.nfields);
uint fieldlist = 0;
if (!property) // if forward reference, then fieldlist is 0
{
// Generate fieldlist type record
mc.alloc();
// And fill it in
for (size_t i = 0; i < e.members.dim; i++)
{
if (EnumMember sf = (*e.members)[i].isEnumMember())
{
ubyte* p = mc.writePtr();
dinteger_t value = sf.value().toInteger();
TOWORD(p, (config.fulltypes == CV8) ? LF_ENUMERATE_V3 : LF_ENUMERATE);
uint attribute = 0;
TOWORD(p + 2, attribute);
cv4_storenumeric(p + 4,cast(uint)value);
uint j = 4 + cv4_numericbytes(cast(uint)value);
// store only member's simple name
j += cv_namestring(p + j, sf.toChars());
j = cv_align(p + j, j);
mc.written(j);
// If enum is not a member of a class, output enum members as constants
// if (!isclassmember(s))
// {
// cv4_outsym(sf);
// }
}
}
fieldlist = mc.debtyp();
}
if (config.fulltypes == CV8)
TOLONG(d.data.ptr + 10,fieldlist);
else
TOWORD(d.data.ptr + 6,fieldlist);
// cv4_outsym(s);
return typidx;
}
/*************************************
* Align and pad.
* Returns:
* aligned count
*/
uint cv_align(ubyte *p, uint n)
{
if (config.fulltypes == CV8)
{
if (p)
{
uint npad = -n & 3;
while (npad)
{
*p = cast(ubyte)(0xF0 + npad);
++p;
--npad;
}
}
n = (n + 3) & ~3;
}
return n;
}
/*************************************
* write a UDT record to the object file
* Params:
* id = name of user defined type
* typidx = type index
*/
void cv_udt(const char* id, uint typidx)
{
if (config.fulltypes == CV8)
cv8_udt(id, typidx);
else
{
const len = strlen(id);
ubyte *debsym = cast(ubyte *) alloca(39 + IDOHD + len);
// Output a 'user-defined type' for the tag name
TOWORD(debsym + 2,S_UDT);
TOIDX(debsym + 4,typidx);
uint length = 2 + 2 + cgcv.sz_idx;
length += cv_namestring(debsym + length,id);
TOWORD(debsym,length - 2);
assert(length <= 40 + len);
objmod.write_bytes(SegData[DEBSYM],length,debsym);
}
}
/* ==================================================================== */
/****************************
* Emit symbolic debug info in CV format.
*/
void toDebug(EnumDeclaration ed)
{
//printf("EnumDeclaration::toDebug('%s')\n", ed.toChars());
assert(config.fulltypes >= CV4);
// If it is a member, it is handled by cvMember()
if (!ed.isMember())
{
const id = ed.toPrettyChars(true);
const idx_t typidx = cv4_Denum(ed);
cv_udt(id, typidx);
}
}
/****************************
* Helper struct for field list records LF_FIELDLIST/LF_FIELDLIST_V2
*
* if the size exceeds the maximum length of a record, the last entry
* is an LF_INDEX entry with the type index pointing to the next field list record
*
* Processing is done in two phases:
*
* Phase 1: computing the size of the field list and distributing it over multiple records
* - construct CvFieldList with some precalculated field count/length
* - for each field, call count(length of field)
*
* Phase 2: write the actual data
* - call alloc() to allocate debtyp's
* - for each field,
* - call writePtr() to get a pointer into the current debtyp
* - fill memory with field data
* - call written(length of field)
* - call debtyp() to create type records and return the index of the first one
*/
struct CvFieldList
{
// one LF_FIELDLIST record
static struct FLChunk
{
uint length; // accumulated during "count" phase
debtyp_t *dt;
uint writepos; // write position in dt
}
uint nfields;
uint writeIndex;
Array!FLChunk fieldLists;
const uint fieldLenMax;
const uint fieldIndexLen;
const bool canSplitList;
this(uint fields, uint len)
{
canSplitList = config.fulltypes == CV8; // optlink bails out with LF_INDEX
fieldIndexLen = canSplitList ? (config.fulltypes == CV8 ? 2 + 2 + 4 : 2 + 2) : 0;
fieldLenMax = (config.fulltypes == CV8 ? CV8_NAMELENMAX : CV4_NAMELENMAX) - fieldIndexLen;
assert(len < fieldLenMax);
nfields = fields;
fieldLists.push(FLChunk(2 + len));
}
void count(uint n)
{
if (n)
{
nfields++;
assert(n < fieldLenMax);
if (fieldLists[$-1].length + n > fieldLenMax)
fieldLists.push(FLChunk(2 + n));
else
fieldLists[$-1].length += n;
}
}
void alloc()
{
foreach (i, ref fld; fieldLists)
{
fld.dt = debtyp_alloc(fld.length + (i < fieldLists.length - 1 ? fieldIndexLen : 0));
TOWORD(fld.dt.data.ptr, config.fulltypes == CV8 ? LF_FIELDLIST_V2 : LF_FIELDLIST);
fld.writepos = 2;
}
}
ubyte* writePtr()
{
assert(writeIndex < fieldLists.length);
auto fld = &fieldLists[writeIndex];
if (fld.writepos >= fld.length)
{
assert(fld.writepos == fld.length);
if (writeIndex < fieldLists.length - 1) // if false, all further attempts must not actually write any data
{
writeIndex++;
fld++;
}
}
return fld.dt.data.ptr + fld.writepos;
}
void written(uint n)
{
assert(fieldLists[writeIndex].writepos + n <= fieldLists[writeIndex].length);
fieldLists[writeIndex].writepos += n;
}
idx_t debtyp()
{
idx_t typidx;
auto numCreate = canSplitList ? fieldLists.length : 1;
for(auto i = numCreate; i > 0; --i)
{
auto fld = &fieldLists[i - 1];
if (typidx)
{
ubyte* p = fld.dt.data.ptr + fld.writepos;
if (config.fulltypes == CV8)
{
TOWORD (p, LF_INDEX_V2);
TOWORD (p + 2, 0); // padding
TOLONG (p + 4, typidx);
}
else
{
TOWORD (p, LF_INDEX);
TOWORD (p + 2, typidx);
}
}
typidx = cv_debtyp(fld.dt);
}
return typidx;
}
}
// Lambda function
int cv_mem_count(Dsymbol s, CvFieldList *pmc)
{
int nwritten = cvMember(s, null);
pmc.count(nwritten);
return 0;
}
// Lambda function
int cv_mem_p(Dsymbol s, CvFieldList *pmc)
{
ubyte *p = pmc.writePtr();
uint len = cvMember(s, p);
pmc.written(len);
return 0;
}
void toDebug(StructDeclaration sd)
{
idx_t typidx1 = 0;
//printf("StructDeclaration::toDebug('%s')\n", sd.toChars());
assert(config.fulltypes >= CV4);
if (sd.isAnonymous())
return /*0*/;
if (typidx1) // if reference already generated
return /*typidx1*/; // use already existing reference
targ_size_t size;
uint property = 0;
if (!sd.members)
{
size = 0;
property |= 0x80; // forward reference
}
else
size = sd.structsize;
if (sd.parent.isAggregateDeclaration()) // if class is nested
property |= 8;
// if (st.Sctor || st.Sdtor)
// property |= 2; // class has ctors and/or dtors
// if (st.Sopoverload)
// property |= 4; // class has overloaded operators
// if (st.Scastoverload)
// property |= 0x40; // class has casting methods
// if (st.Sopeq && !(st.Sopeq.Sfunc.Fflags & Fnodebug))
// property |= 0x20; // class has overloaded assignment
const char *id = sd.toPrettyChars(true);
uint leaf = sd.isUnionDeclaration() ? LF_UNION : LF_STRUCTURE;
if (config.fulltypes == CV8)
leaf = leaf == LF_UNION ? LF_UNION_V3 : LF_STRUCTURE_V3;
uint numidx;
final switch (leaf)
{
case LF_UNION: numidx = 8; break;
case LF_UNION_V3: numidx = 10; break;
case LF_STRUCTURE: numidx = 12; break;
case LF_STRUCTURE_V3: numidx = 18; break;
}
const len1 = numidx + cv4_numericbytes(cast(uint)size);
debtyp_t *d = debtyp_alloc(len1 + cv_stringbytes(id));
cv4_storenumeric(d.data.ptr + numidx, cast(uint)size);
cv_namestring(d.data.ptr + len1, id);
if (leaf == LF_STRUCTURE)
{
TOWORD(d.data.ptr + 8,0); // dList
TOWORD(d.data.ptr + 10,0); // vshape is 0 (no virtual functions)
}
else if (leaf == LF_STRUCTURE_V3)
{
TOLONG(d.data.ptr + 10,0); // dList
TOLONG(d.data.ptr + 14,0); // vshape is 0 (no virtual functions)
}
TOWORD(d.data.ptr,leaf);
// Assign a number to prevent infinite recursion if a struct member
// references the same struct.
const length_save = d.length;
d.length = 0; // so cv_debtyp() will allocate new
const idx_t typidx = cv_debtyp(d);
d.length = length_save; // restore length
if (!sd.members) // if reference only
{
if (config.fulltypes == CV8)
{
TOWORD(d.data.ptr + 2,0); // count: number of fields is 0
TOLONG(d.data.ptr + 6,0); // field list is 0
TOWORD(d.data.ptr + 4,property);
}
else
{
TOWORD(d.data.ptr + 2,0); // count: number of fields is 0
TOWORD(d.data.ptr + 4,0); // field list is 0
TOWORD(d.data.ptr + 6,property);
}
return /*typidx*/;
}
// Compute the number of fields and the length of the fieldlist record
CvFieldList mc = CvFieldList(0, 0);
for (size_t i = 0; i < sd.members.dim; i++)
{
Dsymbol s = (*sd.members)[i];
s.apply(&cv_mem_count, &mc);
}
const uint nfields = mc.nfields;
// Generate fieldlist type record
mc.alloc();
if (nfields)
{
for (size_t i = 0; i < sd.members.dim; i++)
{
Dsymbol s = (*sd.members)[i];
s.apply(&cv_mem_p, &mc);
}
}
//dbg_printf("fnamelen = %d, p-dt.data.ptr = %d\n",fnamelen,p-dt.data.ptr);
const idx_t fieldlist = mc.debtyp();
TOWORD(d.data.ptr + 2, nfields);
if (config.fulltypes == CV8)
{
TOWORD(d.data.ptr + 4,property);
TOLONG(d.data.ptr + 6,fieldlist);
}
else
{
TOWORD(d.data.ptr + 4,fieldlist);
TOWORD(d.data.ptr + 6,property);
}
// cv4_outsym(s);
cv_udt(id, typidx);
// return typidx;
}
void toDebug(ClassDeclaration cd)
{
idx_t typidx1 = 0;
//printf("ClassDeclaration::toDebug('%s')\n", cd.toChars());
assert(config.fulltypes >= CV4);
if (cd.isAnonymous())
return /*0*/;
if (typidx1) // if reference already generated
return /*typidx1*/; // use already existing reference
targ_size_t size;
uint property = 0;
if (!cd.members)
{
size = 0;
property |= 0x80; // forward reference
}
else
size = cd.structsize;
if (cd.parent.isAggregateDeclaration()) // if class is nested
property |= 8;
if (cd.ctor || cd.dtor)
property |= 2; // class has ctors and/or dtors
// if (st.Sopoverload)
// property |= 4; // class has overloaded operators
// if (st.Scastoverload)
// property |= 0x40; // class has casting methods
// if (st.Sopeq && !(st.Sopeq.Sfunc.Fflags & Fnodebug))
// property |= 0x20; // class has overloaded assignment
const id = cd.isCPPinterface() ? cd.ident.toChars() : cd.toPrettyChars(true);
const uint leaf = config.fulltypes == CV8 ? LF_CLASS_V3 : LF_CLASS;
const uint numidx = (leaf == LF_CLASS_V3) ? 18 : 12;
const uint len1 = numidx + cv4_numericbytes(cast(uint)size);
debtyp_t *d = debtyp_alloc(len1 + cv_stringbytes(id));
cv4_storenumeric(d.data.ptr + numidx, cast(uint)size);
cv_namestring(d.data.ptr + len1, id);
idx_t vshapeidx = 0;
if (1)
{
const size_t dim = cd.vtbl.dim; // number of virtual functions
if (dim)
{ // 4 bits per descriptor
debtyp_t *vshape = debtyp_alloc(cast(uint)(4 + (dim + 1) / 2));
TOWORD(vshape.data.ptr,LF_VTSHAPE);
TOWORD(vshape.data.ptr + 2, cast(uint)dim);
size_t n = 0;
ubyte descriptor = 0;
for (size_t i = 0; i < cd.vtbl.dim; i++)
{
//if (intsize == 4)
descriptor |= 5;
vshape.data.ptr[4 + n / 2] = descriptor;
descriptor <<= 4;
n++;
}
vshapeidx = cv_debtyp(vshape);
}
}
if (leaf == LF_CLASS)
{
TOWORD(d.data.ptr + 8,0); // dList
TOWORD(d.data.ptr + 10,vshapeidx);
}
else if (leaf == LF_CLASS_V3)
{
TOLONG(d.data.ptr + 10,0); // dList
TOLONG(d.data.ptr + 14,vshapeidx);
}
TOWORD(d.data.ptr,leaf);
// Assign a number to prevent infinite recursion if a struct member
// references the same struct.
const length_save = d.length;
d.length = 0; // so cv_debtyp() will allocate new
const idx_t typidx = cv_debtyp(d);
d.length = length_save; // restore length
if (!cd.members) // if reference only
{
if (leaf == LF_CLASS_V3)
{
TOWORD(d.data.ptr + 2,0); // count: number of fields is 0
TOLONG(d.data.ptr + 6,0); // field list is 0
TOWORD(d.data.ptr + 4,property);
}
else
{
TOWORD(d.data.ptr + 2,0); // count: number of fields is 0
TOWORD(d.data.ptr + 4,0); // field list is 0
TOWORD(d.data.ptr + 6,property);
}
return /*typidx*/;
}
// Compute the number of fields and the length of the fieldlist record
CvFieldList mc = CvFieldList(0, 0);
/* Adding in the base classes causes VS 2010 debugger to refuse to display any
* of the fields. I have not been able to determine why.
* (Could it be because the base class is "forward referenced"?)
* It does work with VS 2012.
*/
bool addInBaseClasses = true;
if (addInBaseClasses)
{
// Add in base classes
for (size_t i = 0; i < cd.baseclasses.dim; i++)
{
const bc = (*cd.baseclasses)[i];
const uint elementlen = 4 + cgcv.sz_idx + cv4_numericbytes(bc.offset);
mc.count(cv_align(null, elementlen));
}
}
for (size_t i = 0; i < cd.members.dim; i++)
{
Dsymbol s = (*cd.members)[i];
s.apply(&cv_mem_count, &mc);
}
const uint nfields = mc.nfields;
TOWORD(d.data.ptr + 2, nfields);
// Generate fieldlist type record
mc.alloc();
if (nfields) // if we didn't overflow
{
if (addInBaseClasses)
{
ubyte* base = mc.writePtr();
ubyte* p = base;
// Add in base classes
for (size_t i = 0; i < cd.baseclasses.dim; i++)
{
BaseClass *bc = (*cd.baseclasses)[i];
const idx_t typidx2 = cv4_typidx(Type_toCtype(bc.sym.type).Tnext);
const uint attribute = visibilityToCVAttr(Visibility.Kind.public_);
uint elementlen;
final switch (config.fulltypes)
{
case CV8:
TOWORD(p, LF_BCLASS_V2);
TOWORD(p + 2,attribute);
TOLONG(p + 4,typidx2);
elementlen = 8;
break;
case CV4:
TOWORD(p, LF_BCLASS);
TOWORD(p + 2,typidx2);
TOWORD(p + 4,attribute);
elementlen = 6;
break;
}
cv4_storenumeric(p + elementlen, bc.offset);
elementlen += cv4_numericbytes(bc.offset);
p += cv_align(p + elementlen, elementlen);
}
mc.written(cast(uint)(p - base));
}
for (size_t i = 0; i < cd.members.dim; i++)
{
Dsymbol s = (*cd.members)[i];
s.apply(&cv_mem_p, &mc);
}
}
const idx_t fieldlist = mc.debtyp();
if (config.fulltypes == CV8)
{
TOWORD(d.data.ptr + 4,property);
TOLONG(d.data.ptr + 6,fieldlist);
}
else
{
TOWORD(d.data.ptr + 4,fieldlist);
TOWORD(d.data.ptr + 6,property);
}
// cv4_outsym(s);
cv_udt(id, typidx);
// return typidx;
}
private uint writeField(ubyte* p, const char* id, uint attr, uint typidx, uint offset)
{
if (config.fulltypes == CV8)
{
TOWORD(p,LF_MEMBER_V3);
TOWORD(p + 2,attr);
TOLONG(p + 4,typidx);
cv4_storesignednumeric(p + 8, offset);
uint len = 8 + cv4_signednumericbytes(offset);
len += cv_namestring(p + len, id);
return cv_align(p + len, len);
}
else
{
TOWORD(p,LF_MEMBER);
TOWORD(p + 2,typidx);
TOWORD(p + 4,attr);
cv4_storesignednumeric(p + 6, offset);
uint len = 6 + cv4_signednumericbytes(offset);
return len + cv_namestring(p + len, id);
}
}
void toDebugClosure(Symbol* closstru)
{
//printf("toDebugClosure('%s')\n", fd.toChars());
assert(config.fulltypes >= CV4);
uint leaf = config.fulltypes == CV8 ? LF_STRUCTURE_V3 : LF_STRUCTURE;
uint numidx = leaf == LF_STRUCTURE ? 12 : 18;
uint structsize = cast(uint)(closstru.Sstruct.Sstructsize);
const char* closname = closstru.Sident.ptr;
const len1 = numidx + cv4_numericbytes(structsize);
debtyp_t *d = debtyp_alloc(len1 + cv_stringbytes(closname));
cv4_storenumeric(d.data.ptr + numidx, structsize);
cv_namestring(d.data.ptr + len1, closname);
if (leaf == LF_STRUCTURE)
{
TOWORD(d.data.ptr + 8,0); // dList
TOWORD(d.data.ptr + 10,0); // vshape is 0 (no virtual functions)
}
else // LF_STRUCTURE_V3
{
TOLONG(d.data.ptr + 10,0); // dList
TOLONG(d.data.ptr + 14,0); // vshape is 0 (no virtual functions)
}
TOWORD(d.data.ptr,leaf);
// Assign a number to prevent infinite recursion if a struct member
// references the same struct.
const length_save = d.length;
d.length = 0; // so cv_debtyp() will allocate new
const idx_t typidx = cv_debtyp(d);
d.length = length_save; // restore length
// Compute the number of fields (nfields), and the length of the fieldlist record (flistlen)
uint nfields = 0;
uint flistlen = 2;
for (auto sl = closstru.Sstruct.Sfldlst; sl; sl = list_next(sl))
{
Symbol *sf = list_symbol(sl);
uint thislen = (config.fulltypes == CV8 ? 8 : 6);
thislen += cv4_signednumericbytes(cast(uint)sf.Smemoff);
thislen += cv_stringbytes(sf.Sident.ptr);
thislen = cv_align(null, thislen);
if (config.fulltypes != CV8 && flistlen + thislen > CV4_NAMELENMAX)
break; // Too long, fail gracefully
flistlen += thislen;
nfields++;
}
// Generate fieldlist type record
debtyp_t *dt = debtyp_alloc(flistlen);
ubyte *p = dt.data.ptr;
// And fill it in
TOWORD(p, config.fulltypes == CV8 ? LF_FIELDLIST_V2 : LF_FIELDLIST);
uint flistoff = 2;
for (auto sl = closstru.Sstruct.Sfldlst; sl && flistoff < flistlen; sl = list_next(sl))
{
Symbol *sf = list_symbol(sl);
idx_t vtypidx = cv_typidx(sf.Stype);
flistoff += writeField(p + flistoff, sf.Sident.ptr, 3 /*public*/, vtypidx, cast(uint)sf.Smemoff);
}
//dbg_printf("fnamelen = %d, p-dt.data.ptr = %d\n",fnamelen,p-dt.data.ptr);
assert(flistoff == flistlen);
const idx_t fieldlist = cv_debtyp(dt);
uint property = 0;
TOWORD(d.data.ptr + 2, nfields);
if (config.fulltypes == CV8)
{
TOWORD(d.data.ptr + 4,property);
TOLONG(d.data.ptr + 6,fieldlist);
}
else
{
TOWORD(d.data.ptr + 4,fieldlist);
TOWORD(d.data.ptr + 6,property);
}
cv_udt(closname, typidx);
}
/* ===================================================================== */
/*****************************************
* Insert CV info into *p.
* Returns:
* number of bytes written, or that would be written if p==null
*/
int cvMember(Dsymbol s, ubyte *p)
{
extern (C++) class CVMember : Visitor
{
ubyte *p;
int result;
this(ubyte *p)
{
this.p = p;
result = 0;
}
alias visit = Visitor.visit;
override void visit(Dsymbol s)
{
}
void cvMemberCommon(Dsymbol s, const(char)* id, idx_t typidx)
{
if (!p)
result = cv_stringbytes(id);
switch (config.fulltypes)
{
case CV8:
if (!p)
{
result += 8;
result = cv_align(null, result);
}
else
{
TOWORD(p,LF_NESTTYPE_V3);
TOWORD(p + 2,0);
TOLONG(p + 4,typidx);
result = 8 + cv_namestring(p + 8, id);
result = cv_align(p + result, result);
}
break;
case CV4:
if (!p)
{
result += 4;
}
else
{
TOWORD(p,LF_NESTTYPE);
TOWORD(p + 2,typidx);
result = 4 + cv_namestring(p + 4, id);
}
break;
default:
assert(0);
}
debug
{
if (p)
{
int save = result;
p = null;
cvMemberCommon(s, id, typidx);
assert(result == save);
}
}
}
override void visit(EnumDeclaration ed)
{
//printf("EnumDeclaration.cvMember() '%s'\n", d.toChars());
cvMemberCommon(ed, ed.toChars(), cv4_Denum(ed));
}
override void visit(FuncDeclaration fd)
{
//printf("FuncDeclaration.cvMember() '%s'\n", fd.toChars());
if (!fd.type) // if not compiled in,
return; // skip it
if (!fd.type.nextOf()) // if not fully analyzed (e.g. auto return type)
return; // skip it
const id = fd.toChars();
if (!p)
{
result = 2 + 2 + cgcv.sz_idx + cv_stringbytes(id);
result = cv_align(null, result);
return;
}
else
{
int count = 0;
int mlen = 2;
{
if (fd.introducing)
mlen += 4;
mlen += cgcv.sz_idx * 2;
count++;
}
// Allocate and fill it in
debtyp_t *d = debtyp_alloc(mlen);
ubyte *q = d.data.ptr;
TOWORD(q,config.fulltypes == CV8 ? LF_METHODLIST_V2 : LF_METHODLIST);
q += 2;
// for (s = sf; s; s = s.Sfunc.Foversym)
{
uint attribute = visibilityToCVAttr(fd.visible().kind);
/* 0*4 vanilla method
* 1*4 virtual method
* 2*4 static method
* 3*4 friend method
* 4*4 introducing virtual method
* 5*4 pure virtual method
* 6*4 pure introducing virtual method
* 7*4 reserved
*/
if (fd.isStatic())
attribute |= 2*4;
else if (fd.isVirtual())
{
if (fd.introducing)
{
if (fd.isAbstract())
attribute |= 6*4;
else
attribute |= 4*4;
}
else
{
if (fd.isAbstract())
attribute |= 5*4;
else
attribute |= 1*4;
}
}
else
attribute |= 0*4;
TOIDX(q,attribute);
q += cgcv.sz_idx;
TOIDX(q, cv4_memfunctypidx(fd));
q += cgcv.sz_idx;
if (fd.introducing)
{
TOLONG(q, fd.vtblIndex * target.ptrsize);
q += 4;
}
}
assert(q - d.data.ptr == mlen);
idx_t typidx = cv_debtyp(d);
if (typidx)
{
switch (config.fulltypes)
{
case CV8:
TOWORD(p,LF_METHOD_V3);
goto Lmethod;
case CV4:
TOWORD(p,LF_METHOD);
Lmethod:
TOWORD(p + 2,count);
result = 4;
TOIDX(p + result, typidx);
result += cgcv.sz_idx;
result += cv_namestring(p + result, id);
break;
default:
assert(0);
}
}
result = cv_align(p + result, result);
debug
{
int save = result;
result = 0;
p = null;
visit(fd);
assert(result == save);
}
}
}
override void visit(VarDeclaration vd)
{
//printf("VarDeclaration.cvMember(p = %p) '%s'\n", p, vd.toChars());
if (vd.type.toBasetype().ty == Ttuple)
return;
const id = vd.toChars();
if (!p)
{
if (vd.isField())
{
if (config.fulltypes == CV8)
result += 2;
result += 6 + cv_stringbytes(id);
result += cv4_numericbytes(vd.offset);
}
else if (vd.isStatic())
{
if (config.fulltypes == CV8)
result += 2;
result += 6 + cv_stringbytes(id);
}
result = cv_align(null, result);
}
else
{
idx_t typidx = cv_typidx(Type_toCtype(vd.type));
uint attribute = visibilityToCVAttr(vd.visible().kind);
assert((attribute & ~3) == 0);
switch (config.fulltypes)
{
case CV8:
if (vd.isField())
{
TOWORD(p,LF_MEMBER_V3);
TOWORD(p + 2,attribute);
TOLONG(p + 4,typidx);
cv4_storenumeric(p + 8, vd.offset);
result = 8 + cv4_numericbytes(vd.offset);
result += cv_namestring(p + result, id);
}
else if (vd.isStatic())
{
TOWORD(p,LF_STMEMBER_V3);
TOWORD(p + 2,attribute);
TOLONG(p + 4,typidx);
result = 8;
result += cv_namestring(p + result, id);
}
break;
case CV4:
if (vd.isField())
{
TOWORD(p,LF_MEMBER);
TOWORD(p + 2,typidx);
TOWORD(p + 4,attribute);
cv4_storenumeric(p + 6, vd.offset);
result = 6 + cv4_numericbytes(vd.offset);
result += cv_namestring(p + result, id);
}
else if (vd.isStatic())
{
TOWORD(p,LF_STMEMBER);
TOWORD(p + 2,typidx);
TOWORD(p + 4,attribute);
result = 6;
result += cv_namestring(p + result, id);
}
break;
default:
assert(0);
}
result = cv_align(p + result, result);
debug
{
int save = result;
result = 0;
p = null;
visit(vd);
assert(result == save);
}
}
}
}
scope v = new CVMember(p);
s.accept(v);
return v.result;
}
}
else
{
import dmd.denum;
import dmd.dstruct;
import dmd.dclass;
import dmd.backend.cc;
/****************************
* Stub them out.
*/
extern (C++) void toDebug(EnumDeclaration ed)
{
//printf("EnumDeclaration::toDebug('%s')\n", ed.toChars());
}
extern (C++) void toDebug(StructDeclaration sd)
{
}
extern (C++) void toDebug(ClassDeclaration cd)
{
}
extern (C++) void toDebugClosure(Symbol* closstru)
{
}
}
|
D
|
/**
Generator for VisualD project files
Copyright: © 2012 Matthias Dondorff
License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file.
Authors: Matthias Dondorff
*/
module dub.generators.visuald;
import dub.compilers.compiler;
import dub.generators.generator;
import dub.internal.vibecompat.core.file;
import dub.internal.vibecompat.core.log;
import dub.package_;
import dub.packagemanager;
import dub.project;
import dub.utils;
import std.algorithm;
import std.array;
import std.conv;
import std.format;
import std.uuid;
import std.exception;
// Dubbing is developing dub...
//version = DUBBING;
// TODO: handle pre/post build commands
class VisualDGenerator : ProjectGenerator {
private {
Project m_app;
PackageManager m_pkgMgr;
string[string] m_projectUuids;
bool m_combinedProject;
}
this(Project app, PackageManager mgr, bool combined_project)
{
m_combinedProject = combined_project;
m_app = app;
m_pkgMgr = mgr;
}
void generateProject(GeneratorSettings settings)
{
auto buildsettings = settings.buildSettings;
m_app.addBuildSettings(buildsettings, settings.platform, settings.config);
prepareGeneration(buildsettings);
logDebug("About to generate projects for %s, with %s direct dependencies.", m_app.mainPackage().name, m_app.mainPackage().dependencies().length);
generateProjects(m_app.mainPackage(), settings);
generateSolution(settings);
logInfo("VisualD project generated.");
finalizeGeneration(buildsettings, true);
}
private {
void generateSolution(GeneratorSettings settings)
{
auto ret = appender!(char[])();
auto configs = m_app.getPackageConfigs(settings.platform, settings.config);
// Solution header
ret.formattedWrite("
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010");
generateSolutionEntry(ret, m_app.mainPackage, settings);
if (!m_combinedProject) {
performOnDependencies(m_app.mainPackage, configs, (pack){
generateSolutionEntry(ret, pack, settings);
});
}
// Global section contains configurations
ret.formattedWrite("
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
Unittest|Win32 = Unittest|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution");
generateSolutionConfig(ret, m_app.mainPackage());
// TODO: for all dependencies
ret.formattedWrite("
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal");
// Writing solution file
logDebug("About to write to .sln file with %s bytes", to!string(ret.data().length));
auto sln = openFile(solutionFileName(), FileMode.CreateTrunc);
scope(exit) sln.close();
sln.put(ret.data());
sln.flush();
}
void generateSolutionEntry(Appender!(char[]) ret, const Package pack, GeneratorSettings settings)
{
auto projUuid = generateUUID();
auto projName = pack.name;
auto projPath = projFileName(pack);
auto projectUuid = guid(projName);
// Write project header, like so
// Project("{002A2DE9-8BB6-484D-9802-7E4AD4084715}") = "derelict", "..\inbase\source\derelict.visualdproj", "{905EF5DA-649E-45F9-9C15-6630AA815ACB}"
ret.formattedWrite("\nProject(\"%s\") = \"%s\", \"%s\", \"%s\"",
projUuid, projName, projPath, projectUuid);
if (!m_combinedProject) {
void addDepsRec(in Package p)
{
foreach(id, dependency; p.dependencies) {
auto deppack = m_app.getDependency(id, true);
if (!deppack) continue;
if (isHeaderOnlyPackage(deppack, settings)) {
addDepsRec(deppack);
} else if (!m_app.isRedundantDependency(p, deppack)) {
// TODO: clarify what "uuid = uuid" should mean
auto uuid = guid(id);
ret.formattedWrite("\n %s = %s", uuid, uuid);
}
}
}
if(pack.dependencies.length > 0) {
ret.formattedWrite("
ProjectSection(ProjectDependencies) = postProject");
addDepsRec(pack);
ret.formattedWrite("
EndProjectSection");
}
}
ret.formattedWrite("\nEndProject");
}
void generateSolutionConfig(Appender!(char[]) ret, const Package pack) {
const string[] sub = [ "ActiveCfg", "Build.0" ];
const string[] conf = [ "Debug|Win32", "Release|Win32" /*, "Unittest|Win32" */];
auto projectUuid = guid(pack.name());
foreach(c; conf)
foreach(s; sub)
formattedWrite(ret, "\n\t\t%s.%s.%s = %s", to!string(projectUuid), c, s, c);
}
void generateProjects(const Package main, GeneratorSettings settings) {
// TODO: cyclic check
auto configs = m_app.getPackageConfigs(settings.platform, settings.config);
generateProj(main, settings);
if (!m_combinedProject) {
bool[string] generatedProjects;
generatedProjects[main.name] = true;
performOnDependencies(main, configs, (const Package dependency) {
if(dependency.name in generatedProjects)
return;
generateProj(dependency, settings);
} );
}
}
bool isHeaderOnlyPackage(in Package pack, in GeneratorSettings settings)
const {
auto configs = m_app.getPackageConfigs(settings.platform, settings.config);
auto pbuildsettings = pack.getBuildSettings(settings.platform, configs[pack.name]);
if (!pbuildsettings.sourceFiles.any!(f => f.endsWith(".d"))())
return true;
return false;
}
void generateProj(const Package pack, GeneratorSettings settings)
{
int i = 0;
auto ret = appender!(char[])();
auto projName = pack.name;
auto project_file_dir = m_app.mainPackage.path ~ projFileName(pack).parentPath;
ret.put("<DProject>\n");
ret.formattedWrite(" <ProjectGuid>%s</ProjectGuid>\n", guid(projName));
// Several configurations (debug, release, unittest)
generateProjectConfiguration(ret, pack, "debug", settings);
generateProjectConfiguration(ret, pack, "release", settings);
generateProjectConfiguration(ret, pack, "unittest", settings);
// Add all files
auto configs = m_app.getPackageConfigs(settings.platform, settings.config);
auto files = pack.getBuildSettings(settings.platform, configs[pack.name]);
bool[SourceFile] sourceFiles;
if (m_combinedProject) {
// add all package.json files to the project
performOnDependencies(pack, configs, (prj) {
files.sourceFiles ~= prj.packageInfoFile.toNativeString();
auto pfiles = prj.getBuildSettings(settings.platform, configs[prj.name]);
files.sourceFiles ~= pfiles.sourceFiles.map!(f => (prj.path ~ f).toNativeString()).array;
});
foreach(s; files.sourceFiles){
auto sp = Path(s);
if( !sp.absolute ) sp = m_app.mainPackage.path ~ sp;
SourceFile sf;
sf.pkg = pack.name;
sf.filePath = sp.relativeTo(project_file_dir);
sf.structurePath = Path(getPackageFileName(pack)) ~ sp.relativeTo(pack.path);
sourceFiles[sf] = true;
}
} else {
files.sourceFiles ~= pack.packageInfoFile.toNativeString();
foreach(s; files.sourceFiles){
auto sp = Path(s);
if( !sp.absolute ) sp = pack.path ~ sp;
SourceFile sf;
sf.pkg = pack.name;
sf.filePath = sp.relativeTo(project_file_dir);
sf.structurePath = sp.relativeTo(pack.path);
sourceFiles[sf] = true;
}
}
// Create folders and files
ret.formattedWrite(" <Folder name=\"%s\">", getPackageFileName(pack));
Path lastFolder;
foreach(source; sortedSources(sourceFiles.keys)) {
logDebug("source looking at %s", source.structurePath);
auto cur = source.structurePath[0 .. source.structurePath.length-1];
if(lastFolder != cur) {
size_t same = 0;
foreach(idx; 0..min(lastFolder.length, cur.length))
if(lastFolder[idx] != cur[idx]) break;
else same = idx+1;
const decrease = lastFolder.length - min(lastFolder.length, same);
const increase = cur.length - min(cur.length, same);
foreach(unused; 0..decrease)
ret.put("\n </Folder>");
foreach(idx; 0..increase)
ret.formattedWrite("\n <Folder name=\"%s\">", cur[same + idx].toString());
lastFolder = cur;
}
ret.formattedWrite("\n <File path=\"%s\" />", source.filePath.toNativeString());
}
// Finalize all open folders
foreach(unused; 0..lastFolder.length)
ret.put("\n </Folder>");
ret.put("\n </Folder>\n</DProject>");
logDebug("About to write to '%s.visualdproj' file %s bytes", getPackageFileName(pack), ret.data().length);
auto proj = openFile(projFileName(pack), FileMode.CreateTrunc);
scope(exit) proj.close();
proj.put(ret.data());
proj.flush();
}
void generateProjectConfiguration(Appender!(char[]) ret, const Package pack, string type, GeneratorSettings settings)
{
auto project_file_dir = m_app.mainPackage.path ~ projFileName(pack).parentPath;
auto configs = m_app.getPackageConfigs(settings.platform, settings.config);
auto buildsettings = settings.buildSettings;
auto pbuildsettings = pack.getBuildSettings(settings.platform, configs[pack.name]);
m_app.addBuildSettings(buildsettings, settings.platform, settings.config, pack);
m_app.addBuildTypeSettings(buildsettings, settings.platform, type);
settings.compiler.extractBuildOptions(buildsettings);
string[] getSettings(string setting)(){ return __traits(getMember, buildsettings, setting); }
string[] getPathSettings(string setting)()
{
auto settings = getSettings!setting();
auto ret = new string[settings.length];
foreach (i; 0 .. settings.length) ret[i] = (Path(settings[i]).relativeTo(project_file_dir)).toNativeString();
return ret;
}
foreach(architecture; settings.platform.architecture) {
string arch;
switch(architecture) {
default: logWarn("Unsupported platform('%s'), defaulting to x86", architecture); goto case;
case "x86": arch = "Win32"; break;
case "x86_64": arch = "x64"; break;
}
ret.formattedWrite(" <Config name=\"%s\" platform=\"%s\">\n", to!string(type), arch);
// FIXME: handle compiler options in an abstract way instead of searching for DMD specific flags
// debug and optimize setting
ret.formattedWrite(" <symdebug>%s</symdebug>\n", buildsettings.options & BuildOptions.debugInfo ? "1" : "0");
ret.formattedWrite(" <optimize>%s</optimize>\n", buildsettings.options & BuildOptions.optimize ? "1" : "0");
ret.formattedWrite(" <useInline>%s</useInline>\n", buildsettings.options & BuildOptions.inline ? "1" : "0");
ret.formattedWrite(" <release>%s</release>\n", buildsettings.options & BuildOptions.release ? "1" : "0");
// Lib or exe?
bool is_lib = pbuildsettings.targetType != TargetType.executable;
string debugSuffix = type == "debug" ? "_d" : "";
auto bin_path = pack is m_app.mainPackage ? Path(pbuildsettings.targetPath) : Path(".dub/lib/");
bin_path.endsWithSlash = true;
ret.formattedWrite(" <lib>%s</lib>\n", is_lib ? "1" : "0");
ret.formattedWrite(" <exefile>%s%s%s.%s</exefile>\n", bin_path.toNativeString(), pbuildsettings.targetName, debugSuffix, is_lib ? "lib" : "exe");
// include paths and string imports
string imports = join(getPathSettings!"importPaths"(), " ");
string stringImports = join(getPathSettings!"stringImportPaths"(), " ");
ret.formattedWrite(" <imppath>%s</imppath>\n", imports);
ret.formattedWrite(" <fileImppath>%s</fileImppath>\n", stringImports);
ret.formattedWrite(" <program>%s</program>\n", "$(DMDInstallDir)windows\\bin\\dmd.exe"); // FIXME: use the actually selected compiler!
ret.formattedWrite(" <additionalOptions>%s</additionalOptions>\n", getSettings!"dflags"().join(" "));
// Add version identifiers
string versions = join(getSettings!"versions"(), " ");
ret.formattedWrite(" <versionids>%s</versionids>\n", versions);
// Add libraries, system libs need to be suffixed by ".lib".
string linkLibs = join(map!(a => a~".lib")(getSettings!"libs"()), " ");
string addLinkFiles = join(getSettings!"sourceFiles"().filter!(s => s.endsWith(".lib"))(), " ");
if (!is_lib) ret.formattedWrite(" <libfiles>%s %s phobos.lib</libfiles>\n", linkLibs, addLinkFiles);
// Unittests
ret.formattedWrite(" <useUnitTests>%s</useUnitTests>\n", buildsettings.options & BuildOptions.unittests ? "1" : "0");
// compute directory for intermediate files (need dummy/ because of how -op determines the resulting path)
auto relpackpath = pack.path.relativeTo(project_file_dir);
uint ndummy = 0;
foreach (i; 0 .. relpackpath.length)
if (relpackpath[i] == "..") ndummy++;
string intersubdir = (ndummy*2 > relpackpath.length ? replicate("dummy/", ndummy*2-relpackpath.length) : "") ~ getPackageFileName(pack);
ret.put(" <obj>0</obj>\n");
ret.put(" <link>0</link>\n");
ret.put(" <subsystem>0</subsystem>\n");
ret.put(" <multiobj>0</multiobj>\n");
ret.put(" <singleFileCompilation>2</singleFileCompilation>\n");
ret.put(" <oneobj>0</oneobj>\n");
ret.put(" <trace>0</trace>\n");
ret.put(" <quiet>0</quiet>\n");
ret.formattedWrite(" <verbose>%s</verbose>\n", buildsettings.options & BuildOptions.verbose ? "1" : "0");
ret.put(" <vtls>0</vtls>\n");
ret.put(" <cpu>0</cpu>\n");
ret.formattedWrite(" <isX86_64>%s</isX86_64>\n", arch == "x64" ? 1 : 0);
ret.put(" <isLinux>0</isLinux>\n");
ret.put(" <isOSX>0</isOSX>\n");
ret.put(" <isWindows>0</isWindows>\n");
ret.put(" <isFreeBSD>0</isFreeBSD>\n");
ret.put(" <isSolaris>0</isSolaris>\n");
ret.put(" <scheduler>0</scheduler>\n");
ret.put(" <useDeprecated>0</useDeprecated>\n");
ret.put(" <useAssert>0</useAssert>\n");
ret.put(" <useInvariants>0</useInvariants>\n");
ret.put(" <useIn>0</useIn>\n");
ret.put(" <useOut>0</useOut>\n");
ret.put(" <useArrayBounds>0</useArrayBounds>\n");
ret.formattedWrite(" <noboundscheck>%s</noboundscheck>\n", buildsettings.options & BuildOptions.noBoundsChecks ? "1" : "0");
ret.put(" <useSwitchError>0</useSwitchError>\n");
ret.put(" <preservePaths>1</preservePaths>\n");
ret.formattedWrite(" <warnings>%s</warnings>\n", buildsettings.options & BuildOptions.warningsAsErrors ? "1" : "0");
ret.formattedWrite(" <infowarnings>%s</infowarnings>\n", buildsettings.options & BuildOptions.warnings ? "1" : "0");
ret.formattedWrite(" <checkProperty>%s</checkProperty>\n", buildsettings.options & BuildOptions.property ? "1" : "0");
ret.formattedWrite(" <genStackFrame>%s</genStackFrame>\n", buildsettings.options & BuildOptions.alwaysStackFrame ? "1" : "0");
ret.put(" <pic>0</pic>\n");
ret.formattedWrite(" <cov>%s</cov>\n", buildsettings.options & BuildOptions.coverage ? "1" : "0");
ret.put(" <nofloat>0</nofloat>\n");
ret.put(" <Dversion>2</Dversion>\n");
ret.formattedWrite(" <ignoreUnsupportedPragmas>%s</ignoreUnsupportedPragmas>\n", buildsettings.options & BuildOptions.ignoreUnknownPragmas ? "1" : "0");
ret.formattedWrite(" <compiler>%s</compiler>\n", settings.compiler.name == "ldc" ? 2 : settings.compiler.name == "gdc" ? 1 : 0);
ret.formattedWrite(" <otherDMD>0</otherDMD>\n");
ret.formattedWrite(" <outdir>%s</outdir>\n", bin_path.toNativeString());
ret.formattedWrite(" <objdir>.dub/obj/%s/%s</objdir>\n", to!string(type), intersubdir);
ret.put(" <objname />\n");
ret.put(" <libname />\n");
ret.put(" <doDocComments>0</doDocComments>\n");
ret.put(" <docdir />\n");
ret.put(" <docname />\n");
ret.put(" <modules_ddoc />\n");
ret.put(" <ddocfiles />\n");
ret.put(" <doHdrGeneration>0</doHdrGeneration>\n");
ret.put(" <hdrdir />\n");
ret.put(" <hdrname />\n");
ret.put(" <doXGeneration>1</doXGeneration>\n");
ret.put(" <xfilename>$(IntDir)\\$(TargetName).json</xfilename>\n");
ret.put(" <debuglevel>0</debuglevel>\n");
ret.put(" <versionlevel>0</versionlevel>\n");
ret.put(" <debugids />\n");
ret.put(" <dump_source>0</dump_source>\n");
ret.put(" <mapverbosity>0</mapverbosity>\n");
ret.put(" <createImplib>0</createImplib>\n");
ret.put(" <defaultlibname />\n");
ret.put(" <debuglibname />\n");
ret.put(" <moduleDepsFile />\n");
ret.put(" <run>0</run>\n");
ret.put(" <runargs />\n");
ret.put(" <runCv2pdb>1</runCv2pdb>\n");
ret.put(" <pathCv2pdb>$(VisualDInstallDir)cv2pdb\\cv2pdb.exe</pathCv2pdb>\n");
ret.put(" <cv2pdbPre2043>0</cv2pdbPre2043>\n");
ret.put(" <cv2pdbNoDemangle>0</cv2pdbNoDemangle>\n");
ret.put(" <cv2pdbEnumType>0</cv2pdbEnumType>\n");
ret.put(" <cv2pdbOptions />\n");
ret.put(" <objfiles />\n");
ret.put(" <linkswitches />\n");
ret.put(" <libpaths />\n");
ret.put(" <deffile />\n");
ret.put(" <resfile />\n");
ret.put(" <preBuildCommand />\n");
ret.put(" <postBuildCommand />\n");
ret.put(" <filesToClean>*.obj;*.cmd;*.build;*.dep</filesToClean>\n");
ret.put(" </Config>\n");
} // foreach(architecture)
}
void performOnDependencies(const Package main, string[string] configs, void delegate(const Package pack) op)
{
foreach (p; m_app.getTopologicalPackageList(false, main, configs)) {
if (p is main) continue;
op(p);
}
}
string generateUUID() const {
return "{" ~ randomUUID().toString() ~ "}";
}
string guid(string projectName) {
if(projectName !in m_projectUuids)
m_projectUuids[projectName] = generateUUID();
return m_projectUuids[projectName];
}
auto solutionFileName() const {
version(DUBBING) return getPackageFileName(m_app.mainPackage()) ~ ".dubbed.sln";
else return getPackageFileName(m_app.mainPackage()) ~ ".sln";
}
Path projFileName(ref const Package pack) const {
auto basepath = Path(".");//Path(".dub/");
version(DUBBING) return basepath ~ (getPackageFileName(pack) ~ ".dubbed.visualdproj");
else return basepath ~ (getPackageFileName(pack) ~ ".visualdproj");
}
}
// TODO: nice folders
struct SourceFile {
string pkg;
Path structurePath;
Path filePath;
bool build = true;
int opCmp(ref const SourceFile rhs) const { return sortOrder(this, rhs); }
// "a < b" for folder structures (deepest folder first, else lexical)
private final static int sortOrder(ref const SourceFile a, ref const SourceFile b) {
enforce(!a.structurePath.empty());
enforce(!b.structurePath.empty());
auto as = a.structurePath;
auto bs = b.structurePath;
// Check for different folders, compare folders only (omit last one).
for(uint idx=0; idx<min(as.length-1, bs.length-1); ++idx)
if(as[idx] != bs[idx])
return as[idx].opCmp(bs[idx]);
if(as.length != bs.length) {
// If length differ, the longer one is "smaller", that is more
// specialized and will be put out first.
return as.length > bs.length? -1 : 1;
}
else {
// Both paths indicate files in the same directory, use lexical
// ordering for those.
return as.head.opCmp(bs.head);
}
}
}
auto sortedSources(SourceFile[] sources) {
return sort(sources);
}
unittest {
SourceFile[] sfs = [
{ "", Path("b/file.d"), Path("") },
{ "", Path("b/b/fileA.d"), Path("") },
{ "", Path("a/file.d"), Path("") },
{ "", Path("b/b/fileB.d"), Path("") },
{ "", Path("b/b/b/fileA.d"), Path("") },
{ "", Path("b/c/fileA.d"), Path("") },
];
auto sorted = sort(sfs);
SourceFile[] sortedSfs;
foreach(sr; sorted)
sortedSfs ~= sr;
assert(sortedSfs[0].structurePath == Path("a/file.d"), "1");
assert(sortedSfs[1].structurePath == Path("b/b/b/fileA.d"), "2");
assert(sortedSfs[2].structurePath == Path("b/b/fileA.d"), "3");
assert(sortedSfs[3].structurePath == Path("b/b/fileB.d"), "4");
assert(sortedSfs[4].structurePath == Path("b/c/fileA.d"), "5");
assert(sortedSfs[5].structurePath == Path("b/file.d"), "6");
}
}
private string getPackageFileName(in Package pack)
{
return pack.name.replace(":", "_");
}
|
D
|
module provision;
public import provision.adi;
|
D
|
/Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/CloudEnvironment.build/RedisCredentials.swift.o : /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/Credentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/DB2Credentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/MongoDBCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/AppIDCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/PushSDKCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/PostgreSQLCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/MySQLCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/HDBaaSCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/ObjectStorageCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/NaturalLanguageUnderstandingCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/AutoScalingCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/AlertNotificationCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/RedisCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/CloudFunctionsCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/CloudantCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/WatsonAssistantCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/WeatherDataCompanyCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/CloudEnv.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/LoggerAPI.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 /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/Configuration.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 /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/FileKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/CloudFoundryEnv.swiftmodule /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/agentcore.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/hcapiplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/memplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/mqttplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/cpuplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/envplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/paho.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/CHTTPParser.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/CloudEnvironment.build/RedisCredentials~partial.swiftmodule : /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/Credentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/DB2Credentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/MongoDBCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/AppIDCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/PushSDKCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/PostgreSQLCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/MySQLCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/HDBaaSCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/ObjectStorageCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/NaturalLanguageUnderstandingCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/AutoScalingCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/AlertNotificationCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/RedisCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/CloudFunctionsCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/CloudantCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/WatsonAssistantCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/WeatherDataCompanyCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/CloudEnv.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/LoggerAPI.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 /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/Configuration.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 /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/FileKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/CloudFoundryEnv.swiftmodule /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/agentcore.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/hcapiplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/memplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/mqttplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/cpuplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/envplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/paho.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/CHTTPParser.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/CloudEnvironment.build/RedisCredentials~partial.swiftdoc : /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/Credentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/DB2Credentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/MongoDBCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/AppIDCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/PushSDKCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/PostgreSQLCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/MySQLCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/HDBaaSCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/ObjectStorageCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/NaturalLanguageUnderstandingCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/AutoScalingCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/AlertNotificationCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/RedisCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/CloudFunctionsCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/CloudantCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/WatsonAssistantCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/WeatherDataCompanyCredentials.swift /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/checkouts/CloudEnvironment.git-1442162862887765372/Sources/CloudEnvironment/CloudEnv.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/LoggerAPI.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 /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/Configuration.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 /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/FileKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/CloudFoundryEnv.swiftmodule /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/agentcore.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/hcapiplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/memplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/mqttplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/cpuplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/envplugin.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/paho.build/module.modulemap /Users/patbutler/Developer/Server/Kitura/EmojiJournalServer/.build/x86_64-apple-macosx/debug/CHTTPParser.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
INT32: int32_11,int32_10,int32_20,int32_22,int32_33,int32_7,int32_1,int32_0,int32_2,int32_9,int32_8,int32_44.
MAC: str_c6_d6_e0_a2_ee_cd,str_f8_ff_ff_cc_dd_ee,str_C4_F6_E0_12_DB_DB,str_cc_bb_bb_bb_cc_cc,str_d6_c6_b0_a2_ee_cd,str_a7_3a_27_90_b4_02,str_ee_ee_ee_ff_ff_ff,str_C6_F6_E0_12_DB_DB,str_ee_bb_ee_ff_ff_ff,str_C8_F8_E0_12_DB_DB,str_f6_ff_ff_cc_dd_ee,str_ff_ff_ff_cc_dd_ee,str_f9_3a_41_63_b1_04,str_ee_ee_ee_ee_ff_ff,str_ff_ee_cc_dd_ee_ff,str_C8_F6_E0_12_DB_DB,str_ff_ff_ff_ff_ff_ff,str_c6_f6_e0_12_db_db,str_ee_bb_ee_ee_ff_ff,str_C7_F7_E0_12_DB_DB,str_d7_c7_b0_a2_ee_cd,str_aa_bb_cc_dd_ee_ff,str_c7_d7_e0_a2_ee_cd,str_aa_aa_bb_bb_cc_cc,str_C7_F6_E0_12_DB_DB,str_f7_ff_ff_cc_dd_ee,str_f8_3a_41_63_b1_04.
LIST: list_[str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_aa_bb_cc_dd_ee_ff],list_[ipv4_10.1.1.7-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.6-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_ff_ff_ff_ff_ff_ff],list_[ipv4_srcip03-ipv4_dstip03-str_BYQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_77.1.1.5-str_ff_ff_ff_cc_dd_ee],list_[str_BZQ-int32_1-ipv4_88.1.1.4-str_C8_F6_E0_12_DB_DB-ipv4_88.1.1.5-str_ff_ff_ff_cc_dd_ee],list_[ipv4_10.1.1.8-ipv4_10.1.1.7-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ee_cc_dd_ee_ff],list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_ff_ff_ff_ff_ff_ff],list_[ipv4_srcip01-ipv4_dstip01-str_ARP-int32_2-ipv4_99.1.1.4-str_C4_F6_E0_12_DB_DB-ipv4_distip01-str_ff_ff_ff_cc_dd_ee],list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip05-str_ff_ff_ff_ff_ff_ff],list_[str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ff_ff_ff_ff_ff],list_[ipv4_srcip04-ipv4_dstip04-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip04-str_ff_ff_ff_ff_ff_ff],list_[str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_cc_bb_bb_bb_cc_cc],list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.6-ipv4_10.1.1.5-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.9-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.7-ipv4_10.1.1.8-str_ARP-int32_2-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04],list_[str_ARP-int32_1-ipv4_10.1.1.6-str_d6_c6_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ff_ff_ff],list_[str_ARP-int32_2-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04],list_[ipv4_10.1.1.8-ipv4_10.1.1.7-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_aa_bb_cc_dd_ee_ff],list_[str_ARP-int32_2-ipv4_99.1.1.4-str_C4_F6_E0_12_DB_DB-ipv4_distip01-str_ff_ff_ff_cc_dd_ee],list_[ipv4_10.1.1.6-ipv4_dstip07-str_ARP-int32_1-ipv4_10.1.1.6-str_d7_c7_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ee_ff_ff],list_[ipv4_srcip04-ipv4_dstip05-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip05-str_ff_ff_ff_ff_ff_ff],list_[str_ARP-int32_1-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.7-ipv4_dstip06-str_ARP-int32_1-ipv4_10.1.1.7-str_c6_d6_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ff_ff_ff],list_[str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.8-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ff_ff_ff_ff_ff],list_[str_ARP-int32_1-ipv4_10.1.1.7-str_c6_d6_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ff_ff_ff],list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip04-str_ff_ff_ff_ff_ff_ff],list_[str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ee_cc_dd_ee_ff],list_[str_ARP-int32_1-ipv4_10.1.1.7-str_c7_d7_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ee_ff_ff],list_[str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_aa_aa_bb_bb_cc_cc],list_[str_ARP-int32_1-ipv4_88.8.1.4-str_C8_F8_E0_12_DB_DB-ipv4_88.1.1.5-str_f8_ff_ff_cc_dd_ee],list_[ipv4_10.1.1.9-ipv4_10.1.1.6-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_cc_bb_bb_bb_cc_cc],list_[str_ARP-int32_2-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04],list_[ipv4_10.1.1.6-ipv4_dstip06-str_ARP-int32_1-ipv4_10.1.1.6-str_d6_c6_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ff_ff_ff],list_[str_ARP-int32_1-ipv4_66.1.1.4-str_C6_F6_E0_12_DB_DB-ipv4_66.1.1.5-str_f6_ff_ff_cc_dd_ee],list_[ipv4_10.1.1.9-ipv4_10.1.1.6-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_aa_aa_bb_bb_cc_cc],list_[ipv4_srcip02-ipv4_dstip02-str_BXQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_99.1.1.5-str_ff_ff_ff_cc_dd_ee],list_[str_ARP-int32_1-ipv4_10.1.1.6-str_d7_c7_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ee_ff_ff],list_[str_BYQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_77.1.1.5-str_ff_ff_ff_cc_dd_ee],list_[str_BXQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_99.1.1.5-str_ff_ff_ff_cc_dd_ee],list_[ipv4_10.1.1.7-ipv4_dstip07-str_ARP-int32_1-ipv4_10.1.1.7-str_c7_d7_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ee_ff_ff],list_[ipv4_srcip00-ipv4_dstip00-str_BZQ-int32_1-ipv4_88.1.1.4-str_C8_F6_E0_12_DB_DB-ipv4_88.1.1.5-str_ff_ff_ff_cc_dd_ee],list_[ipv4_10.1.1.6-ipv4_10.1.1.9-str_ARP-int32_2-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04],list_[ipv4_55.1.1.6-ipv4_10.1.1.5-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff],list_[str_BTQ-int32_9-ipv4_99.1.1.4-str_C4_F6_E0_12_DB_DB-ipv4_99.1.1.5-str_ff_ff_ff_cc_dd_ee],list_[str_ARP-int32_1-ipv4_77.1.1.4-str_C7_F7_E0_12_DB_DB-ipv4_77.1.1.5-str_f7_ff_ff_cc_dd_ee],list_[str_BZQ-int32_8-ipv4_88.1.1.4-str_C8_F6_E0_12_DB_DB-ipv4_88.1.1.5-str_ff_ff_ff_cc_dd_ee].
IPV4: str_ff_ff_ff_ff_ff,ipv4_10.1.1.7,ipv4_55.1.1.6,ipv4_88.1.1.5,ipv4_77.1.1.4,ipv4_77.1.1.5,ipv4_88.8.1.4,ipv4_66.1.1.4,ipv4_66.1.1.5,ipv4_99.1.1.4,ipv4_99.1.1.5,ipv4_distip01,ipv4_10.1.1.9,ipv4_10.1.1.8,ipv4_10.1.1.5,ipv4_10.1.1.4,ipv4_88.1.1.4,ipv4_10.1.1.6,ipv4_10.1.1.1,ipv4_10.1.1.3,ipv4_10.1.1.2,ipv4_srcip04,ipv4_srcip02,ipv4_srcip03,ipv4_srcip00,ipv4_srcip01,ipv4_dstip05,ipv4_dstip04,ipv4_dstip07,ipv4_dstip06,ipv4_dstip01,ipv4_dstip00,ipv4_dstip03,ipv4_dstip02.
STR: str_BZQ,str_IPV4,str_BXQ,str_BYQ,str_BTQ,str_controller,str_ARP.
*f_eq(IPV4,IPV4,LIST,LIST)
ipv4_10.1.1.8,ipv4_10.1.1.7,list_[str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_aa_bb_cc_dd_ee_ff],list_[ipv4_10.1.1.8-ipv4_10.1.1.7-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_aa_bb_cc_dd_ee_ff]
ipv4_srcip02,ipv4_dstip02,list_[str_BXQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_99.1.1.5-str_ff_ff_ff_cc_dd_ee],list_[ipv4_srcip02-ipv4_dstip02-str_BXQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_99.1.1.5-str_ff_ff_ff_cc_dd_ee]
ipv4_10.1.1.7,ipv4_dstip07,list_[str_ARP-int32_1-ipv4_10.1.1.7-str_c7_d7_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ee_ff_ff],list_[ipv4_10.1.1.7-ipv4_dstip07-str_ARP-int32_1-ipv4_10.1.1.7-str_c7_d7_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ee_ff_ff]
ipv4_10.1.1.6,ipv4_dstip07,list_[str_ARP-int32_1-ipv4_10.1.1.6-str_d7_c7_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ee_ff_ff],list_[ipv4_10.1.1.6-ipv4_dstip07-str_ARP-int32_1-ipv4_10.1.1.6-str_d7_c7_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ee_ff_ff]
ipv4_10.1.1.6,ipv4_10.1.1.9,list_[str_ARP-int32_2-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04],list_[ipv4_10.1.1.6-ipv4_10.1.1.9-str_ARP-int32_2-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04]
ipv4_10.1.1.9,ipv4_10.1.1.6,list_[str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_cc_bb_bb_bb_cc_cc],list_[ipv4_10.1.1.9-ipv4_10.1.1.6-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_cc_bb_bb_bb_cc_cc]
ipv4_10.1.1.9,str_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.9-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_ff_ff_ff_ff_ff_ff]
ipv4_srcip00,ipv4_dstip00,list_[str_BZQ-int32_1-ipv4_88.1.1.4-str_C8_F6_E0_12_DB_DB-ipv4_88.1.1.5-str_ff_ff_ff_cc_dd_ee],list_[ipv4_srcip00-ipv4_dstip00-str_BZQ-int32_1-ipv4_88.1.1.4-str_C8_F6_E0_12_DB_DB-ipv4_88.1.1.5-str_ff_ff_ff_cc_dd_ee]
ipv4_10.1.1.9,ipv4_10.1.1.6,list_[str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_aa_aa_bb_bb_cc_cc],list_[ipv4_10.1.1.9-ipv4_10.1.1.6-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_aa_aa_bb_bb_cc_cc]
ipv4_10.1.1.7,str_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.7-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.6,ipv4_dstip06,list_[str_ARP-int32_1-ipv4_10.1.1.6-str_d6_c6_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ff_ff_ff],list_[ipv4_10.1.1.6-ipv4_dstip06-str_ARP-int32_1-ipv4_10.1.1.6-str_d6_c6_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ff_ff_ff]
ipv4_srcip01,ipv4_dstip01,list_[str_ARP-int32_2-ipv4_99.1.1.4-str_C4_F6_E0_12_DB_DB-ipv4_distip01-str_ff_ff_ff_cc_dd_ee],list_[ipv4_srcip01-ipv4_dstip01-str_ARP-int32_2-ipv4_99.1.1.4-str_C4_F6_E0_12_DB_DB-ipv4_distip01-str_ff_ff_ff_cc_dd_ee]
ipv4_10.1.1.7,ipv4_dstip06,list_[str_ARP-int32_1-ipv4_10.1.1.7-str_c6_d6_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ff_ff_ff],list_[ipv4_10.1.1.7-ipv4_dstip06-str_ARP-int32_1-ipv4_10.1.1.7-str_c6_d6_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ff_ff_ff]
ipv4_55.1.1.6,ipv4_10.1.1.5,list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff],list_[ipv4_55.1.1.6-ipv4_10.1.1.5-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.6,ipv4_10.1.1.5,list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.6-ipv4_10.1.1.5-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff]
ipv4_srcip03,ipv4_dstip03,list_[str_BYQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_77.1.1.5-str_ff_ff_ff_cc_dd_ee],list_[ipv4_srcip03-ipv4_dstip03-str_BYQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_77.1.1.5-str_ff_ff_ff_cc_dd_ee]
ipv4_10.1.1.8,str_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.8-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ff_ff_ff_ff_ff]
ipv4_srcip04,ipv4_dstip05,list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip05-str_ff_ff_ff_ff_ff_ff],list_[ipv4_srcip04-ipv4_dstip05-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip05-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.7,ipv4_10.1.1.8,list_[str_ARP-int32_2-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04],list_[ipv4_10.1.1.7-ipv4_10.1.1.8-str_ARP-int32_2-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04]
ipv4_10.1.1.8,ipv4_10.1.1.7,list_[str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ee_cc_dd_ee_ff],list_[ipv4_10.1.1.8-ipv4_10.1.1.7-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ee_cc_dd_ee_ff]
ipv4_srcip04,ipv4_dstip04,list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip04-str_ff_ff_ff_ff_ff_ff],list_[ipv4_srcip04-ipv4_dstip04-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip04-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.6,str_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_ff_ff_ff_ff_ff_ff],list_[ipv4_10.1.1.6-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_ff_ff_ff_ff_ff_ff]
.
*IPV4_TYPE(STR)
str_IPV4
.
*ALL_PORT(INT32)
int32_0
.
*ARP_PRIO(INT32)
int32_1
.
arpReplyCtl(IPV4,IPV4,MAC,IPV4,MAC)
ipv4_10.1.1.1,ipv4_10.1.1.7,str_a7_3a_27_90_b4_02,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04
ipv4_10.1.1.1,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04
.
*flowEntry(IPV4,STR,INT32,STR)
ipv4_10.1.1.2,str_ARP,int32_1,str_controller
ipv4_10.1.1.5,str_ARP,int32_1,str_controller
ipv4_10.1.1.3,str_ARP,int32_1,str_controller
ipv4_10.1.1.4,str_ARP,int32_1,str_controller
.
*linkHst(IPV4,IPV4,INT32)
ipv4_10.1.1.8,ipv4_10.1.1.4,int32_11
ipv4_10.1.1.7,ipv4_10.1.1.3,int32_10
ipv4_10.1.1.6,ipv4_10.1.1.2,int32_1
ipv4_10.1.1.9,ipv4_10.1.1.5,int32_44
.
*ofconnCtl(IPV4,IPV4)
ipv4_10.1.1.1,ipv4_10.1.1.3
ipv4_10.1.1.1,ipv4_10.1.1.2
ipv4_10.1.1.1,ipv4_10.1.1.5
ipv4_10.1.1.1,ipv4_10.1.1.4
.
*linkSwc(IPV4,IPV4,INT32)
ipv4_10.1.1.3,ipv4_10.1.1.7,int32_20
ipv4_10.1.1.5,ipv4_10.1.1.9,int32_33
ipv4_10.1.1.4,ipv4_10.1.1.8,int32_22
ipv4_10.1.1.2,ipv4_10.1.1.6,int32_2
.
arpReqCtl(IPV4,IPV4,MAC,IPV4,MAC)
ipv4_10.1.1.1,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04,ipv4_10.1.1.6,str_ff_ff_ff_ff_ff_ff
ipv4_10.1.1.1,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_10.1.1.9,str_ff_ff_ff_ff_ff_ff
ipv4_10.1.1.1,ipv4_10.1.1.7,str_a7_3a_27_90_b4_02,ipv4_10.1.1.8,str_ff_ff_ff_ff_ff_ff
ipv4_10.1.1.1,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04,ipv4_10.1.1.7,str_ff_ff_ff_ff_ff_ff
.
*arpRequest(IPV4,IPV4,MAC,IPV4,MAC)
ipv4_10.1.1.6,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_10.1.1.9,str_ff_ff_ff_ff_ff_ff
ipv4_10.1.1.8,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04,ipv4_10.1.1.7,str_ff_ff_ff_ff_ff_ff
ipv4_10.1.1.7,ipv4_10.1.1.7,str_a7_3a_27_90_b4_02,ipv4_10.1.1.8,str_ff_ff_ff_ff_ff_ff
ipv4_10.1.1.9,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04,ipv4_10.1.1.6,str_ff_ff_ff_ff_ff_ff
.
packetOut(IPV4,IPV4,INT32,LIST)
ipv4_10.1.1.3,ipv4_10.1.1.1,int32_20,list_[ipv4_10.1.1.7-ipv4_10.1.1.8-str_ARP-int32_2-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04]
ipv4_10.1.1.2,ipv4_10.1.1.1,int32_2,list_[ipv4_10.1.1.6-ipv4_10.1.1.9-str_ARP-int32_2-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04]
.
*CONTROLLER(STR)
str_controller
.
*ARP_TYPE(STR)
str_ARP
.
packet(IPV4,IPV4,IPV4,LIST)
ipv4_10.1.1.3,ipv4_10.1.1.7,str_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.5,ipv4_10.1.1.9,str_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.2,ipv4_10.1.1.6,str_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.7,ipv4_10.1.1.3,ipv4_10.1.1.7,list_[str_ARP-int32_2-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04]
ipv4_10.1.1.4,ipv4_10.1.1.8,str_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.6,ipv4_10.1.1.2,ipv4_10.1.1.6,list_[str_ARP-int32_2-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04]
.
*f_combine_2(IPV4,IPV4,STR,INT32,IPV4,MAC,IPV4,MAC,LIST)
ipv4_55.1.1.6,ipv4_10.1.1.5,str_ARP,int32_1,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_10.1.1.5,str_ff_ff_ff_ff_ff_ff,list_[ipv4_55.1.1.6-ipv4_10.1.1.5-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.8,ipv4_10.1.1.7,str_ARP,int32_1,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04,ipv4_10.1.1.7,str_aa_bb_cc_dd_ee_ff,list_[ipv4_10.1.1.8-ipv4_10.1.1.7-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_aa_bb_cc_dd_ee_ff]
ipv4_10.1.1.8,ipv4_10.1.1.7,str_ARP,int32_1,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04,ipv4_10.1.1.7,str_ff_ee_cc_dd_ee_ff,list_[ipv4_10.1.1.8-ipv4_10.1.1.7-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ee_cc_dd_ee_ff]
ipv4_10.1.1.9,str_ff_ff_ff_ff_ff,str_ARP,int32_1,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04,ipv4_10.1.1.6,str_ff_ff_ff_ff_ff_ff,list_[ipv4_10.1.1.9-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.6,ipv4_dstip07,str_ARP,int32_1,ipv4_10.1.1.6,str_d7_c7_b0_a2_ee_cd,ipv4_10.1.1.5,str_ee_ee_ee_ee_ff_ff,list_[ipv4_10.1.1.6-ipv4_dstip07-str_ARP-int32_1-ipv4_10.1.1.6-str_d7_c7_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ee_ff_ff]
ipv4_srcip04,ipv4_dstip04,str_ARP,int32_1,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_dstip04,str_ff_ff_ff_ff_ff_ff,list_[ipv4_srcip04-ipv4_dstip04-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip04-str_ff_ff_ff_ff_ff_ff]
ipv4_srcip00,ipv4_dstip00,str_BZQ,int32_1,ipv4_88.1.1.4,str_C8_F6_E0_12_DB_DB,ipv4_88.1.1.5,str_ff_ff_ff_cc_dd_ee,list_[ipv4_srcip00-ipv4_dstip00-str_BZQ-int32_1-ipv4_88.1.1.4-str_C8_F6_E0_12_DB_DB-ipv4_88.1.1.5-str_ff_ff_ff_cc_dd_ee]
ipv4_srcip01,ipv4_dstip01,str_ARP,int32_2,ipv4_99.1.1.4,str_C4_F6_E0_12_DB_DB,ipv4_distip01,str_ff_ff_ff_cc_dd_ee,list_[ipv4_srcip01-ipv4_dstip01-str_ARP-int32_2-ipv4_99.1.1.4-str_C4_F6_E0_12_DB_DB-ipv4_distip01-str_ff_ff_ff_cc_dd_ee]
ipv4_10.1.1.7,ipv4_10.1.1.8,str_ARP,int32_2,ipv4_10.1.1.7,str_a7_3a_27_90_b4_02,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04,list_[ipv4_10.1.1.7-ipv4_10.1.1.8-str_ARP-int32_2-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04]
ipv4_srcip02,ipv4_dstip02,str_BXQ,int32_7,ipv4_77.1.1.4,str_C7_F6_E0_12_DB_DB,ipv4_99.1.1.5,str_ff_ff_ff_cc_dd_ee,list_[ipv4_srcip02-ipv4_dstip02-str_BXQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_99.1.1.5-str_ff_ff_ff_cc_dd_ee]
ipv4_10.1.1.6,str_ff_ff_ff_ff_ff,str_ARP,int32_1,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_10.1.1.9,str_ff_ff_ff_ff_ff_ff,list_[ipv4_10.1.1.6-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_ff_ff_ff_ff_ff_ff]
ipv4_srcip03,ipv4_dstip03,str_BYQ,int32_7,ipv4_77.1.1.4,str_C7_F6_E0_12_DB_DB,ipv4_77.1.1.5,str_ff_ff_ff_cc_dd_ee,list_[ipv4_srcip03-ipv4_dstip03-str_BYQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_77.1.1.5-str_ff_ff_ff_cc_dd_ee]
ipv4_10.1.1.9,ipv4_10.1.1.6,str_ARP,int32_1,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04,ipv4_10.1.1.6,str_cc_bb_bb_bb_cc_cc,list_[ipv4_10.1.1.9-ipv4_10.1.1.6-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_cc_bb_bb_bb_cc_cc]
ipv4_10.1.1.7,str_ff_ff_ff_ff_ff,str_ARP,int32_1,ipv4_10.1.1.7,str_a7_3a_27_90_b4_02,ipv4_10.1.1.8,str_ff_ff_ff_ff_ff_ff,list_[ipv4_10.1.1.7-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.6,ipv4_10.1.1.9,str_ARP,int32_2,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04,list_[ipv4_10.1.1.6-ipv4_10.1.1.9-str_ARP-int32_2-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04]
ipv4_10.1.1.6,ipv4_dstip06,str_ARP,int32_1,ipv4_10.1.1.6,str_d6_c6_b0_a2_ee_cd,ipv4_10.1.1.5,str_ee_ee_ee_ff_ff_ff,list_[ipv4_10.1.1.6-ipv4_dstip06-str_ARP-int32_1-ipv4_10.1.1.6-str_d6_c6_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ff_ff_ff]
ipv4_10.1.1.7,ipv4_dstip06,str_ARP,int32_1,ipv4_10.1.1.7,str_c6_d6_e0_a2_ee_cd,ipv4_10.1.1.5,str_ee_bb_ee_ff_ff_ff,list_[ipv4_10.1.1.7-ipv4_dstip06-str_ARP-int32_1-ipv4_10.1.1.7-str_c6_d6_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ff_ff_ff]
ipv4_srcip04,ipv4_dstip05,str_ARP,int32_1,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_dstip05,str_ff_ff_ff_ff_ff_ff,list_[ipv4_srcip04-ipv4_dstip05-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip05-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.7,ipv4_dstip07,str_ARP,int32_1,ipv4_10.1.1.7,str_c7_d7_e0_a2_ee_cd,ipv4_10.1.1.5,str_ee_bb_ee_ee_ff_ff,list_[ipv4_10.1.1.7-ipv4_dstip07-str_ARP-int32_1-ipv4_10.1.1.7-str_c7_d7_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ee_ff_ff]
ipv4_10.1.1.9,ipv4_10.1.1.6,str_ARP,int32_1,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04,ipv4_10.1.1.6,str_aa_aa_bb_bb_cc_cc,list_[ipv4_10.1.1.9-ipv4_10.1.1.6-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_aa_aa_bb_bb_cc_cc]
ipv4_10.1.1.8,str_ff_ff_ff_ff_ff,str_ARP,int32_1,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04,ipv4_10.1.1.7,str_ff_ff_ff_ff_ff_ff,list_[ipv4_10.1.1.8-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.6,ipv4_10.1.1.5,str_ARP,int32_1,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_10.1.1.5,str_ff_ff_ff_ff_ff_ff,list_[ipv4_10.1.1.6-ipv4_10.1.1.5-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff]
.
hostPos(IPV4,IPV4,IPV4,INT32)
ipv4_10.1.1.1,ipv4_10.1.1.9,ipv4_10.1.1.5,int32_33
ipv4_10.1.1.1,ipv4_10.1.1.8,ipv4_10.1.1.4,int32_22
ipv4_10.1.1.1,ipv4_10.1.1.6,ipv4_10.1.1.2,int32_2
ipv4_10.1.1.1,ipv4_10.1.1.7,ipv4_10.1.1.3,int32_20
.
*ofconnSwc(IPV4,IPV4)
ipv4_10.1.1.3,ipv4_10.1.1.1
ipv4_10.1.1.2,ipv4_10.1.1.1
ipv4_10.1.1.5,ipv4_10.1.1.1
ipv4_10.1.1.4,ipv4_10.1.1.1
.
*BROADCAST(IPV4)
str_ff_ff_ff_ff_ff
.
packetIn(IPV4,IPV4,INT32,LIST)
ipv4_10.1.1.1,ipv4_10.1.1.3,int32_20,list_[ipv4_10.1.1.7-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.1,ipv4_10.1.1.2,int32_2,list_[ipv4_10.1.1.6-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.1,ipv4_10.1.1.5,int32_33,list_[ipv4_10.1.1.9-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.1,ipv4_10.1.1.4,int32_22,list_[ipv4_10.1.1.8-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ff_ff_ff_ff_ff]
.
*f_first(IPV4,LIST)
ipv4_10.1.1.9,list_[ipv4_10.1.1.9-ipv4_10.1.1.6-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_cc_bb_bb_bb_cc_cc]
ipv4_srcip04,list_[ipv4_srcip04-ipv4_dstip04-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip04-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.9,list_[ipv4_10.1.1.9-ipv4_10.1.1.6-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_aa_aa_bb_bb_cc_cc]
ipv4_10.1.1.6,list_[ipv4_10.1.1.6-ipv4_dstip07-str_ARP-int32_1-ipv4_10.1.1.6-str_d7_c7_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ee_ff_ff]
ipv4_10.1.1.8,list_[ipv4_10.1.1.8-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.6,list_[ipv4_10.1.1.6-ipv4_10.1.1.5-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff]
ipv4_srcip00,list_[ipv4_srcip00-ipv4_dstip00-str_BZQ-int32_1-ipv4_88.1.1.4-str_C8_F6_E0_12_DB_DB-ipv4_88.1.1.5-str_ff_ff_ff_cc_dd_ee]
ipv4_srcip04,list_[ipv4_srcip04-ipv4_dstip05-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_dstip05-str_ff_ff_ff_ff_ff_ff]
ipv4_55.1.1.6,list_[ipv4_55.1.1.6-ipv4_10.1.1.5-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.5-str_ff_ff_ff_ff_ff_ff]
ipv4_srcip03,list_[ipv4_srcip03-ipv4_dstip03-str_BYQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_77.1.1.5-str_ff_ff_ff_cc_dd_ee]
ipv4_10.1.1.7,list_[ipv4_10.1.1.7-ipv4_dstip07-str_ARP-int32_1-ipv4_10.1.1.7-str_c7_d7_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ee_ff_ff]
ipv4_10.1.1.7,list_[ipv4_10.1.1.7-ipv4_10.1.1.8-str_ARP-int32_2-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04]
ipv4_10.1.1.7,list_[ipv4_10.1.1.7-ipv4_dstip06-str_ARP-int32_1-ipv4_10.1.1.7-str_c6_d6_e0_a2_ee_cd-ipv4_10.1.1.5-str_ee_bb_ee_ff_ff_ff]
ipv4_10.1.1.6,list_[ipv4_10.1.1.6-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_ff_ff_ff_ff_ff_ff]
ipv4_10.1.1.8,list_[ipv4_10.1.1.8-ipv4_10.1.1.7-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ee_cc_dd_ee_ff]
ipv4_10.1.1.6,list_[ipv4_10.1.1.6-ipv4_dstip06-str_ARP-int32_1-ipv4_10.1.1.6-str_d6_c6_b0_a2_ee_cd-ipv4_10.1.1.5-str_ee_ee_ee_ff_ff_ff]
ipv4_10.1.1.7,list_[ipv4_10.1.1.7-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_ff_ff_ff_ff_ff_ff]
ipv4_srcip01,list_[ipv4_srcip01-ipv4_dstip01-str_ARP-int32_2-ipv4_99.1.1.4-str_C4_F6_E0_12_DB_DB-ipv4_distip01-str_ff_ff_ff_cc_dd_ee]
ipv4_10.1.1.8,list_[ipv4_10.1.1.8-ipv4_10.1.1.7-str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_aa_bb_cc_dd_ee_ff]
ipv4_srcip02,list_[ipv4_srcip02-ipv4_dstip02-str_BXQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_99.1.1.5-str_ff_ff_ff_cc_dd_ee]
ipv4_10.1.1.6,list_[ipv4_10.1.1.6-ipv4_10.1.1.9-str_ARP-int32_2-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04]
ipv4_10.1.1.9,list_[ipv4_10.1.1.9-str_ff_ff_ff_ff_ff-str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_ff_ff_ff_ff_ff_ff]
.
*f_combine_1(STR,INT32,IPV4,MAC,IPV4,MAC,LIST)
str_ARP,int32_1,ipv4_10.1.1.7,str_a7_3a_27_90_b4_02,ipv4_10.1.1.8,str_ff_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_ff_ff_ff_ff_ff_ff]
str_ARP,int32_1,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_10.1.1.9,str_ff_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_ff_ff_ff_ff_ff_ff]
str_ARP,int32_1,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04,ipv4_10.1.1.6,str_ff_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04-ipv4_10.1.1.6-str_ff_ff_ff_ff_ff_ff]
str_BXQ,int32_7,ipv4_77.1.1.4,str_C7_F6_E0_12_DB_DB,ipv4_99.1.1.5,str_ff_ff_ff_cc_dd_ee,list_[str_BXQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_99.1.1.5-str_ff_ff_ff_cc_dd_ee]
str_ARP,int32_2,ipv4_10.1.1.7,str_a7_3a_27_90_b4_02,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04,list_[str_ARP-int32_2-ipv4_10.1.1.7-str_a7_3a_27_90_b4_02-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04]
str_BZQ,int32_8,ipv4_88.1.1.4,str_C8_F6_E0_12_DB_DB,ipv4_88.1.1.5,str_ff_ff_ff_cc_dd_ee,list_[str_BZQ-int32_8-ipv4_88.1.1.4-str_C8_F6_E0_12_DB_DB-ipv4_88.1.1.5-str_ff_ff_ff_cc_dd_ee]
str_BTQ,int32_9,ipv4_99.1.1.4,str_C4_F6_E0_12_DB_DB,ipv4_99.1.1.5,str_ff_ff_ff_cc_dd_ee,list_[str_BTQ-int32_9-ipv4_99.1.1.4-str_C4_F6_E0_12_DB_DB-ipv4_99.1.1.5-str_ff_ff_ff_cc_dd_ee]
str_ARP,int32_2,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04,list_[str_ARP-int32_2-ipv4_10.1.1.6-str_c6_f6_e0_12_db_db-ipv4_10.1.1.9-str_f9_3a_41_63_b1_04]
str_ARP,int32_1,ipv4_66.1.1.4,str_C6_F6_E0_12_DB_DB,ipv4_66.1.1.5,str_f6_ff_ff_cc_dd_ee,list_[str_ARP-int32_1-ipv4_66.1.1.4-str_C6_F6_E0_12_DB_DB-ipv4_66.1.1.5-str_f6_ff_ff_cc_dd_ee]
str_ARP,int32_1,ipv4_88.8.1.4,str_C8_F8_E0_12_DB_DB,ipv4_88.1.1.5,str_f8_ff_ff_cc_dd_ee,list_[str_ARP-int32_1-ipv4_88.8.1.4-str_C8_F8_E0_12_DB_DB-ipv4_88.1.1.5-str_f8_ff_ff_cc_dd_ee]
str_BYQ,int32_7,ipv4_77.1.1.4,str_C7_F6_E0_12_DB_DB,ipv4_77.1.1.5,str_ff_ff_ff_cc_dd_ee,list_[str_BYQ-int32_7-ipv4_77.1.1.4-str_C7_F6_E0_12_DB_DB-ipv4_77.1.1.5-str_ff_ff_ff_cc_dd_ee]
str_ARP,int32_1,ipv4_77.1.1.4,str_C7_F7_E0_12_DB_DB,ipv4_77.1.1.5,str_f7_ff_ff_cc_dd_ee,list_[str_ARP-int32_1-ipv4_77.1.1.4-str_C7_F7_E0_12_DB_DB-ipv4_77.1.1.5-str_f7_ff_ff_cc_dd_ee]
str_ARP,int32_1,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04,ipv4_10.1.1.7,str_ff_ff_ff_ff_ff_ff,list_[str_ARP-int32_1-ipv4_10.1.1.8-str_f8_3a_41_63_b1_04-ipv4_10.1.1.7-str_ff_ff_ff_ff_ff_ff]
.
arpReply(IPV4,IPV4,MAC,IPV4,MAC)
ipv4_10.1.1.7,ipv4_10.1.1.7,str_a7_3a_27_90_b4_02,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04
ipv4_10.1.1.6,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04
.
arpMapping(IPV4,IPV4,MAC)
ipv4_10.1.1.1,ipv4_10.1.1.7,str_a7_3a_27_90_b4_02
ipv4_10.1.1.1,ipv4_10.1.1.8,str_f8_3a_41_63_b1_04
ipv4_10.1.1.1,ipv4_10.1.1.9,str_f9_3a_41_63_b1_04
ipv4_10.1.1.1,ipv4_10.1.1.6,str_c6_f6_e0_12_db_db
.
*ARP_REPLY(INT32)
int32_2
.
|
D
|
/Users/julia/ruhackathon/target/debug/deps/num_traits-e0e1aad75b3a3b23.rmeta: /Users/julia/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.1.43/src/lib.rs
/Users/julia/ruhackathon/target/debug/deps/libnum_traits-e0e1aad75b3a3b23.rlib: /Users/julia/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.1.43/src/lib.rs
/Users/julia/ruhackathon/target/debug/deps/num_traits-e0e1aad75b3a3b23.d: /Users/julia/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.1.43/src/lib.rs
/Users/julia/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.1.43/src/lib.rs:
|
D
|
Lance Armstrong continues to vehemently deny doping charges. The IOC president called for an independent investigation into allegations he used EPO in 1999. He questioned the integrity and validity of the tests and demanded the laboratory be suspended. The International Cycling Union and the World Anti-Doping Agency both announced separate inquiries. UCI and WADA have been feuding over the case. UCI accused WADA of withholding information. WADA accused former UCI president Verbruggen of leaking documents to L'Equipe.
|
D
|
/Users/jr/Desktop/RealProject/JrMemo/build/JrMemo.build/Debug-iphonesimulator/JrMemo.build/Objects-normal/x86_64/FolderTalbeViewController.o : /Users/jr/Desktop/RealProject/JrMemo/JrMemo/Controller/AppDelegate.swift /Users/jr/Desktop/RealProject/JrMemo/JrMemo/Controller/FolderTalbeViewController.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 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/jr/Desktop/RealProject/JrMemo/build/JrMemo.build/Debug-iphonesimulator/JrMemo.build/Objects-normal/x86_64/FolderTalbeViewController~partial.swiftmodule : /Users/jr/Desktop/RealProject/JrMemo/JrMemo/Controller/AppDelegate.swift /Users/jr/Desktop/RealProject/JrMemo/JrMemo/Controller/FolderTalbeViewController.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 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/jr/Desktop/RealProject/JrMemo/build/JrMemo.build/Debug-iphonesimulator/JrMemo.build/Objects-normal/x86_64/FolderTalbeViewController~partial.swiftdoc : /Users/jr/Desktop/RealProject/JrMemo/JrMemo/Controller/AppDelegate.swift /Users/jr/Desktop/RealProject/JrMemo/JrMemo/Controller/FolderTalbeViewController.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 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
func int spell_logic_heal(var int manainvested)
{
printdebugnpc(PD_MAGIC,"Spell_Logic_Heal");
if(self.attribute[ATR_HITPOINTS] == self.attribute[ATR_HITPOINTS_MAX])
{
return SPL_SENDSTOP;
}
else if(manainvested >= 1)
{
if(self.attribute[ATR_HITPOINTS] < self.attribute[ATR_HITPOINTS_MAX])
{
Npc_ChangeAttribute(self,ATR_HITPOINTS,SPL_HEALING_HP_PER_MP);
return SPL_NEXTLEVEL;
};
};
return SPL_RECEIVEINVEST;
};
|
D
|
module sb.taskgraph.dispatch_interface;
public import sb.taskgraph.impl.task;
alias SbTaskPtr = SbTask*;
enum SbQueue : uint {
NONE = 0, ASYNC, PER_FRAME, GT_ONLY, MT_ONLY
}
// create / unregister target queue (must do this for default queues)
SbQueue sbCreateTaskQueue (SbQueue hint = SbQueue.NONE);
bool sbRemoveTaskQueue (SbQueue);
bool sbQueueExists (SbQueue);
// push task onto target queue
SbTaskPtr sbPushTask (SbQueue target, void delegate() action, void delegate(SbTaskPtr) postAction);
SbTaskPtr sbPushTask (SbQueue target, void delegate() action);
// exec one task from target queue; returns true if did work.
// This should ONLY be called from the appropriate thread (eg. SbQueue.GT_ONLY => only call from graphics thread!)
bool sbExecQueue (SbQueue target);
//SbTaskQueueStats sbGetQueueStats (SbTaskQueueId);
|
D
|
/**
* Authors:
* $(LINK2 https://github.com/FreeSlave, Roman Chistokhodov)
* Copyright:
* Roman Chistokhodov, 2017
* License:
* $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
*/
module json;
import vibe.data.json;
import serverinfo;
import player;
Json serverInfoToJson(const ServerInfo info)
{
Json j = Json.emptyObject;
j["serverName"] = info.serverName;
j["game"] = info.game;
j["gamedir"] = info.gamedir;
j["map"] = info.mapName;
j["requiresPassword"] = info.requiresPassword;
j["isSecured"] = info.isSecured;
string type;
final switch(info.serverType) {
case ServerInfo.Type.Dedicated:
type = "dedicated";
break;
case ServerInfo.Type.NonDedicated:
type = "non-dedicated";
break;
case ServerInfo.Type.SourceTV:
type = "sourceTV";
break;
case ServerInfo.Type.Unknown:
type = "unknown";
break;
}
j["serverType"] = type;
string os;
final switch(info.environment) {
case ServerInfo.OS.Linux:
os = "linux";
break;
case ServerInfo.OS.Windows:
os = "windows";
break;
case ServerInfo.OS.OSX:
os = "osx";
break;
case ServerInfo.OS.Unknown:
os = "unknown";
break;
}
j["environment"] = os;
j["playersCount"] = info.playersCount;
j["maxPlayersCount"] = info.maxPlayersCount;
return j;
}
Json playersToJson(const(Player[]) players)
{
return serializeToJson(players);
}
Player[] jsonToPlayers(Json arr)
{
return deserializeJson!(Player[])(arr);
}
|
D
|
/*
* Hunt - A refined core library for D programming language.
*
* Copyright (C) 2018-2019 HuntLabs
*
* Website: https://www.huntlabs.net/
*
* Licensed under the Apache-2.0 License.
*
*/
module hunt.concurrency.Locker;
import hunt.Exceptions;
import hunt.util.Common;
/**
* <p>
* This is a lock designed to protect VERY short sections of critical code.
* Threads attempting to take the lock will wait until the lock is available,
* thus it is important that the code protected by this lock is extremely simple
* and non blocking.
* </p>
*
* <pre>
* try (SpinLock.Lock lock = locker.lock()) {
* // something very quick and non blocking
* }
* </pre>
*/
class Locker {
private enum bool SPIN = true;
private bool _spin;
// private ReentrantLock _lock = new ReentrantLock();
// private AtomicReference!(Thread) _spinLockState = new AtomicReference<>(null);
private Lock _unlock; // = new Lock();
this() {
this(SPIN);
}
this(bool spin) {
_unlock = new Lock();
this._spin = spin;
}
Lock lock() {
// if (_spin)
// spinLock();
// else
// concLock();
return _unlock;
}
// private void spinLock() {
// Thread current = Thread.currentThread();
// while (true) {
// // Using test-and-test-and-set for better performance.
// Thread locker = _spinLockState.get();
// if (locker !is null || !_spinLockState.compareAndSet(null, current)) {
// if (locker == current)
// throw new IllegalStateException("Locker is not reentrant");
// continue;
// }
// return;
// }
// }
private void concLock() {
// if (_lock.isHeldByCurrentThread())
// throw new IllegalStateException("Locker is not reentrant");
// _lock.lock();
}
bool isLocked() {
// if (_spin)
// return _spinLockState.get() !is null;
// else
// return _lock.isLocked();
// implementationMissing();
return false;
}
class Lock : AutoCloseable {
override
void close() {
// if (_spin)
// _spinLockState.set(null);
// else
// _lock.unlock();
}
}
// void lock(Action0 action0) {
// try (Lock lock = lock()) {
// action0.call();
// }
// }
// !(T) T lock(Func0!(T) func0) {
// try (Lock lock = lock()) {
// return func0.call();
// }
// }
}
|
D
|
E: c603, c6, c621, c825, c163, c487, c771, c44, c416, c654, c502, c173, c388, c921, c715, c536, c566, c640, c81, c335, c760, c874, c55, c692, c42, c198, c7, c813, c730, c213, c142, c685, c578, c857, c638, c249, c555, c871, c721, c491, c0, c87, c645, c327, c525, c391, c48, c29, c708, c904, c725, c695, c615, c898, c923, c890, c83, c570, c407, c428, c272, c263, c306, c448, c99, c507, c192, c266, c218, c802, c219, c851, c530, c624, c353, c347, c246, c558, c432, c631, c478, c38, c209, c344, c888, c318, c515, c408, c307, c639, c451, c241, c113, c829, c688, c286, c467, c663, c229, c386, c315, c702, c562, c926, c300, c946, c439, c891, c396, c114, c867, c796, c244, c655, c588, c782, c809, c322, c686, c284, c398, c810, c826, c789, c937, c609, c716, c321, c79, c761, c643, c460, c292, c912, c533, c584, c606, c447, c557, c289, c82, c513, c155, c899, c818, c280, c948, c753, c191, c757, c845, c70, c28, c1, c574, c927, c282, c383, c673, c170, c126, c657, c931, c913, c203, c194, c623, c177, c466, c40, c947, c841, c837, c443, c644, c303, c650, c101, c394, c368, c585, c197, c424, c835, c405, c411, c133, c935, c325, c880, c34, c798, c181, c551, c458, c843, c748, c846, c124, c39, c376, c121, c438, c804, c20, c252, c105, c352, c337, c274, c119, c62, c787, c179, c231, c770, c661, c395, c108, c548, c287, c475, c799, c900, c759, c397, c823, c217, c380, c520, c510, c348, c415, c459, c483, c208, c674, c414, c500, c202, c933, c755, c847, c524, c504, c582, c547, c216, c895, c409, c561, c195, c215, c792, c600, c168, c819, c939, c897, c625, c110, c329, c911, c384, c477, c863, c751, c870, c724, c75, c914, c783, c440, c859, c705, c869, c626, c630, c63, c848, c359, c658, c88, c68, c26, c169, c269, c934, c785, c550, c633, c669, c333, c569, c807, c903, c865, c814, c144, c587, c481, c576, c560, c157, c220, c46, c660, c378, c528, c884, c196, c450, c727, c808, c539, c929, c589, c861, c49, c781, c670, c714, c580, c511, c273, c323, c199, c294, c342, c382, c765, c427, c701, c230, c41, c369, c878, c330, c572, c773, c506, c80, c275, c258, c149, c627, c681, c265, c102, c775, c456, c597, c4, c33, c128, c455, c361, c494, c412, c312, c85, c433, c91, c514, c76, c320, c264, c529, c559, c668, c690, c832, c941, c490, c136, c699, c738, c434, c454, c752, c350, c115, c554, c402, c343, c852, c877, c51, c622, c735, c612, c583, c812, c364, c295, c116, c943, c474, c780, c374, c647, c250, c363, c104, c676, c706, c803, c441, c36, c446, c476, c324, c750, c850, c541, c479, c472, c11, c883, c876, c573, c261, c107, c311, c636.
p2(E,E)
c603,c6
c621,c825
c163,c825
c487,c6
c771,c44
c502,c173
c388,c921
c715,c536
c502,c81
c388,c335
c760,c874
c55,c692
c42,c198
c7,c813
c730,c213
c142,c685
c578,c857
c638,c857
c249,c555
c42,c81
c249,c721
c491,c0
c87,c721
c645,c327
c525,c0
c391,c48
c525,c29
c708,c857
c904,c654
c725,c857
c603,c173
c142,c695
c615,c898
c87,c83
c904,c695
c7,c6
c904,c685
c87,c570
c487,c407
c638,c335
c428,c272
c263,c306
c448,c99
c507,c721
c192,c266
c730,c218
c802,c898
c219,c640
c851,c530
c142,c347
c87,c327
c432,c685
c631,c478
c42,c898
c638,c173
c192,c335
c725,c921
c603,c898
c525,c83
c621,c83
c904,c555
c708,c825
c318,c515
c725,c83
c432,c335
c408,c307
c388,c685
c638,c685
c890,c639
c904,c0
c142,c407
c638,c555
c192,c29
c113,c695
c467,c663
c42,c654
c487,c173
c113,c198
c638,c347
c645,c555
c229,c386
c730,c173
c142,c81
c802,c640
c432,c327
c42,c721
c163,c407
c702,c562
c300,c407
c530,c946
c725,c695
c192,c81
c42,c0
c890,c173
c7,c639
c163,c688
c249,c198
c891,c396
c114,c555
c867,c857
c219,c218
c87,c407
c796,c244
c87,c654
c802,c335
c725,c81
c615,c654
c946,c588
c42,c570
c645,c407
c249,c782
c487,c570
c904,c921
c809,c322
c686,c284
c890,c0
c163,c83
c487,c826
c789,c937
c502,c83
c609,c716
c761,c643
c525,c213
c460,c292
c249,c407
c730,c654
c42,c921
c507,c0
c912,c533
c584,c606
c42,c213
c557,c81
c802,c857
c42,c695
c7,c782
c615,c825
c525,c721
c42,c29
c7,c173
c578,c29
c645,c898
c142,c857
c725,c347
c113,c347
c557,c685
c603,c688
c638,c83
c42,c407
c645,c570
c615,c782
c890,c81
c615,c173
c87,c685
c557,c218
c249,c898
c525,c6
c192,c6
c615,c695
c388,c898
c507,c921
c280,c948
c87,c347
c802,c29
c502,c570
c191,c502
c757,c845
c7,c198
c890,c213
c621,c721
c70,c28
c192,c898
c1,c574
c388,c198
c890,c782
c388,c213
c578,c6
c408,c282
c557,c721
c383,c673
c163,c782
c300,c685
c615,c81
c170,c555
c42,c335
c249,c826
c163,c826
c904,c347
c802,c685
c113,c640
c557,c555
c931,c913
c203,c194
c432,c6
c615,c335
c249,c688
c557,c347
c525,c857
c623,c177
c466,c246
c432,c721
c507,c213
c725,c555
c947,c841
c837,c443
c300,c29
c578,c695
c615,c29
c101,c394
c578,c640
c638,c198
c645,c654
c730,c782
c802,c407
c170,c407
c113,c29
c142,c721
c192,c721
c192,c825
c578,c173
c7,c213
c725,c898
c761,c424
c192,c198
c835,c219
c405,c411
c300,c695
c133,c935
c388,c639
c621,c335
c904,c198
c170,c640
c730,c921
c880,c34
c113,c639
c798,c181
c142,c555
c219,c688
c502,c639
c615,c218
c557,c695
c890,c198
c603,c857
c87,c826
c113,c327
c458,c843
c432,c748
c432,c640
c525,c654
c300,c782
c466,c846
c708,c826
c219,c654
c163,c6
c87,c0
c725,c825
c432,c695
c645,c688
c502,c857
c39,c376
c121,c438
c557,c29
c935,c804
c87,c555
c621,c213
c603,c213
c557,c335
c219,c921
c249,c921
c603,c555
c87,c6
c615,c198
c432,c654
c432,c81
c300,c81
c645,c825
c615,c640
c904,c213
c170,c721
c231,c770
c661,c395
c502,c327
c108,c548
c557,c173
c502,c213
c904,c6
c38,c287
c443,c475
c300,c826
c383,c799
c615,c826
c557,c782
c603,c570
c621,c639
c904,c29
c759,c397
c249,c685
c603,c826
c823,c217
c219,c857
c890,c921
c557,c6
c890,c218
c219,c335
c113,c688
c525,c640
c249,c327
c163,c695
c645,c721
c380,c520
c113,c0
c502,c782
c113,c83
c510,c348
c643,c415
c890,c857
c113,c825
c459,c483
c163,c570
c192,c688
c208,c674
c557,c198
c603,c825
c300,c570
c645,c83
c163,c81
c725,c0
c638,c407
c904,c782
c502,c685
c507,c6
c507,c685
c847,c524
c300,c173
c638,c570
c557,c640
c504,c582
c42,c857
c502,c688
c645,c198
c555,c547
c890,c327
c890,c335
c42,c639
c219,c695
c895,c409
c7,c685
c725,c639
c638,c695
c219,c198
c603,c347
c219,c825
c661,c195
c215,c899
c904,c721
c708,c6
c792,c600
c708,c198
c7,c335
c708,c83
c638,c81
c558,c168
c645,c695
c163,c857
c163,c347
c725,c721
c249,c6
c7,c347
c142,c198
c638,c6
c507,c218
c939,c897
c113,c782
c142,c921
c904,c857
c170,c218
c170,c898
c802,c213
c329,c911
c730,c6
c890,c640
c87,c639
c904,c688
c384,c477
c863,c39
c487,c695
c638,c782
c615,c688
c507,c782
c802,c218
c163,c29
c751,c870
c525,c570
c170,c335
c525,c81
c219,c898
c525,c921
c170,c782
c724,c75
c447,c914
c783,c724
c42,c555
c525,c335
c487,c555
c730,c29
c603,c640
c487,c640
c502,c218
c440,c859
c621,c688
c603,c81
c432,c0
c388,c640
c87,c695
c170,c639
c507,c688
c705,c869
c502,c826
c626,c630
c192,c640
c603,c721
c42,c327
c904,c826
c615,c327
c688,c163
c557,c857
c802,c921
c848,c105
c192,c921
c359,c555
c113,c407
c638,c654
c507,c335
c603,c29
c638,c826
c615,c213
c42,c218
c88,c68
c249,c81
c208,c26
c819,c169
c269,c934
c890,c685
c388,c327
c890,c654
c432,c29
c416,c785
c142,c826
c550,c633
c487,c83
c219,c173
c569,c807
c388,c555
c7,c826
c725,c29
c170,c198
c42,c640
c890,c6
c708,c335
c7,c640
c163,c685
c638,c218
c708,c695
c219,c347
c432,c570
c300,c335
c113,c555
c708,c173
c507,c695
c432,c639
c87,c898
c525,c685
c578,c654
c163,c865
c802,c555
c638,c921
c578,c570
c252,c144
c869,c587
c502,c555
c904,c327
c170,c81
c708,c213
c481,c576
c7,c0
c725,c685
c432,c857
c578,c898
c560,c82
c157,c220
c557,c407
c307,c6
c603,c654
c300,c654
c46,c660
c388,c6
c730,c685
c7,c407
c725,c654
c42,c688
c219,c29
c450,c727
c170,c29
c388,c654
c557,c898
c808,c348
c507,c826
c192,c0
c638,c29
c615,c6
c603,c639
c539,c929
c589,c478
c170,c857
c725,c826
c638,c213
c487,c327
c861,c49
c432,c555
c163,c198
c163,c640
c578,c639
c557,c570
c170,c213
c730,c570
c580,c748
c609,c511
c603,c782
c730,c407
c300,c640
c323,c199
c142,c639
c502,c654
c170,c826
c427,c663
c730,c335
c87,c81
c87,c213
c904,c570
c621,c0
c230,c41
c502,c198
c502,c825
c432,c782
c708,c898
c369,c878
c525,c898
c113,c826
c192,c213
c219,c83
c773,c506
c113,c218
c802,c825
c192,c407
c645,c685
c487,c0
c603,c198
c388,c570
c645,c335
c87,c825
c525,c695
c388,c173
c170,c688
c487,c898
c258,c149
c219,c721
c219,c555
c645,c921
c487,c721
c802,c81
c730,c721
c645,c213
c7,c921
c192,c857
c904,c173
c578,c555
c192,c695
c249,c570
c603,c83
c265,c102
c802,c688
c730,c83
c249,c218
c42,c826
c939,c478
c113,c721
c621,c570
c802,c570
c249,c857
c775,c456
c708,c654
c578,c213
c42,c685
c645,c29
c597,c4
c7,c570
c192,c654
c708,c407
c42,c825
c507,c640
c33,c128
c7,c688
c456,c455
c890,c825
c525,c555
c280,c625
c557,c213
c802,c721
c432,c826
c494,c412
c621,c6
c487,c347
c578,c921
c904,c83
c312,c85
c487,c218
c578,c198
c578,c327
c249,c695
c802,c347
c460,c91
c502,c6
c557,c0
c514,c329
c502,c721
c621,c81
c645,c218
c730,c857
c41,c658
c904,c898
c142,c825
c502,c921
c578,c825
c249,c347
c890,c347
c502,c335
c578,c218
c621,c921
c192,c782
c529,c559
c42,c347
c725,c335
c603,c218
c668,c690
c621,c782
c578,c0
c904,c218
c87,c921
c487,c639
c170,c570
c249,c335
c708,c347
c142,c782
c447,c136
c725,c688
c163,c335
c557,c825
c142,c218
c507,c857
c113,c685
c621,c695
c557,c654
c203,c699
c142,c640
c300,c555
c487,c198
c725,c407
c113,c898
c249,c29
c615,c685
c388,c347
c192,c173
c432,c83
c142,c83
c192,c826
c904,c825
c638,c898
c904,c640
c83,c454
c730,c695
c615,c347
c219,c0
c7,c898
c300,c213
c890,c407
c525,c198
c388,c688
c388,c81
c344,c396
c350,c115
c525,c347
c638,c825
c621,c173
c708,c570
c578,c347
c192,c83
c192,c639
c708,c721
c525,c782
c557,c688
c708,c782
c615,c0
c645,c0
c163,c213
c802,c826
c890,c721
c388,c782
c343,c802
c87,c852
c802,c173
c877,c51
c432,c218
c622,c558
c507,c407
c219,c327
c615,c639
c219,c639
c142,c0
c557,c921
c730,c640
c388,c407
c113,c6
c432,c213
c735,c344
c7,c555
c525,c826
c578,c81
c388,c0
c163,c327
c7,c654
c510,c877
c113,c335
c612,c770
c708,c685
c890,c555
c113,c857
c890,c898
c364,c857
c502,c407
c725,c782
c432,c688
c388,c218
c192,c218
c539,c116
c87,c688
c725,c173
c708,c688
c249,c83
c730,c898
c638,c639
c142,c6
c432,c898
c113,c654
c249,c173
c163,c173
c615,c555
c219,c6
c557,c83
c249,c825
c439,c874
c42,c173
c294,c903
c487,c81
c621,c685
c621,c555
c621,c347
c487,c921
c7,c695
c725,c327
c725,c640
c163,c654
c943,c474
c192,c570
c645,c81
c432,c347
c163,c921
c904,c335
c802,c327
c578,c782
c621,c407
c388,c826
c374,c947
c487,c782
c904,c639
c730,c81
c300,c639
c621,c218
c250,c947
c7,c29
c42,c83
c363,c721
c432,c407
c300,c688
c163,c639
c933,c104
c645,c826
c578,c685
c730,c825
c730,c555
c638,c0
c725,c6
c163,c0
c119,c803
c87,c335
c615,c570
c75,c859
c300,c857
c192,c555
c36,c446
c388,c695
c476,c324
c7,c412
c142,c173
c487,c857
c730,c826
c603,c695
c142,c327
c541,c479
c219,c81
c42,c6
c157,c472
c249,c213
c883,c876
c142,c654
c573,c261
c890,c688
c107,c638
c603,c335
c638,c721
c87,c218
c170,c0
c638,c327
c300,c327
c487,c685
c289,c633
c557,c327
c890,c83
c507,c639
c904,c81
c578,c335
.
p3(E,E)
c416,c654
c344,c888
c286,c327
c566,c640
c927,c347
c447,c213
c303,c782
c40,c685
c716,c0
c625,c6
c110,c921
c197,c721
c63,c555
c669,c198
c781,c670
c701,c688
c487,c29
c724,c814
c264,c218
c926,c898
c490,c6
c434,c407
c433,c826
c730,c83
c850,c81
.
p10(E,E)
c566,c640
c926,c898
c525,c321
c447,c213
c730,c289
c249,c818
c87,c753
c126,c639
c40,c685
c197,c721
c716,c0
c192,c62
c890,c179
c42,c880
c502,c216
c721,c335
c333,c218
c507,c933
c557,c294
c388,c342
c142,c727
c708,c333
c113,c524
c701,c688
c433,c826
c76,c320
c487,c29
c286,c327
c434,c407
c752,c570
c63,c555
c615,c514
c645,c554
c802,c402
c638,c322
c669,c198
c583,c812
c730,c83
c625,c6
c487,c49
c603,c547
c300,c11
c416,c654
.
p5(E,E)
c871,c638
c923,c890
c38,c507
c209,c42
c631,c439
c513,c163
c114,c730
c325,c192
c551,c170
c202,c578
c561,c432
c219,c525
c241,c645
c124,c603
c814,c621
c900,c725
c681,c502
c361,c300
c787,c87
c933,c487
c504,c41
c215,c802
c714,c615
c337,c557
c647,c7
c650,c142
.
p0(E,E)
c624,c353
c274,c119
c832,c941
.
p7(E,E)
c246,c558
c368,c585
c378,c528
c750,c724
.
p1(E,E)
c451,c198
c829,c688
c315,c335
c655,c6
c82,c81
c657,c825
c155,c639
c644,c721
c730,c555
c755,c654
c658,c809
c903,c327
c396,c826
c273,c570
c396,c627
c738,c83
c320,c213
c350,c0
c295,c857
c780,c898
c51,c407
c441,c29
.
p9(E,E)
c645,c241
c388,c79
c42,c209
c142,c650
c603,c124
c890,c923
c557,c337
c87,c787
c725,c900
c487,c933
c825,c819
c578,c202
c615,c714
c113,c275
c249,c342
c802,c215
c638,c871
c621,c814
c192,c325
c730,c114
c502,c681
c507,c38
.
p8(E,E)
c398,c810
c80,c481
c676,c706
.
p6(E,E)
c155,c899
c857,c353
c20,c252
c105,c352
c884,c196
c382,c765
c330,c572
.
p4(E,E)
c414,c500
c386,c311
c636,c241
.
|
D
|
/**
* D header file for POSIX.
*
* Copyright: Copyright Sean Kelly 2005 - 2009.
* License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Sean Kelly, Alex Rønne Petersen
* Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
*/
/* Copyright Sean Kelly 2005 - 2009.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
module core.sys.posix.fcntl;
private import core.sys.posix.config;
private import core.stdc.stdint;
public import core.sys.posix.sys.types; // for off_t, mode_t
public import core.sys.posix.sys.stat; // for S_IFMT, etc.
version (OSX)
version = Darwin;
else version (iOS)
version = Darwin;
else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;
version (Posix):
extern (C):
nothrow:
@nogc:
//
// Required
//
/*
F_DUPFD
F_GETFD
F_SETFD
F_GETFL
F_SETFL
F_GETLK
F_SETLK
F_SETLKW
F_GETOWN
F_SETOWN
FD_CLOEXEC
F_RDLCK
F_UNLCK
F_WRLCK
O_CREAT
O_EXCL
O_NOCTTY
O_TRUNC
O_APPEND
O_DSYNC
O_NONBLOCK
O_RSYNC
O_SYNC
O_ACCMODE
O_RDONLY
O_RDWR
O_WRONLY
struct flock
{
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
}
int creat(in char*, mode_t);
int fcntl(int, int, ...);
int open(in char*, int, ...);
*/
version( CRuntime_Glibc )
{
enum F_DUPFD = 0;
enum F_GETFD = 1;
enum F_SETFD = 2;
enum F_GETFL = 3;
enum F_SETFL = 4;
version(X86_64)
{
static assert(off_t.sizeof == 8);
enum F_GETLK = 5;
enum F_SETLK = 6;
enum F_SETLKW = 7;
}
else
static if( __USE_FILE_OFFSET64 )
{
enum F_GETLK = 12;
enum F_SETLK = 13;
enum F_SETLKW = 14;
}
else
{
enum F_GETLK = 5;
enum F_SETLK = 6;
enum F_SETLKW = 7;
}
enum F_GETOWN = 9;
enum F_SETOWN = 8;
enum FD_CLOEXEC = 1;
enum F_RDLCK = 0;
enum F_UNLCK = 2;
enum F_WRLCK = 1;
version (X86)
{
enum O_CREAT = 0x40; // octal 0100
enum O_EXCL = 0x80; // octal 0200
enum O_NOCTTY = 0x100; // octal 0400
enum O_TRUNC = 0x200; // octal 01000
enum O_APPEND = 0x400; // octal 02000
enum O_NONBLOCK = 0x800; // octal 04000
enum O_SYNC = 0x101000; // octal 04010000
enum O_DSYNC = 0x1000; // octal 010000
enum O_RSYNC = O_SYNC;
}
else version (X86_64)
{
enum O_CREAT = 0x40; // octal 0100
enum O_EXCL = 0x80; // octal 0200
enum O_NOCTTY = 0x100; // octal 0400
enum O_TRUNC = 0x200; // octal 01000
enum O_APPEND = 0x400; // octal 02000
enum O_NONBLOCK = 0x800; // octal 04000
enum O_SYNC = 0x101000; // octal 04010000
enum O_DSYNC = 0x1000; // octal 010000
enum O_RSYNC = O_SYNC;
}
else version (MIPS32)
{
enum O_CREAT = 0x0100;
enum O_EXCL = 0x0400;
enum O_NOCTTY = 0x0800;
enum O_TRUNC = 0x0200;
enum O_APPEND = 0x0008;
enum O_DSYNC = O_SYNC;
enum O_NONBLOCK = 0x0080;
enum O_RSYNC = O_SYNC;
enum O_SYNC = 0x0010;
}
else version (MIPS64)
{
enum O_CREAT = 0x0100;
enum O_EXCL = 0x0400;
enum O_NOCTTY = 0x0800;
enum O_TRUNC = 0x0200;
enum O_APPEND = 0x0008;
enum O_DSYNC = 0x0010;
enum O_NONBLOCK = 0x0080;
enum O_RSYNC = O_SYNC;
enum O_SYNC = 0x4010;
}
else version (PPC)
{
enum O_CREAT = 0x40; // octal 0100
enum O_EXCL = 0x80; // octal 0200
enum O_NOCTTY = 0x100; // octal 0400
enum O_TRUNC = 0x200; // octal 01000
enum O_APPEND = 0x400; // octal 02000
enum O_NONBLOCK = 0x800; // octal 04000
enum O_SYNC = 0x101000; // octal 04010000
enum O_DSYNC = 0x1000; // octal 010000
enum O_RSYNC = O_SYNC;
}
else version (PPC64)
{
enum O_CREAT = 0x40; // octal 0100
enum O_EXCL = 0x80; // octal 0200
enum O_NOCTTY = 0x100; // octal 0400
enum O_TRUNC = 0x200; // octal 01000
enum O_APPEND = 0x400; // octal 02000
enum O_NONBLOCK = 0x800; // octal 04000
enum O_SYNC = 0x101000; // octal 04010000
enum O_DSYNC = 0x1000; // octal 010000
enum O_RSYNC = O_SYNC;
}
else version (ARM)
{
enum O_CREAT = 0x40; // octal 0100
enum O_EXCL = 0x80; // octal 0200
enum O_NOCTTY = 0x100; // octal 0400
enum O_TRUNC = 0x200; // octal 01000
enum O_APPEND = 0x400; // octal 02000
enum O_NONBLOCK = 0x800; // octal 04000
enum O_SYNC = 0x101000; // octal 04010000
enum O_DSYNC = 0x1000; // octal 010000
enum O_RSYNC = O_SYNC;
}
else version (AArch64)
{
enum O_CREAT = 0x40; // octal 0100
enum O_EXCL = 0x80; // octal 0200
enum O_NOCTTY = 0x100; // octal 0400
enum O_TRUNC = 0x200; // octal 01000
enum O_APPEND = 0x400; // octal 02000
enum O_NONBLOCK = 0x800; // octal 04000
enum O_SYNC = 0x101000; // octal 04010000
enum O_DSYNC = 0x1000; // octal 010000
enum O_RSYNC = O_SYNC;
}
else version (SPARC64)
{
enum O_CREAT = 0x200;
enum O_EXCL = 0x800;
enum O_NOCTTY = 0x8000;
enum O_TRUNC = 0x400;
enum O_APPEND = 0x8;
enum O_NONBLOCK = 0x4000;
enum O_SYNC = 0x802000;
enum O_DSYNC = 0x2000;
enum O_RSYNC = O_SYNC;
}
else version (SystemZ)
{
enum O_CREAT = 0x40; // octal 0100
enum O_EXCL = 0x80; // octal 0200
enum O_NOCTTY = 0x100; // octal 0400
enum O_TRUNC = 0x200; // octal 01000
enum O_APPEND = 0x400; // octal 02000
enum O_NONBLOCK = 0x800; // octal 04000
enum O_SYNC = 0x101000; // octal 04010000
enum O_DSYNC = 0x1000; // octal 010000
enum O_RSYNC = O_SYNC;
}
else
static assert(0, "unimplemented");
enum O_ACCMODE = 0x3;
enum O_RDONLY = 0x0;
enum O_WRONLY = 0x1;
enum O_RDWR = 0x2;
struct flock
{
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
}
static if( __USE_FILE_OFFSET64 )
{
int creat64(in char*, mode_t);
alias creat64 creat;
int open64(in char*, int, ...);
alias open64 open;
}
else
{
int creat(in char*, mode_t);
int open(in char*, int, ...);
}
enum AT_SYMLINK_NOFOLLOW = 0x100;
enum AT_FDCWD = -100;
}
else version( Darwin )
{
enum F_DUPFD = 0;
enum F_GETFD = 1;
enum F_SETFD = 2;
enum F_GETFL = 3;
enum F_SETFL = 4;
enum F_GETOWN = 5;
enum F_SETOWN = 6;
enum F_GETLK = 7;
enum F_SETLK = 8;
enum F_SETLKW = 9;
enum FD_CLOEXEC = 1;
enum F_RDLCK = 1;
enum F_UNLCK = 2;
enum F_WRLCK = 3;
enum O_CREAT = 0x0200;
enum O_EXCL = 0x0800;
enum O_NOCTTY = 0;
enum O_TRUNC = 0x0400;
enum O_RDONLY = 0x0000;
enum O_WRONLY = 0x0001;
enum O_RDWR = 0x0002;
enum O_ACCMODE = 0x0003;
enum O_NONBLOCK = 0x0004;
enum O_APPEND = 0x0008;
enum O_SYNC = 0x0080;
//enum O_DSYNC
//enum O_RSYNC
struct flock
{
off_t l_start;
off_t l_len;
pid_t l_pid;
short l_type;
short l_whence;
}
int creat(in char*, mode_t);
int open(in char*, int, ...);
}
else version( FreeBSD )
{
enum F_DUPFD = 0;
enum F_GETFD = 1;
enum F_SETFD = 2;
enum F_GETFL = 3;
enum F_SETFL = 4;
enum F_GETOWN = 5;
enum F_SETOWN = 6;
enum F_GETLK = 11;
enum F_SETLK = 12;
enum F_SETLKW = 13;
enum F_OGETLK = 7;
enum F_OSETLK = 8;
enum F_OSETLKW = 9;
enum F_DUP2FD = 10;
enum FD_CLOEXEC = 1;
enum F_RDLCK = 1;
enum F_UNLCK = 2;
enum F_WRLCK = 3;
enum O_CREAT = 0x0200;
enum O_EXCL = 0x0800;
enum O_NOCTTY = 0x8000;
enum O_TRUNC = 0x0400;
enum O_RDONLY = 0x0000;
enum O_WRONLY = 0x0001;
enum O_RDWR = 0x0002;
enum O_ACCMODE = 0x0003;
enum O_NONBLOCK = 0x0004;
enum O_APPEND = 0x0008;
enum O_SYNC = 0x0080;
//enum O_DSYNC
//enum O_RSYNC
struct flock
{
off_t l_start;
off_t l_len;
pid_t l_pid;
short l_type;
short l_whence;
int l_sysid;
}
struct oflock
{
off_t l_start;
off_t l_len;
pid_t l_pid;
short l_type;
short l_whence;
}
int creat(in char*, mode_t);
int open(in char*, int, ...);
enum AT_SYMLINK_NOFOLLOW = 0x200;
enum AT_FDCWD = -100;
}
else version( OpenBSD )
{
enum F_DUPFD = 0;
enum F_GETFD = 1;
enum F_SETFD = 2;
enum F_GETFL = 3;
enum F_SETFL = 4;
enum F_GETOWN = 5;
enum F_SETOWN = 6;
enum F_GETLK = 7;
enum F_SETLK = 8;
enum F_SETLKW = 9;
enum F_DUPFD_CLOEXEC= 10;
enum F_ISATTY = 11;
enum FD_CLOEXEC = 1;
enum F_RDLCK = 1;
enum F_UNLCK = 2;
enum F_WRLCK = 3;
enum O_CREAT = 0x0200;
enum O_EXCL = 0x0800;
enum O_NOCTTY = 0x8000;
enum O_TRUNC = 0x0400;
enum O_RDONLY = 0x0000;
enum O_WRONLY = 0x0001;
enum O_RDWR = 0x0002;
enum O_ACCMODE = 0x0003;
enum O_SHLOCK = 0x0010;
enum O_EXLOCK = 0x0020;
enum O_ASYNC = 0x0040;
enum O_FSYNC = 0x0080;
enum O_NOFOLLOW = 0x0100;
enum O_NONBLOCK = 0x0004;
enum O_APPEND = 0x0008;
enum O_SYNC = 0x0080;
enum O_DSYNC = O_SYNC;
enum O_RSYNC = O_SYNC;
enum O_CLOEXEC = 0x10000;
enum O_DIRECTORY = 0x20000;
enum LOCK_SH = 0x01;
enum LOCK_EX = 0x02;
enum LOCK_NB = 0x04;
enum LOCK_UN = 0x08;
struct flock
{
off_t l_start;
off_t l_len;
pid_t l_pid;
short l_type;
short l_whence;
}
int creat(in char*, mode_t);
int open(in char*, int, ...);
enum AT_FDCWD = -100;
enum AT_EACCESS = 0x01;
enum AT_SYMLINK_NOFOLLOW = 0x02;
enum AT_SYMLINK_FOLLOW = 0x04;
enum AT_REMOVEDIR = 0x08;
}
else version(NetBSD)
{
enum F_DUPFD = 0;
enum F_GETFD = 1;
enum F_SETFD = 2;
enum F_GETFL = 3;
enum F_SETFL = 4;
enum F_GETOWN = 5;
enum F_SETOWN = 6;
enum F_GETLK = 7;
enum F_SETLK = 8;
enum F_SETLKW = 9;
enum F_CLOSEM = 10;
enum F_MAXFD = 11;
enum F_DUPFD_CLOEXEC= 12;
enum F_GETNOSIGPIPE = 13;
enum F_SETNOSIGPIPE = 14;
enum FD_CLOEXEC = 1;
enum F_RDLCK = 1;
enum F_UNLCK = 2;
enum F_WRLCK = 3;
enum O_CREAT = 0x0200;
enum O_EXCL = 0x0800;
enum O_NOCTTY = 0x8000;
enum O_TRUNC = 0x0400;
enum O_RDONLY = 0x0000;
enum O_WRONLY = 0x0001;
enum O_RDWR = 0x0002;
enum O_ACCMODE = 0x0003;
enum O_NONBLOCK = 0x0004;
enum O_APPEND = 0x0008;
enum O_SYNC = 0x0080;
//enum O_DSYNC
//enum O_RSYNC
struct flock
{
off_t l_start;
off_t l_len;
pid_t l_pid;
short l_type;
short l_whence;
}
int creat(in char*, mode_t);
int open(in char*, int, ...);
}
else version (Solaris)
{
enum F_DUPFD = 0;
enum F_GETFD = 1;
enum F_SETFD = 2;
enum F_GETFL = 3;
enum F_SETFL = 4;
version (D_LP64)
{
enum F_GETLK = 14;
enum F_SETLK = 6;
enum F_SETLKW = 7;
}
else
{
static if (__USE_FILE_OFFSET64)
{
enum F_GETLK = 14;
enum F_SETLK = 6;
enum F_SETLKW = 7;
}
else
{
enum F_GETLK = 33;
enum F_SETLK = 34;
enum F_SETLKW = 35;
}
}
enum F_GETOWN = 23;
enum F_SETOWN = 24;
enum FD_CLOEXEC = 1;
enum F_RDLCK = 1;
enum F_UNLCK = 3;
enum F_WRLCK = 2;
enum F_UNCKSYS = 4;
enum O_CREAT = 0x0100;
enum O_EXCL = 0x0400;
enum O_NOCTTY = 0x0800;
enum O_TRUNC = 0x0200;
enum O_APPEND = 0x0008;
enum O_NONBLOCK = 0x0080;
enum O_SYNC = 0x0010;
enum O_DSYNC = 0x0040;
enum O_RSYNC = 0x8000;
enum O_ACCMODE = (O_SEARCH | O_EXEC | 0x3);
enum O_RDONLY = 0;
enum O_WRONLY = 1;
enum O_RDWR = 2;
enum O_SEARCH = 0x200000;
enum O_EXEC = 0x400000;
struct flock
{
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
int l_sysid;
pid_t l_pid;
c_long[4] l_pad;
}
static if (__USE_LARGEFILE64)
{
struct flock64
{
short l_type;
short l_whence;
off64_t l_start;
off64_t l_len;
int l_sysid;
pid_t l_pid;
c_long[4] l_pad;
}
}
version (D_LP64)
{
int creat(in char*, mode_t);
int open(in char*, int, ...);
static if (__USE_LARGEFILE64)
{
alias creat creat64;
alias open open64;
}
}
else
{
static if (__USE_LARGEFILE64)
{
int creat64(in char*, mode_t);
alias creat64 creat;
int open64(in char*, int, ...);
alias open64 open;
}
else
{
int creat(in char*, mode_t);
int open(in char*, int, ...);
}
}
}
else version( CRuntime_Bionic )
{
// All these except for the two functions open and creat really come from
// the linux kernel and can probably be merged.
enum F_DUPFD = 0;
enum F_GETFD = 1;
enum F_SETFD = 2;
enum F_GETFL = 3;
enum F_SETFL = 4;
enum F_GETLK = 5;
enum F_SETLK = 6;
enum F_SETLKW = 7;
enum F_SETOWN = 8;
enum F_GETOWN = 9;
enum FD_CLOEXEC = 1;
enum F_RDLCK = 0;
enum F_WRLCK = 1;
enum F_UNLCK = 2;
version (X86)
{
enum O_CREAT = 0x40; // octal 0100
enum O_EXCL = 0x80; // octal 0200
enum O_NOCTTY = 0x100; // octal 0400
enum O_TRUNC = 0x200; // octal 01000
enum O_APPEND = 0x400; // octal 02000
enum O_NONBLOCK = 0x800; // octal 04000
enum O_SYNC = 0x1000; // octal 010000
}
else version (ARM)
{
enum O_CREAT = 0x40; // octal 0100
enum O_EXCL = 0x80; // octal 0200
enum O_NOCTTY = 0x100; // octal 0400
enum O_TRUNC = 0x200; // octal 01000
enum O_APPEND = 0x400; // octal 02000
enum O_NONBLOCK = 0x800; // octal 04000
enum O_SYNC = 0x1000; // octal 010000
}
else
{
static assert(false, "Architecture not supported.");
}
enum O_ACCMODE = 0x3;
enum O_RDONLY = 0x0;
enum O_WRONLY = 0x1;
enum O_RDWR = 0x2;
struct flock
{
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
}
int creat(in char*, mode_t);
int open(in char*, int, ...);
enum AT_FDCWD = -100;
}
else
{
static assert(false, "Unsupported platform");
}
//int creat(in char*, mode_t);
int fcntl(int, int, ...);
//int open(in char*, int, ...);
// Generic Posix fallocate
int posix_fallocate(int, off_t, off_t);
//
// Advisory Information (ADV)
//
/*
POSIX_FADV_NORMAL
POSIX_FADV_SEQUENTIAL
POSIX_FADV_RANDOM
POSIX_FADV_WILLNEED
POSIX_FADV_DONTNEED
POSIX_FADV_NOREUSE
int posix_fadvise(int, off_t, off_t, int);
*/
|
D
|
/Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/Build/Intermediates/SpriteKitTest.build/Debug-iphoneos/SpriteKitTest.build/Objects-normal/arm64/Scene.o : /Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/SpriteKitTest/Scene.swift /Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/SpriteKitTest/AppDelegate.swift /Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/SpriteKitTest/ViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ModelIO.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/simd.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/GLKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ARKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SceneKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SpriteKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/ModelIO.framework/Headers/ModelIO.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/GLKit.framework/Headers/GLKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/SceneKit.framework/Headers/SceneKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/SpriteKit.framework/Headers/SpriteKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes
/Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/Build/Intermediates/SpriteKitTest.build/Debug-iphoneos/SpriteKitTest.build/Objects-normal/arm64/Scene~partial.swiftmodule : /Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/SpriteKitTest/Scene.swift /Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/SpriteKitTest/AppDelegate.swift /Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/SpriteKitTest/ViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ModelIO.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/simd.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/GLKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ARKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SceneKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SpriteKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/ModelIO.framework/Headers/ModelIO.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/GLKit.framework/Headers/GLKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/SceneKit.framework/Headers/SceneKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/SpriteKit.framework/Headers/SpriteKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes
/Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/Build/Intermediates/SpriteKitTest.build/Debug-iphoneos/SpriteKitTest.build/Objects-normal/arm64/Scene~partial.swiftdoc : /Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/SpriteKitTest/Scene.swift /Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/SpriteKitTest/AppDelegate.swift /Users/songzhang/Documents/ZXS/ZXSGit/ARKit/SpriteKitTest/SpriteKitTest/ViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ModelIO.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/simd.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/GLKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ARKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SceneKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SpriteKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/ModelIO.framework/Headers/ModelIO.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/GLKit.framework/Headers/GLKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/SceneKit.framework/Headers/SceneKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/SpriteKit.framework/Headers/SpriteKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes
|
D
|
/Users/mordi/Desktop/xCode/MissMystique/Build/Intermediates/MissMystique.build/Debug-iphoneos/MissMystique.build/Objects-normal/arm64/Infoarray.o : /Users/mordi/Desktop/xCode/MissMystique/MissMystique/Infoarray.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/scanViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/ViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/addViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/readViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Photos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreLocation.swiftmodule
/Users/mordi/Desktop/xCode/MissMystique/Build/Intermediates/MissMystique.build/Debug-iphoneos/MissMystique.build/Objects-normal/arm64/Infoarray~partial.swiftmodule : /Users/mordi/Desktop/xCode/MissMystique/MissMystique/Infoarray.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/scanViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/ViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/addViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/readViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Photos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreLocation.swiftmodule
/Users/mordi/Desktop/xCode/MissMystique/Build/Intermediates/MissMystique.build/Debug-iphoneos/MissMystique.build/Objects-normal/arm64/Infoarray~partial.swiftdoc : /Users/mordi/Desktop/xCode/MissMystique/MissMystique/Infoarray.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/scanViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/ViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/addViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/readViewController.swift /Users/mordi/Desktop/xCode/MissMystique/MissMystique/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Photos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreLocation.swiftmodule
|
D
|
module htestmain;
import std.stdio;
import std.string;
import std.conv;
import hibernated.core;
import std.traits;
// Annotations of entity classes
@Table( "gebruiker" )
class User {
long id;
string name;
int some_field_with_underscore;
@ManyToMany // cannot be inferred, requires annotation
LazyCollection!Role roles;
//@ManyToOne
MyGroup group;
override string toString() {
return format("{id:%s, name:%s, roles:%s, group:%s}", id, name, roles, group);
}
}
class Role {
int id;
string name;
@ManyToMany // w/o this annotation will be OneToMany by convention
LazyCollection!User users;
override string toString() {
return format("{id:%s, name:%s}", id, name);
}
}
@Entity
class MyGroup {
long id;
string name;
@OneToMany
LazyCollection!User users;
override string toString() {
return format("{id:%s, name:%s}", id, name);
}
}
void testHibernate() {
// setup DB connection
version( USE_SQLITE )
{
import ddbc.drivers.sqliteddbc;
SQLITEDriver driver = new SQLITEDriver();
string[string] params;
DataSource ds = new ConnectionPoolDataSourceImpl(driver, "zzz.db", params);
Dialect dialect = new SQLiteDialect();
}
else version( USE_PGSQL )
{
import ddbc.drivers.pgsqlddbc;
string url = PGSQLDriver.generateUrl( "/tmp", 5432, "testdb" );
string[string] params;
params["user"] = "hdtest";
params["password"] = "secret";
params["ssl"] = "true";
PGSQLDriver driver = new PGSQLDriver();
DataSource ds = new ConnectionPoolDataSourceImpl(driver,url, params);
Dialect dialect = new PGSQLDialect();
}
// create metadata from annotations
writeln("Creating schema from class list");
EntityMetaData schema = new SchemaInfoImpl!(User, Role, MyGroup);
//writeln("Creating schema from module list");
//EntityMetaData schema2 = new SchemaInfoImpl!(htestmain);
writeln("Creating session factory");
// create session factory
SessionFactory factory = new SessionFactoryImpl(schema, dialect, ds);
scope(exit) factory.close();
writeln("Creating DB schema");
DBInfo db = factory.getDBMetaData();
{
Connection conn = ds.getConnection();
scope(exit) conn.close();
db.updateDBSchema(conn, true, true);
}
// create session
Session sess = factory.openSession();
scope(exit) sess.close();
// use session to access DB
writeln("Querying empty DB");
Query q = sess.createQuery("FROM User ORDER BY name");
User[] list = q.list!User();
writeln("Result size is " ~ to!string(list.length));
// create sample data
writeln("Creating sample schema");
MyGroup grp1 = new MyGroup();
grp1.name = "Group-1";
MyGroup grp2 = new MyGroup();
grp2.name = "Group-2";
MyGroup grp3 = new MyGroup();
grp3.name = "Group-3";
//
Role r10 = new Role();
r10.name = "role10";
Role r11 = new Role();
r11.name = "role11";
//
User u10 = new User();
u10.name = "Alex";
u10.roles = [r10, r11];
u10.group = grp3;
User u12 = new User();
u12.name = "Arjan";
u12.roles = [r10, r11];
u12.group = grp2;
User u13 = new User();
u13.name = "Wessel";
u13.roles = [r10, r11];
u13.group = grp2;
writeln("saving group 1-2-3" );
sess.save( grp1 );
sess.save( grp2 );
sess.save( grp3 );
writeln("Saving r10");
sess.save(r10);
writeln("Saving r11");
sess.save(r11);
writeln("Saving u10");
sess.save(u10);
writeln("Saving u12");
sess.save(u12);
writeln("Saving u13");
sess.save(u13);
writeln("Loading User");
// load and check data
auto qresult = sess.createQuery("FROM User WHERE name=:Name and some_field_with_underscore != 42").setParameter("Name", "Alex");
writefln( "query result: %s", qresult.listRows() );
User u11 = qresult.uniqueResult!User();
//User u11 = sess.createQuery("FROM User WHERE name=:Name and some_field_with_underscore != 42").setParameter("Name", "Alex").uniqueResult!User();
writefln("Checking User 11 : %s", u11);
assert(u11.roles.length == 2);
assert(u11.roles[0].name == "role10" || u11.roles.get()[0].name == "role11");
assert(u11.roles[1].name == "role10" || u11.roles.get()[1].name == "role11");
assert(u11.roles[0].users.length == 3);
assert(u11.roles[0].users[0] == u10);
writeln("Test retrieving users by group... (ManyToOne relationship)");
auto qUsersByGroup = sess.createQuery("FROM User WHERE group=:group_id").setParameter("group_id", grp2.id);
User[] usersByGroup = qUsersByGroup.list!User();
assert(usersByGroup.length == 2); // user 2 and user 2
//writeln("Removing User");
// remove reference
//std.algorithm.remove(u11.roles.get(), 0);
//sess.update(u11);
// remove entity
//sess.remove(u11);
}
void main()
{
testHibernate();
}
|
D
|
/*******************************************************************************
Contains checksum tests.
Copyright:
Copyright (c) 2019-2021 BOSAGORA Foundation
All rights reserved.
License:
MIT License. See LICENSE for details.
*******************************************************************************/
module unit.BlockStorageChecksum;
import agora.common.Types;
import agora.consensus.BlockStorage;
import agora.consensus.data.Block;
import agora.consensus.data.Transaction;
import agora.consensus.data.genesis.Test;
import agora.utils.Test;
import std.file;
import std.exception;
import std.path;
import std.stdio;
/// blocks to write
const size_t BlockCount = 300;
///
private void main ()
{
auto path = makeCleanTempDir();
writeBlocks(path);
corruptBlocks(path);
BlockStorage storage = new BlockStorage(path);
scope (exit) storage.release();
// Checksum detection test
assertThrown!Exception(storage.readBlock(Height(0)));
}
/// Write the block data to disk
private void writeBlocks (string path)
{
BlockStorage.removeIndexFile(path);
BlockStorage storage = new BlockStorage(path);
const(Block)[] blocks;
blocks ~= GenesisBlock;
foreach (block_idx; 0 .. BlockCount)
{
Transaction[8] txs;
const h = Height(block_idx + 1);
auto preimages = WK.PreImages.at(h, genesis_validator_keys);
auto block = makeNewBlock(blocks[$ - 1], txs[], preimages);
storage.saveBlock(block);
blocks ~= block;
}
storage.release();
}
/// Corrupt the block data on disk
private void corruptBlocks (string dir_path)
{
foreach (string path; dirEntries(dir_path, SpanMode.shallow))
{
assert(path.isFile);
auto block_file = File(path, "r+b");
block_file.seek(ChecksumSize + 1, SEEK_SET);
ubyte[1] bytes;
block_file.rawRead(bytes);
// write a modified byte
bytes[0]++;
block_file.seek(ChecksumSize + 1, SEEK_SET);
block_file.rawWrite(bytes);
}
}
|
D
|
module org.serviio.upnp.service.contentdirectory.classes.MusicTrack;
import java.lang.String;
import java.lang.Integer;
import org.serviio.upnp.service.contentdirectory.classes.AudioItem;
import org.serviio.upnp.service.contentdirectory.classes.ObjectClassType;
public class MusicTrack : AudioItem
{
protected String[] artist;
protected String album;
protected Integer originalTrackNumber;
protected String playlist;
protected String storageMedium;
protected String[] contributor;
protected String date;
public this(String id, String title)
{
super(id, title);
}
override public ObjectClassType getObjectClass()
{
return ObjectClassType.MUSIC_TRACK;
}
public String[] getArtist()
{
return artist;
}
public void setArtist(String[] artist) {
this.artist = artist;
}
public String getAlbum() {
return album;
}
public void setAlbum(String album) {
this.album = album;
}
public Integer getOriginalTrackNumber() {
return originalTrackNumber;
}
public void setOriginalTrackNumber(Integer originalTrackNumber) {
this.originalTrackNumber = originalTrackNumber;
}
public String getPlaylist() {
return playlist;
}
public void setPlaylist(String playlist) {
this.playlist = playlist;
}
public String getStorageMedium() {
return storageMedium;
}
public void setStorageMedium(String storageMedium) {
this.storageMedium = storageMedium;
}
public String[] getContributor() {
return contributor;
}
public void setContributor(String[] contributor) {
this.contributor = contributor;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
}
/* Location: D:\Program Files\Serviio\lib\serviio.jar
* Qualified Name: org.serviio.upnp.service.contentdirectory.classes.MusicTrack
* JD-Core Version: 0.6.2
*/
|
D
|
// Generated by gnome-h2d.rb <http://github.com/ddude/gnome.d>.
module gio.dbusinterface;
/* GDBus - GLib D-Bus Library
*
* Copyright (C) 2008-2010 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: David Zeuthen <davidz@redhat.com>
*/
public import gio.types;
extern(C):
//#define G_TYPE_DBUS_INTERFACE (g_dbus_interface_get_type())
//#define G_DBUS_INTERFACE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_INTERFACE, GDBusInterface))
//#define G_IS_DBUS_INTERFACE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_INTERFACE))
//#define G_DBUS_INTERFACE_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), G_TYPE_DBUS_INTERFACE, GDBusInterfaceIface))
/**
* GDBusInterface:
*
* Base type for D-Bus interfaces.
*
* Since: 2.30
*/
//struct _GDBusInterfaceIface GDBusInterfaceIface;
/**
* GDBusInterfaceIface:
* @parent_iface: The parent interface.
* @get_info: Returns a #GDBusInterfaceInfo. See g_dbus_interface_get_info().
* @get_object: Gets the enclosing #GDBusObject. See g_dbus_interface_get_object().
* @set_object: Sets the enclosing #GDBusObject. See g_dbus_interface_set_object().
* @dup_object: Gets a reference to the enclosing #GDBusObject. See g_dbus_interface_dup_object(). Added in 2.32.
*
* Base type for D-Bus interfaces.
*
* Since: 2.30
*/
struct GDBusInterfaceIface {
GTypeInterface parent_iface;
/* Virtual Functions */
GDBusInterfaceInfo *function(GDBusInterface *interface_) get_info;
GDBusObject *function(GDBusInterface *interface_) get_object;
void function(GDBusInterface *interface_,
GDBusObject *object) set_object;
GDBusObject *function(GDBusInterface *interface_) dup_object;
};
GType g_dbus_interface_get_type () pure;
GDBusInterfaceInfo *g_dbus_interface_get_info (GDBusInterface *interface_);
GDBusObject *g_dbus_interface_get_object (GDBusInterface *interface_);
void g_dbus_interface_set_object (GDBusInterface *interface_,
GDBusObject *object);
/+ GLIB_AVAILABLE_IN_2_32 +/
GDBusObject *g_dbus_interface_dup_object (GDBusInterface *interface_);
|
D
|
module android.java.android.content.pm.LabeledIntent;
public import android.java.android.content.pm.LabeledIntent_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!LabeledIntent;
import import11 = android.java.android.content.ClipData;
import import17 = android.java.android.graphics.Rect;
import import15 = android.java.java.io.Serializable;
import import7 = android.java.android.net.Uri;
import import18 = android.java.android.content.pm.ActivityInfo;
import import10 = android.java.java.util.Set;
import import3 = android.java.android.graphics.drawable.Drawable;
import import16 = android.java.android.os.Bundle;
import import14 = android.java.java.util.ArrayList;
import import13 = android.java.android.os.Parcelable;
|
D
|
module arrow.StringArrayBuilder;
private import arrow.BinaryArrayBuilder;
private import arrow.c.functions;
public import arrow.c.types;
private import glib.ConstructionException;
private import glib.ErrorG;
private import glib.GException;
private import glib.Str;
private import gobject.ObjectG;
/** */
public class StringArrayBuilder : BinaryArrayBuilder
{
/** the main Gtk struct */
protected GArrowStringArrayBuilder* gArrowStringArrayBuilder;
/** Get the main Gtk struct */
public GArrowStringArrayBuilder* getStringArrayBuilderStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gArrowStringArrayBuilder;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gArrowStringArrayBuilder;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GArrowStringArrayBuilder* gArrowStringArrayBuilder, bool ownedRef = false)
{
this.gArrowStringArrayBuilder = gArrowStringArrayBuilder;
super(cast(GArrowBinaryArrayBuilder*)gArrowStringArrayBuilder, ownedRef);
}
/** */
public static GType getType()
{
return garrow_string_array_builder_get_type();
}
/**
* Returns: A newly created #GArrowStringArrayBuilder.
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this()
{
auto p = garrow_string_array_builder_new();
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GArrowStringArrayBuilder*) p, true);
}
/**
*
*
* Deprecated: Use garrow_string_array_builder_append_value() instead.
*
* Params:
* value = A string value.
*
* Returns: %TRUE on success, %FALSE if there was an error.
*
* Throws: GException on failure.
*/
public bool append(string value)
{
GError* err = null;
auto p = garrow_string_array_builder_append(gArrowStringArrayBuilder, Str.toStringz(value), &err) != 0;
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
return p;
}
/**
*
* Params:
* value = A string value.
* Returns: %TRUE on success, %FALSE if there was an error.
*
* Since: 0.12.0
*
* Throws: GException on failure.
*/
public bool appendValue(string value)
{
GError* err = null;
auto p = garrow_string_array_builder_append_value(gArrowStringArrayBuilder, Str.toStringz(value), &err) != 0;
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
return p;
}
/**
* Append multiple values at once. It's more efficient than multiple
* `append()` and `append_null()` calls.
*
* Params:
* values = The array of
* strings.
* isValids = The array of
* boolean that shows whether the Nth value is valid or not. If the
* Nth `is_valids` is %TRUE, the Nth `values` is valid value. Otherwise
* the Nth value is null value.
*
* Returns: %TRUE on success, %FALSE if there was an error.
*
* Since: 0.10.0
*
* Throws: GException on failure.
*/
public bool appendValues(string[] values, bool[] isValids)
{
int[] isValidsArray = new int[isValids.length];
for ( int i = 0; i < isValids.length; i++ )
{
isValidsArray[i] = isValids[i] ? 1 : 0;
}
GError* err = null;
auto p = garrow_string_array_builder_append_values(gArrowStringArrayBuilder, Str.toStringzArray(values), cast(long)values.length, isValidsArray.ptr, cast(long)isValids.length, &err) != 0;
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
return p;
}
}
|
D
|
instance ORG_889_CoErpresser (Npc_Default)
{
//-------- primary data --------
name = "Co Erpresser";
Npctype = Npctype_Ambient;
guild = GIL_SLV;
level = 11;
voice = 7;
id = 889;
//-------- abilities --------
attribute[ATR_STRENGTH] = 50;
attribute[ATR_DEXTERITY] = 30;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
attribute[ATR_HITPOINTS_MAX] = 172;
attribute[ATR_HITPOINTS] = 172;
//-------- visuals --------
// animations
Mdl_SetVisual (self,"HUMANS.MDS");
Mdl_ApplyOverlayMds (self,"Humans_Relaxed.mds");
// body mesh,head mesh,hairmesh,face-tex,hair-tex,skin
Mdl_SetVisualBody (self,"hum_body_Naked0",0,2,"Hum_Head_Pony",8,1,ORG_ARMOR_M);
B_Scale (self);
Mdl_SetModelFatness (self,0);
fight_tactic = FAI_HUMAN_STRONG;
//-------- Talente --------
Npc_SetTalentSkill (self,NPC_TALENT_BOW,1);
Npc_SetTalentSkill (self,NPC_TALENT_2H,1);
Npc_SetTalentSkill (self,NPC_TALENT_1H,1);
//-------- inventory --------
CreateInvItems (self,ItKeLockpick,1);
CreateInvItems(self,ItMiNugget,12);
CreateInvItems (self,ItFoRice,7);
CreateInvItems (self,ItFoBooze,5);
CreateInvItems (self,ItLsTorch,1);
CreateInvItems (self,ItFo_Potion_Health_01,2);
CreateInvItem (self,ItMi_Stuff_Barbknife_01);
CreateInvItem (self,ItFoLoaf);
CreateInvItem (self,ItAt_Teeth_01);
EquipItem (self,MTR_MW_01);
EquipItem (self,ItRw_Bow_Long_01);
CreateInvItems (self,ItAmArrow,20);
//-------------Daily Routine-------------
//start_aistate = ZS_Erpresser;
};
|
D
|
/***********************************************************************\
* exdispid.d *
* *
* Windows API header module *
* *
* Translated from MinGW API for MS-Windows 3.10 *
* by Stewart Gordon *
* *
* Placed into public domain *
\***********************************************************************/
module windows.exdispid;
nothrow:
enum : int {
DISPID_STATUSTEXTCHANGE = 102,
DISPID_PROGRESSCHANGE = 108,
DISPID_TITLECHANGE = 113,
DISPID_BEFORENAVIGATE2 = 250,
DISPID_NEWWINDOW2 = 251,
DISPID_DOCUMENTCOMPLETE = 259
}
|
D
|
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Port to the D programming language:
* Frank Benoit <benoit@tionex.de>
*******************************************************************************/
module org.eclipse.swt.graphics.Device;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.internal.gdip.Gdip;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Path;
import org.eclipse.swt.graphics.Pattern;
import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.graphics.TextLayout;
import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.graphics.Drawable;
import org.eclipse.swt.graphics.DeviceData;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GCData;
import org.eclipse.swt.graphics.Color;
import java.lang.Runnable;
import java.lang.System;
import java.lang.all;
/**
* This class is the abstract superclass of all device objects,
* such as the Display device and the Printer device. Devices
* can have a graphics context (GC) created for them, and they
* can be drawn on by sending messages to the associated GC.
*
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
*/
public abstract class Device : Drawable {
private struct CallbackData {
Device device;
bool scalable;
}
/* Debugging */
public static bool DEBUG = true;
bool debug_;
bool tracking;
Exception [] errors;
Object [] objects;
Object trackingLock;
/**
* Palette
* (Warning: This field is platform dependent)
* <p>
* <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
* public API. It is marked public only so that it can be shared
* within the packages provided by SWT. It is not available on all
* platforms and should never be accessed from application code.
* </p>
*/
public HPALETTE hPalette;
int [] colorRefCount;
/* System Font */
Font systemFont;
/* Font Enumeration */
int nFonts = 256;
LOGFONT* [] logFonts;
TEXTMETRIC metrics;
int[] pixels;
/* Scripts */
SCRIPT_PROPERTIES*[] scripts;
/* Advanced Graphics */
ULONG_PTR gdipToken;
bool disposed;
/*
* TEMPORARY CODE. When a graphics object is
* created and the device parameter is null,
* the current Display is used. This presents
* a problem because SWT graphics does not
* reference classes in SWT widgets. The correct
* fix is to remove this feature. Unfortunately,
* too many application programs rely on this
* feature.
*
* This code will be removed in the future.
*/
mixin(gshared!(`protected static Device CurrentDevice;`));
mixin(gshared!(`protected static Runnable DeviceFinder;`));
/*
* TEMPORARY CODE.
*/
static Device getDevice () {
synchronized {
if (DeviceFinder !is null) DeviceFinder.run();
Device device = CurrentDevice;
CurrentDevice = null;
return device;
}
}
/**
* Constructs a new instance of this class.
* <p>
* You must dispose the device when it is no longer required.
* </p>
*
* @see #create
* @see #init
*
* @since 3.1
*/
public this() {
this(null);
}
/**
* Constructs a new instance of this class.
* <p>
* You must dispose the device when it is no longer required.
* </p>
*
* @param data the DeviceData which describes the receiver
*
* @see #create
* @see #init
* @see DeviceData
*/
public this(DeviceData data) {
synchronized (Device.classinfo) {
debug_ = DEBUG;
tracking = DEBUG;
if (data !is null) {
debug_ = data.debug_;
tracking = data.tracking;
}
if (tracking) {
errors = new Exception [128];
objects = new Object [128];
trackingLock = new Object ();
}
create (data);
init_ ();
gdipToken = 0;
}
}
/**
* Throws an <code>SWTException</code> if the receiver can not
* be accessed by the caller. This may include both checks on
* the state of the receiver and more generally on the entire
* execution context. This method <em>should</em> be called by
* device implementors to enforce the standard SWT invariants.
* <p>
* Currently, it is an error to invoke any method (other than
* <code>isDisposed()</code> and <code>dispose()</code>) on a
* device that has had its <code>dispose()</code> method called.
* </p><p>
* In future releases of SWT, there may be more or fewer error
* checks and exceptions may be thrown for different reasons.
* <p>
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
protected void checkDevice () {
if (disposed) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
}
void checkGDIP() {
if (gdipToken) return;
int oldErrorMode = 0;
static if (!OS.IsWinCE) oldErrorMode = OS.SetErrorMode (OS.SEM_FAILCRITICALERRORS);
try {
ULONG_PTR token;
GdiplusStartupInput input;
input.GdiplusVersion = 1;
if (Gdip.GdiplusStartup ( &token, &input, null ) is 0) {
gdipToken = token;
}
} catch (Exception t) {
SWT.error (SWT.ERROR_NO_GRAPHICS_LIBRARY, t, " [GDI+ is required]"); //$NON-NLS-1$
} finally {
if (!OS.IsWinCE) OS.SetErrorMode (oldErrorMode);
}
}
/**
* Creates the device in the operating system. If the device
* does not have a handle, this method may do nothing depending
* on the device.
* <p>
* This method is called before <code>init</code>.
* </p><p>
* Subclasses are supposed to reimplement this method and not
* call the <code>super</code> implementation.
* </p>
*
* @param data the DeviceData which describes the receiver
*
* @see #init
*/
protected void create (DeviceData data) {
}
int computePixels(float height) {
auto hDC = internal_new_GC (null);
int pixels = -cast(int)(0.5f + (height * OS.GetDeviceCaps(hDC, OS.LOGPIXELSY) / 72f));
internal_dispose_GC (hDC, null);
return pixels;
}
float computePoints(LOGFONT* logFont, HFONT hFont) {
auto hDC = internal_new_GC (null);
int logPixelsY = OS.GetDeviceCaps(hDC, OS.LOGPIXELSY);
int pixels = 0;
if (logFont.lfHeight > 0) {
/*
* Feature in Windows. If the lfHeight of the LOGFONT structure
* is positive, the lfHeight measures the height of the entire
* cell, including internal leading, in logical units. Since the
* height of a font in points does not include the internal leading,
* we must subtract the internal leading, which requires a TEXTMETRIC.
*/
auto oldFont = OS.SelectObject(hDC, hFont);
TEXTMETRIC* lptm = new TEXTMETRIC();
OS.GetTextMetrics(hDC, lptm);
OS.SelectObject(hDC, oldFont);
pixels = logFont.lfHeight - lptm.tmInternalLeading;
} else {
pixels = -logFont.lfHeight;
}
internal_dispose_GC (hDC, null);
return pixels * 72f / logPixelsY;
}
/**
* Destroys the device in the operating system and releases
* the device's handle. If the device does not have a handle,
* this method may do nothing depending on the device.
* <p>
* This method is called after <code>release</code>.
* </p><p>
* Subclasses are supposed to reimplement this method and not
* call the <code>super</code> implementation.
* </p>
*
* @see #dispose
* @see #release
*/
protected void destroy () {
}
/**
* Disposes of the operating system resources associated with
* the receiver. After this method has been invoked, the receiver
* will answer <code>true</code> when sent the message
* <code>isDisposed()</code>.
*
* @see #release
* @see #destroy
* @see #checkDevice
*/
public void dispose () {
synchronized (Device.classinfo) {
if (isDisposed()) return;
checkDevice ();
release ();
destroy ();
disposed = true;
if (tracking) {
synchronized (trackingLock) {
printErrors ();
objects = null;
errors = null;
trackingLock = null;
}
}
}
}
void dispose_Object (Object object) {
synchronized (trackingLock) {
for (int i=0; i<objects.length; i++) {
if (objects [i] is object) {
objects [i] = null;
errors [i] = null;
return;
}
}
}
}
static extern(Windows) int EnumFontFamFunc (ENUMLOGFONT* lpelfe, NEWTEXTMETRIC* lpntme, int FontType, int lParam) {
auto cbdata = cast(CallbackData*)lParam;
return cbdata.device.EnumFontFamProc( lpelfe, lpntme, FontType, cbdata.scalable );
}
int EnumFontFamProc (ENUMLOGFONT* lpelfe, NEWTEXTMETRIC* lpntme, DWORD FontType, bool scalable) {
bool isScalable = (FontType & OS.RASTER_FONTTYPE) is 0;
if (isScalable is scalable) {
/* Add the log font to the list of log fonts */
if (nFonts is logFonts.length) {
LOGFONT* [] newLogFonts = new LOGFONT* [logFonts.length + 128];
SimpleType!(LOGFONT*).arraycopy (logFonts, 0, newLogFonts, 0, nFonts);
logFonts = newLogFonts;
int[] newPixels = new int[newLogFonts.length];
System.arraycopy (pixels, 0, newPixels, 0, nFonts);
pixels = newPixels;
}
LOGFONT* logFont = logFonts [nFonts];
if (logFont is null) logFont = new LOGFONT ();
*logFont = *cast(LOGFONT*)lpelfe;
logFonts [nFonts] = logFont;
if (logFont.lfHeight > 0) {
/*
* Feature in Windows. If the lfHeight of the LOGFONT structure
* is positive, the lfHeight measures the height of the entire
* cell, including internal leading, in logical units. Since the
* height of a font in points does not include the internal leading,
* we must subtract the internal leading, which requires a TEXTMETRIC,
* which in turn requires font creation.
*/
metrics = *cast(TEXTMETRIC*)lpntme;
pixels[nFonts] = logFont.lfHeight - metrics.tmInternalLeading;
} else {
pixels[nFonts] = -logFont.lfHeight;
}
nFonts++;
}
return 1;
}
/**
* Returns a rectangle describing the receiver's size and location.
*
* @return the bounding rectangle
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public Rectangle getBounds () {
checkDevice ();
auto hDC = internal_new_GC (null);
int width = OS.GetDeviceCaps (hDC, OS.HORZRES);
int height = OS.GetDeviceCaps (hDC, OS.VERTRES);
internal_dispose_GC (hDC, null);
return new Rectangle (0, 0, width, height);
}
/**
* Returns a <code>DeviceData</code> based on the receiver.
* Modifications made to this <code>DeviceData</code> will not
* affect the receiver.
*
* @return a <code>DeviceData</code> containing the device's data and attributes
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*
* @see DeviceData
*/
public DeviceData getDeviceData () {
checkDevice();
DeviceData data = new DeviceData ();
data.debug_ = debug_;
data.tracking = tracking;
if (tracking) {
synchronized (trackingLock) {
int count = 0, length = cast(int) objects.length;
for (int i=0; i<length; i++) {
if (objects [i] !is null) count++;
}
int index = 0;
data.objects = new Object [count];
data.errors = new Exception [count];
for (int i=0; i<length; i++) {
if (objects [i] !is null) {
data.objects [index] = objects [i];
data.errors [index] = errors [i];
index++;
}
}
}
} else {
data.objects = new Object [0];
data.errors = new Exception [0];
}
return data;
}
/**
* Returns a rectangle which describes the area of the
* receiver which is capable of displaying data.
*
* @return the client area
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*
* @see #getBounds
*/
public Rectangle getClientArea () {
return getBounds ();
}
/**
* Returns the bit depth of the screen, which is the number of
* bits it takes to represent the number of unique colors that
* the screen is currently capable of displaying. This number
* will typically be one of 1, 8, 15, 16, 24 or 32.
*
* @return the depth of the screen
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public int getDepth () {
checkDevice ();
auto hDC = internal_new_GC (null);
int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
internal_dispose_GC (hDC, null);
return bits * planes;
}
/**
* Returns a point whose x coordinate is the horizontal
* dots per inch of the display, and whose y coordinate
* is the vertical dots per inch of the display.
*
* @return the horizontal and vertical DPI
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public Point getDPI () {
checkDevice ();
auto hDC = internal_new_GC (null);
int dpiX = OS.GetDeviceCaps (hDC, OS.LOGPIXELSX);
int dpiY = OS.GetDeviceCaps (hDC, OS.LOGPIXELSY);
internal_dispose_GC (hDC, null);
return new Point (dpiX, dpiY);
}
/**
* Returns <code>FontData</code> objects which describe
* the fonts that match the given arguments. If the
* <code>faceName</code> is null, all fonts will be returned.
*
* @param faceName the name of the font to look for, or null
* @param scalable if true only scalable fonts are returned, otherwise only non-scalable fonts are returned.
* @return the matching font data
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public FontData [] getFontList (String faceName, bool scalable) {
checkDevice ();
/* Create the callback */
CallbackData cbdata;
cbdata.device = this;
/* Initialize the instance variables */
metrics = TEXTMETRIC.init;
pixels = new int[nFonts];
logFonts = new LOGFONT* [nFonts];
for (int i=0; i<logFonts.length; i++) {
logFonts [i] = new LOGFONT();
}
nFonts = 0;
/* Enumerate */
int offset = 0;
auto hDC = internal_new_GC (null);
if (faceName is null) {
/* The user did not specify a face name, so they want all versions of all available face names */
cbdata.scalable = scalable;
OS.EnumFontFamilies (hDC, null, &EnumFontFamFunc, cast(int)&cbdata );
/**
* For bitmapped fonts, EnumFontFamilies only enumerates once for each font, regardless
* of how many styles are available. If the user wants bitmapped fonts, enumerate on
* each face name now.
*/
offset = nFonts;
for (int i=0; i<offset; i++) {
LOGFONT* lf = logFonts [i];
/**
* Bug in Windows 98. When EnumFontFamiliesEx is called with a specified face name, it
* should enumerate for each available style of that font. Instead, it only enumerates
* once. The fix is to call EnumFontFamilies, which works as expected.
*/
cbdata.scalable = scalable;
static if (OS.IsUnicode) {
OS.EnumFontFamiliesW (hDC, (cast(LOGFONTW*)lf).lfFaceName.ptr, &EnumFontFamFunc, cast(int)&cbdata);
} else {
OS.EnumFontFamiliesA (hDC, (cast(LOGFONTA*)lf).lfFaceName.ptr, &EnumFontFamFunc, cast(int)&cbdata);
}
}
} else {
/* Use the character encoding for the default locale */
/**
* Bug in Windows 98. When EnumFontFamiliesEx is called with a specified face name, it
* should enumerate for each available style of that font. Instead, it only enumerates
* once. The fix is to call EnumFontFamilies, which works as expected.
*/
cbdata.scalable = scalable;
OS.EnumFontFamilies (hDC, .StrToTCHARz(faceName), &EnumFontFamFunc, cast(int)&cbdata);
}
int logPixelsY = OS.GetDeviceCaps(hDC, OS.LOGPIXELSY);
internal_dispose_GC (hDC, null);
/* Create the fontData from the logfonts */
int count = 0;
FontData [] result = new FontData [nFonts - offset];
for (int i=offset; i<nFonts; i++) {
FontData fd = FontData.win32_new (logFonts [i], pixels [i] * 72f / logPixelsY);
int j;
for (j = 0; j < count; j++) {
if (fd == result [j]) break;
}
if (j is count) result [count++] = fd;
}
if (count !is result.length) {
FontData [] newResult = new FontData [count];
System.arraycopy (result, 0, newResult, 0, count);
result = newResult;
}
/* Clean up */
logFonts = null;
pixels = null;
metrics = TEXTMETRIC.init;
return result;
}
static String getLastError () {
int error = OS.GetLastError();
if (error is 0) return ""; //$NON-NLS-1$
return " [GetLastError=0x" ~ .toHex(error) ~ "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
static String getLastErrorText () {
int error = OS.GetLastError();
if (error is 0) return ""; //$NON-NLS-1$
TCHAR* buffer = null;
int dwFlags = OS.FORMAT_MESSAGE_ALLOCATE_BUFFER | OS.FORMAT_MESSAGE_FROM_SYSTEM | OS.FORMAT_MESSAGE_IGNORE_INSERTS;
int length = OS.FormatMessage(dwFlags, null, error, OS.LANG_USER_DEFAULT, cast(TCHAR*)&buffer, 0, null);
String errorNum = ("[GetLastError=") ~ .toHex(error) ~ "] ";
if (length == 0) return errorNum;
String buffer1 = .TCHARzToStr(buffer, length);
if ( *buffer != 0)
OS.LocalFree(cast(HLOCAL)buffer);
return errorNum ~ buffer1;
}
/**
* Returns the matching standard color for the given
* constant, which should be one of the color constants
* specified in class <code>SWT</code>. Any value other
* than one of the SWT color constants which is passed
* in will result in the color black. This color should
* not be freed because it was allocated by the system,
* not the application.
*
* @param id the color constant
* @return the matching color
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*
* @see SWT
*/
public Color getSystemColor (int id) {
checkDevice ();
int pixel = 0x00000000;
switch (id) {
case SWT.COLOR_WHITE: pixel = 0x00FFFFFF; break;
case SWT.COLOR_BLACK: pixel = 0x00000000; break;
case SWT.COLOR_RED: pixel = 0x000000FF; break;
case SWT.COLOR_DARK_RED: pixel = 0x00000080; break;
case SWT.COLOR_GREEN: pixel = 0x0000FF00; break;
case SWT.COLOR_DARK_GREEN: pixel = 0x00008000; break;
case SWT.COLOR_YELLOW: pixel = 0x0000FFFF; break;
case SWT.COLOR_DARK_YELLOW: pixel = 0x00008080; break;
case SWT.COLOR_BLUE: pixel = 0x00FF0000; break;
case SWT.COLOR_DARK_BLUE: pixel = 0x00800000; break;
case SWT.COLOR_MAGENTA: pixel = 0x00FF00FF; break;
case SWT.COLOR_DARK_MAGENTA: pixel = 0x00800080; break;
case SWT.COLOR_CYAN: pixel = 0x00FFFF00; break;
case SWT.COLOR_DARK_CYAN: pixel = 0x00808000; break;
case SWT.COLOR_GRAY: pixel = 0x00C0C0C0; break;
case SWT.COLOR_DARK_GRAY: pixel = 0x00808080; break;
default:
}
return Color.win32_new (this, pixel);
}
/**
* Returns a reasonable font for applications to use.
* On some platforms, this will match the "default font"
* or "system font" if such can be found. This font
* should not be freed because it was allocated by the
* system, not the application.
* <p>
* Typically, applications which want the default look
* should simply not set the font on the widgets they
* create. Widgets are always created with the correct
* default font for the class of user-interface component
* they represent.
* </p>
*
* @return a font
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public Font getSystemFont () {
checkDevice ();
auto hFont = OS.GetStockObject (OS.SYSTEM_FONT);
return Font.win32_new (this, hFont);
}
/**
* Returns <code>true</code> if the underlying window system prints out
* warning messages on the console, and <code>setWarnings</code>
* had previously been called with <code>true</code>.
*
* @return <code>true</code>if warnings are being handled, and <code>false</code> otherwise
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public bool getWarnings () {
checkDevice ();
return false;
}
/**
* Initializes any internal resources needed by the
* device.
* <p>
* This method is called after <code>create</code>.
* </p><p>
* If subclasses reimplement this method, they must
* call the <code>super</code> implementation.
* </p>
*
* @see #create
*/
protected void init_ () {
if (debug_) {
static if (!OS.IsWinCE) OS.GdiSetBatchLimit(1);
}
/* Initialize the system font slot */
systemFont = getSystemFont();
/* Initialize scripts list */
static if (!OS.IsWinCE) {
SCRIPT_PROPERTIES** ppSp;
int piNumScripts;
OS.ScriptGetProperties (&ppSp, &piNumScripts);
scripts = ppSp[ 0 .. piNumScripts ].dup;
}
/*
* If we're not on a device which supports palettes,
* don't create one.
*/
auto hDC = internal_new_GC (null);
int rc = OS.GetDeviceCaps (hDC, OS.RASTERCAPS);
int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
bits *= planes;
if ((rc & OS.RC_PALETTE) is 0 || bits !is 8) {
internal_dispose_GC (hDC, null);
return;
}
int numReserved = OS.GetDeviceCaps (hDC, OS.NUMRESERVED);
int numEntries = OS.GetDeviceCaps (hDC, OS.SIZEPALETTE);
static if (OS.IsWinCE) {
/*
* Feature on WinCE. For some reason, certain 8 bit WinCE
* devices return 0 for the number of reserved entries in
* the system palette. Their system palette correctly contains
* the usual 20 system colors. The workaround is to assume
* there are 20 reserved system colors instead of 0.
*/
if (numReserved is 0 && numEntries >= 20) numReserved = 20;
}
/* Create the palette and reference counter */
colorRefCount = new int [numEntries];
/* 4 bytes header + 4 bytes per entry * numEntries entries */
byte [] logPalette = new byte [4 + 4 * numEntries];
/* 2 bytes = special header */
logPalette [0] = 0x00;
logPalette [1] = 0x03;
/* 2 bytes = number of colors, LSB first */
logPalette [2] = 0;
logPalette [3] = 1;
/*
* Create a palette which contains the system entries
* as they are located in the system palette. The
* MSDN article 'Memory Device Contexts' describes
* where system entries are located. On an 8 bit
* display with 20 reserved colors, the system colors
* will be the first 10 entries and the last 10 ones.
*/
byte[] lppe = new byte [4 * numEntries];
OS.GetSystemPaletteEntries (hDC, 0, numEntries, cast(PALETTEENTRY*)lppe.ptr);
/* Copy all entries from the system palette */
System.arraycopy (lppe, 0, logPalette, 4, 4 * numEntries);
/* Lock the indices corresponding to the system entries */
for (int i = 0; i < numReserved / 2; i++) {
colorRefCount [i] = 1;
colorRefCount [numEntries - 1 - i] = 1;
}
internal_dispose_GC (hDC, null);
hPalette = OS.CreatePalette (cast(LOGPALETTE*)logPalette.ptr);
}
/**
* Invokes platform specific functionality to allocate a new GC handle.
* <p>
* <b>IMPORTANT:</b> This method is <em>not</em> part of the public
* API for <code>Device</code>. It is marked public only so that it
* can be shared within the packages provided by SWT. It is not
* available on all platforms, and should never be called from
* application code.
* </p>
*
* @param data the platform specific GC data
* @return the platform specific GC handle
*/
public abstract HDC internal_new_GC (GCData data);
/**
* Invokes platform specific functionality to dispose a GC handle.
* <p>
* <b>IMPORTANT:</b> This method is <em>not</em> part of the public
* API for <code>Device</code>. It is marked public only so that it
* can be shared within the packages provided by SWT. It is not
* available on all platforms, and should never be called from
* application code.
* </p>
*
* @param hDC the platform specific GC handle
* @param data the platform specific GC data
*/
public abstract void internal_dispose_GC (HDC hDC, GCData data);
/**
* Returns <code>true</code> if the device has been disposed,
* and <code>false</code> otherwise.
* <p>
* This method gets the dispose state for the device.
* When a device has been disposed, it is an error to
* invoke any other method using the device.
*
* @return <code>true</code> when the device is disposed and <code>false</code> otherwise
*/
public bool isDisposed () {
synchronized (Device.classinfo) {
return disposed;
}
}
/**
* Loads the font specified by a file. The font will be
* present in the list of fonts available to the application.
*
* @param path the font file path
* @return whether the font was successfully loaded
*
* @exception SWTException <ul>
* <li>ERROR_NULL_ARGUMENT - if path is null</li>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*
* @see Font
*
* @since 3.3
*/
public bool loadFont (String path) {
checkDevice();
if (path is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
if (OS.IsWinNT && OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
//TCHAR lpszFilename = new TCHAR (0, path, true);
return OS.AddFontResourceEx ( .StrToTCHARz(path), OS.FR_PRIVATE, null) !is 0;
}
return false;
}
void new_Object (Object object) {
synchronized (trackingLock) {
for (int i=0; i<objects.length; i++) {
if (objects [i] is null) {
objects [i] = object;
errors [i] = new Exception ( "" );
return;
}
}
Object [] newObjects = new Object [objects.length + 128];
System.arraycopy (objects, 0, newObjects, 0, objects.length);
newObjects [objects.length] = object;
objects = newObjects;
Exception [] newErrors = new Exception [errors.length + 128];
System.arraycopy (errors, 0, newErrors, 0, errors.length);
newErrors [errors.length] = new Exception ("");
errors = newErrors;
}
}
void printErrors () {
if (!DEBUG) return;
if (tracking) {
synchronized (trackingLock) {
if (objects is null || errors is null) return;
int objectCount = 0;
int colors = 0, cursors = 0, fonts = 0, gcs = 0, images = 0;
int paths = 0, patterns = 0, regions = 0, textLayouts = 0, transforms = 0;
for (int i=0; i<objects.length; i++) {
Object object = objects [i];
if (object !is null) {
objectCount++;
if (null !is cast(Color)object ) colors++;
if (null !is cast(Cursor)object ) cursors++;
if (null !is cast(Font)object ) fonts++;
if (null !is cast(GC)object ) gcs++;
if (null !is cast(Image)object ) images++;
if (null !is cast(Path)object ) paths++;
if (null !is cast(Pattern)object ) patterns++;
if (null !is cast(Region)object ) regions++;
if (null !is cast(TextLayout)object ) textLayouts++;
if (null !is cast(Transform)object ) transforms++;
}
}
if (objectCount !is 0) {
String string = "Summary: ";
if (colors !is 0) string ~= String_valueOf(colors) ~ " Color(s), ";
if (cursors !is 0) string ~= String_valueOf(cursors) ~ " Cursor(s), ";
if (fonts !is 0) string ~= String_valueOf(fonts) ~ " Font(s), ";
if (gcs !is 0) string ~= String_valueOf(gcs) ~ " GC(s), ";
if (images !is 0) string ~= String_valueOf(images) ~ " Image(s), ";
if (paths !is 0) string ~= String_valueOf(paths) ~ " Path(s), ";
if (patterns !is 0) string ~= String_valueOf(patterns) ~ " Pattern(s), ";
if (regions !is 0) string ~= String_valueOf(regions) ~ " Region(s), ";
if (textLayouts !is 0) string ~= String_valueOf(textLayouts) ~ " TextLayout(s), ";
if (transforms !is 0) string ~= String_valueOf(transforms) ~ " Transforms(s), ";
if (string.length !is 0) {
string = string.substring (0, cast(int) (string.length - 2));
getDwtLogger().error ( __FILE__, __LINE__, "{}", string);
}
for (int i=0; i<errors.length; i++) {
if (errors [i] !is null) ExceptionPrintStackTrace( errors [i]);
}
}
}
}
}
/**
* Releases any internal resources back to the operating
* system and clears all fields except the device handle.
* <p>
* When a device is destroyed, resources that were acquired
* on behalf of the programmer need to be returned to the
* operating system. For example, if the device allocated a
* font to be used as the system font, this font would be
* freed in <code>release</code>. Also,to assist the garbage
* collector and minimize the amount of memory that is not
* reclaimed when the programmer keeps a reference to a
* disposed device, all fields except the handle are zero'd.
* The handle is needed by <code>destroy</code>.
* </p>
* This method is called before <code>destroy</code>.
* </p><p>
* If subclasses reimplement this method, they must
* call the <code>super</code> implementation.
* </p>
*
* @see #dispose
* @see #destroy
*/
protected void release () {
if (gdipToken) {
Gdip.GdiplusShutdown ( gdipToken );
}
gdipToken = 0; // TODO: assignment of 0 might not be valid for token
scripts = null;
if (hPalette !is null) OS.DeleteObject (hPalette);
hPalette = null;
colorRefCount = null;
logFonts = null;
nFonts = 0;
}
/**
* If the underlying window system supports printing warning messages
* to the console, setting warnings to <code>false</code> prevents these
* messages from being printed. If the argument is <code>true</code> then
* message printing is not blocked.
*
* @param warnings <code>true</code>if warnings should be printed, and <code>false</code> otherwise
*
* @exception SWTException <ul>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public void setWarnings (bool warnings) {
checkDevice ();
}
}
|
D
|
/*
* ti_float.d
*
* This module implements the TypeInfo for the float type.
*
* License: Public Domain
*
*/
module mindrt.typeinfo.ti_float;
import mindrt.util;
class TypeInfo_f : TypeInfo {
char[] toString() {
return "float";
}
hash_t getHash(void *p) {
return *cast(uint *)p;
}
int equals(void *p1, void *p2) {
return _equals(*cast(float *)p1, *cast(float *)p2);
}
int compare(void *p1, void *p2) {
return _compare(*cast(float *)p1, *cast(float *)p2);
}
size_t tsize() {
return float.sizeof;
}
void swap(void *p1, void *p2) {
float t;
t = *cast(float *)p1;
*cast(float *)p1 = *cast(float *)p2;
*cast(float *)p2 = t;
}
void[] init() {
static float r;
return (cast(float *)&r)[0 .. 1];
}
package:
static int _equals(float f1, float f2) {
return f1 == f2 || (isnan(f1) && isnan(f2));
}
static int _compare(float d1, float d2) {
// if either are NaN
if (d1 !<>= d2) {
if (isnan(d1)) {
if (isnan(d2)) {
return 0;
}
return -1;
}
return 1;
}
if (d1 == d2) {
return 0;
}
else if (d1 < d2) {
return -1;
}
return 1;
}
}
|
D
|
/**
* PEM Encoding/Decoding
*
* Copyright:
* (C) 1999-2007 Jack Lloyd
* (C) 2014-2015 Etienne Cimon
*
* License:
* Botan is released under the Simplified BSD License (see LICENSE.md)
*/
module botan.codec.pem;
import botan.filters.filters;
import botan.utils.parsing;
import botan.filters.data_src;
import botan.filters.b64_filt;
import botan.utils.types;
import std.array : Appender;
import botan.constants;
struct PEM
{
/**
* Encode some binary data in PEM format
*/
static string encode(const(ubyte)* der, size_t length, in string label, size_t width = 64)
{
immutable(string) PEM_HEADER = "-----BEGIN " ~ label ~ "-----\n";
immutable(string) PEM_TRAILER = "-----END " ~ label ~ "-----\n";
Pipe pipe = Pipe(new Base64Encoder(true, width));
pipe.processMsg(der, length);
return (PEM_HEADER ~ pipe.toString() ~ PEM_TRAILER);
}
/**
* Encode some binary data in PEM format
*/
static string encode(ALLOC)(auto const ref Vector!(ubyte, ALLOC) data,
in string label, size_t line_width = 64)
{
return encode(data.ptr, data.length, label, line_width);
}
/**
* Encode some binary data in PEM format
*/
static string encode(ALLOC)(auto const ref RefCounted!(Vector!(ubyte, ALLOC), ALLOC) data,
in string label, size_t line_width = 64)
{
return encode(data.ptr, data.length, label, line_width);
}
/**
* Decode PEM data
* Params:
* pem = a datasource containing PEM encoded data
* label = is set to the PEM label found for later inspection
*/
/*
* Decode PEM down to raw BER/DER
*/
static SecureVector!ubyte decode(DataSource source, ref string label)
{
//logTrace("PEM decode");
Appender!string label_buf;
__gshared immutable size_t RANDOM_CHAR_LIMIT = 8;
const string PEM_HEADER1 = "-----BEGIN ";
const string PEM_HEADER2 = "-----";
size_t position = 0;
while (position != PEM_HEADER1.length)
{
ubyte b;
if (!source.readByte(b))
throw new DecodingError("PEM: No PEM header found");
if (b == PEM_HEADER1[position])
++position;
else if (position >= RANDOM_CHAR_LIMIT)
throw new DecodingError("PEM: Malformed PEM header");
else
position = 0;
}
position = 0;
while (position != PEM_HEADER2.length)
{
ubyte b;
if (!source.readByte(b))
throw new DecodingError("PEM: No PEM header found");
if (b == PEM_HEADER2[position])
++position;
else if (position)
throw new DecodingError("PEM: Malformed PEM header");
if (position == 0)
label_buf ~= cast(char) b;
}
label = label_buf.data;
Pipe base64 = Pipe(new Base64Decoder);
base64.startMsg();
const string PEM_TRAILER = "-----END " ~ label ~ "-----";
position = 0;
while (position != PEM_TRAILER.length)
{
ubyte b;
if (!source.readByte(b))
throw new DecodingError("PEM: No PEM trailer found");
if (b == PEM_TRAILER[position])
++position;
else if (position)
throw new DecodingError("PEM: Malformed PEM trailer");
if (position == 0)
base64.write(b);
}
base64.endMsg();
return base64.readAll();
}
/**
* Decode PEM data
* Params:
* pem = a string containing PEM encoded data
* label = is set to the PEM label found for later inspection
*/
static SecureVector!ubyte decode(in string pem, ref string label)
{
auto src = DataSourceMemory(pem);
return decode(cast(DataSource)src, label);
}
/**
* Decode PEM data
* Params:
* pem = a datasource containing PEM encoded data
* label = is what we expect the label to be
*/
static SecureVector!ubyte decodeCheckLabel(DataSource source, in string label_want)
{
string label_got;
SecureVector!ubyte ber = decode(source, label_got);
if (label_got != label_want)
throw new DecodingError("PEM: Label mismatch, wanted " ~ label_want ~ ", got " ~ label_got);
return ber;
}
/**
* Decode PEM data
* Params:
* pem = a string containing PEM encoded data
* label = is what we expect the label to be
*/
static SecureVector!ubyte decodeCheckLabel(in string pem,
in string label_want)
{
auto src = DataSourceMemory(pem);
return decodeCheckLabel(cast(DataSource) src, label_want);
}
/**
* Heuristic test for PEM data.
* Search for a PEM signature
*/
static bool matches(DataSource source, in string extra = "", size_t search_range = 4096)
{
const string PEM_HEADER = "-----BEGIN " ~ extra;
SecureVector!ubyte search_buf = SecureVector!ubyte(search_range);
size_t got = source.peek(search_buf.ptr, search_buf.length, 0);
if (got < PEM_HEADER.length)
return false;
size_t index = 0;
foreach (size_t j; 0 .. got)
{
if (search_buf[j] == PEM_HEADER[index])
++index;
else
index = 0;
if (index == PEM_HEADER.length)
return true;
}
return false;
}
}
|
D
|
/**
* Copyright: © 2014 Anton Gushcha
* License: Subject to the terms of the MIT license, as written in the included LICENSE file.
* Authors: NCrashed <ncrashed@gmail.com>
*/
module evol.compiler;
import devol.compiler;
import devol.population;
import evol.individ;
import evol.world;
import evol.progtype;
import project;
alias Population!( getDefChars, GraphIndivid ) GraphPopulation;
class GraphCompilation : GameCompilation
{
Project project;
this(Project project, void delegate() updateGenerationInfo)
{
this.project = project;
this.updateGenerationInfo = updateGenerationInfo;
}
bool stopCond(ref int step, IndAbstract ind, WorldAbstract world)
{
return step >= 1;
}
void drawStep(IndAbstract ind, WorldAbstract world)
{
}
void drawFinal(PopAbstract pop, WorldAbstract world)
{
project.population = cast(GraphPopulation)pop;
updateGenerationInfo();
}
int roundsPerInd()
{
return 10;
}
private void delegate() updateGenerationInfo;
}
alias GraphCompiler = Compiler!(
GraphCompilation
, Evolutor
, ProgramType
, GraphPopulation
, GraphWorld);
|
D
|
/*
* Licensed under the GNU Lesser General Public License Version 3
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the license, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
// generated automatically - do not change
module gobject.CClosure;
private import gi.gobject;
public import gi.gobjecttypes;
private import glib.ConstructionException;
private import gobject.Closure;
private import gobject.ObjectG;
private import gobject.Value;
/**
* A #GCClosure is a specialization of #GClosure for C function callbacks.
*/
public class CClosure
{
/** the main GObject struct */
protected GCClosure* gCClosure;
/** Get the main GObject struct */
public GCClosure* getCClosureStruct()
{
return gCClosure;
}
/** the main GObject struct as a void* */
protected void* getStruct()
{
return cast(void*)gCClosure;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GCClosure* gCClosure)
{
this.gCClosure = gCClosure;
}
/**
* Creates a new closure which invokes callbackFunc with userData as
* the last parameter.
*
* Params:
* callbackFunc = the function to invoke
* userData = user data to pass to callbackFunc
* destroyData = destroy notify to be called when userData is no longer used
* swap = if true invoce with usrData as the first parameter
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(GCallback callbackFunc, void* userData, GClosureNotify destroyData, bool swap)
{
GClosure* p;
if ( swap )
p = g_cclosure_new_swap(callbackFunc, userData, destroyData);
else
p = g_cclosure_new(callbackFunc, userData, destroyData);
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GCClosure*) p);
}
/**
* A variant of this() which uses object as userData and
* calls ObjectG.watchClosure() on object and the created
* closure. This function is useful when you have a callback closely
* associated with a gobject.ObjectG, and want the callback to no longer run
* after the object is is freed.
*
* Params:
* callbackFunc = the function to invoke
* object = a gobject.ObjectG.ObjectG to pass to callbackFunc
* swap = if true invoce with usrData as the first parameter
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(GCallback callbackFunc, ObjectG object, bool swap)
{
GClosure* p;
if ( swap )
p = g_cclosure_new_object_swap(callbackFunc, (object is null) ? null : object.getObjectGStruct());
else
p = g_cclosure_new_object(callbackFunc, (object is null) ? null : object.getObjectGStruct());
if(p is null)
{
throw new ConstructionException("null returned by new_object");
}
this(cast(GCClosure*) p);
}
/**
*/
/**
* A #GClosureMarshal function for use with signals with handlers that
* take two boxed pointers as arguments and return a boolean. If you
* have such a signal, you will probably also need to use an
* accumulator, such as g_signal_accumulator_true_handled().
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalBOOLEANBOXEDBOXED(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_BOOLEAN__BOXED_BOXED((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_BOOLEAN__BOXED_BOXED().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalBOOLEANBOXEDBOXEDv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with handlers that
* take a flags type as an argument and return a boolean. If you have
* such a signal, you will probably also need to use an accumulator,
* such as g_signal_accumulator_true_handled().
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalBOOLEANFLAGS(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_BOOLEAN__FLAGS((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_BOOLEAN__FLAGS().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalBOOLEANFLAGSv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_BOOLEAN__FLAGSv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with handlers that
* take a #GObject and a pointer and produce a string. It is highly
* unlikely that your signal handler fits this description.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalSTRINGOBJECTPOINTER(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_STRING__OBJECT_POINTER((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_STRING__OBJECT_POINTER().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalSTRINGOBJECTPOINTERv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_STRING__OBJECT_POINTERv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* boolean argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDBOOLEAN(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__BOOLEAN((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__BOOLEAN().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDBOOLEANv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__BOOLEANv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* argument which is any boxed pointer type.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDBOXED(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__BOXED((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__BOXED().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDBOXEDv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__BOXEDv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* character argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDCHAR(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__CHAR((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__CHAR().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDCHARv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__CHARv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with one
* double-precision floating point argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDDOUBLE(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__DOUBLE((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__DOUBLE().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDDOUBLEv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__DOUBLEv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* argument with an enumerated type.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDENUM(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__ENUM((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__ENUM().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDENUMv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__ENUMv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* argument with a flags types.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDFLAGS(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__FLAGS((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__FLAGS().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDFLAGSv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__FLAGSv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with one
* single-precision floating point argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDFLOAT(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__FLOAT((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__FLOAT().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDFLOATv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__FLOATv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* integer argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDINT(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__INT((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__INT().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDINTv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__INTv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with with a single
* long integer argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDLONG(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__LONG((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__LONG().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDLONGv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__LONGv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* #GObject argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDOBJECT(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__OBJECT((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__OBJECT().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDOBJECTv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__OBJECTv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* argument of type #GParamSpec.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDPARAM(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__PARAM((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__PARAM().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDPARAMv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__PARAMv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single raw
* pointer argument type.
*
* If it is possible, it is better to use one of the more specific
* functions such as g_cclosure_marshal_VOID__OBJECT() or
* g_cclosure_marshal_VOID__OBJECT().
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDPOINTER(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__POINTER((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__POINTER().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDPOINTERv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__POINTERv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single string
* argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDSTRING(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__STRING((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__STRING().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDSTRINGv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__STRINGv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* unsigned character argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDUCHAR(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__UCHAR((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__UCHAR().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDUCHARv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__UCHARv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with with a single
* unsigned integer argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDUINT(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__UINT((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* A #GClosureMarshal function for use with signals with a unsigned int
* and a pointer as arguments.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDUINTPOINTER(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__UINT_POINTER((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__UINT_POINTER().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDUINTPOINTERv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__UINT_POINTERv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__UINT().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDUINTv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__UINTv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* unsigned long integer argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDULONG(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__ULONG((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__ULONG().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDULONGv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__ULONGv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with a single
* #GVariant argument.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDVARIANT(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__VARIANT((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__VARIANT().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDVARIANTv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__VARIANTv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A #GClosureMarshal function for use with signals with no arguments.
*
* Params:
* closure = A #GClosure.
* returnValue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*/
public static void marshalVOIDVOID(Closure closure, Value returnValue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_VOID__VOID((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__VOID().
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* args = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args.
*/
public static void marshalVOIDVOIDv(Closure closure, Value returnValue, void* instanc, void* args, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_VOID__VOIDv((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, args, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
/**
* A generic marshaller function implemented via
* [libffi](http://sourceware.org/libffi/).
*
* Normally this function is not passed explicitly to g_signal_new(),
* but used automatically by GLib when specifying a %NULL marshaller.
*
* Params:
* closure = A #GClosure.
* returnGvalue = A #GValue to store the return value. May be %NULL
* if the callback of closure doesn't return a value.
* nParamValues = The length of the @param_values array.
* paramValues = An array of #GValues holding the arguments
* on which to invoke the callback of closure.
* invocationHint = The invocation hint given as the last argument to
* g_closure_invoke().
* marshalData = Additional data specified when registering the
* marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*
* Since: 2.30
*/
public static void marshalGeneric(Closure closure, Value returnGvalue, uint nParamValues, Value paramValues, void* invocationHint, void* marshalData)
{
g_cclosure_marshal_generic((closure is null) ? null : closure.getClosureStruct(), (returnGvalue is null) ? null : returnGvalue.getValueStruct(), nParamValues, (paramValues is null) ? null : paramValues.getValueStruct(), invocationHint, marshalData);
}
/**
* A generic #GVaClosureMarshal function implemented via
* [libffi](http://sourceware.org/libffi/).
*
* Params:
* closure = the #GClosure to which the marshaller belongs
* returnValue = a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* instanc = the instance on which the closure is invoked.
* argsList = va_list of arguments to be passed to the closure.
* marshalData = additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* nParams = the length of the @param_types array
* paramTypes = the #GType of each argument from
* @args_list.
*
* Since: 2.30
*/
public static void marshalGenericVa(Closure closure, Value returnValue, void* instanc, void* argsList, void* marshalData, GType[] paramTypes)
{
g_cclosure_marshal_generic_va((closure is null) ? null : closure.getClosureStruct(), (returnValue is null) ? null : returnValue.getValueStruct(), instanc, argsList, marshalData, cast(int)paramTypes.length, paramTypes.ptr);
}
}
|
D
|
// Copyright Ahmet Sait Koçak 2020.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
module bindbc.hb.bind.shape;
import bindbc.hb.bind.buffer;
import bindbc.hb.bind.common;
import bindbc.hb.bind.font;
extern(C) @nogc nothrow:
version(BindHB_Static)
void hb_shape (
hb_font_t* font,
hb_buffer_t* buffer,
const(hb_feature_t)* features,
uint num_features);
else
{
private alias fp_hb_shape = void function (
hb_font_t* font,
hb_buffer_t* buffer,
const(hb_feature_t)* features,
uint num_features);
__gshared fp_hb_shape hb_shape;
}
version(BindHB_Static)
hb_bool_t hb_shape_full (
hb_font_t* font,
hb_buffer_t* buffer,
const(hb_feature_t)* features,
uint num_features,
const(char*)* shaper_list);
else
{
private alias fp_hb_shape_full = hb_bool_t function (
hb_font_t* font,
hb_buffer_t* buffer,
const(hb_feature_t)* features,
uint num_features,
const(char*)* shaper_list);
__gshared fp_hb_shape_full hb_shape_full;
}
version(BindHB_Static)
const(char*)* hb_shape_list_shapers ();
else
{
private alias fp_hb_shape_list_shapers = const(char*)* function ();
__gshared fp_hb_shape_list_shapers hb_shape_list_shapers;
}
|
D
|
/*******************************************************************************
* Copyright (c) 2008 Matthew Hall 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:
* Matthew Hall - initial API and implementation (bug 218269)
* Boris Bokowski - bug 218269
******************************************************************************/
module org.eclipse.core.databinding.validation.MultiValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
import java.lang.all;
import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.core.databinding.ValidationStatusProvider;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.core.databinding.observable.ObservableTracker;
import org.eclipse.core.databinding.observable.Observables;
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.core.databinding.observable.list.IListChangeListener;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.list.ListChangeEvent;
import org.eclipse.core.databinding.observable.list.ListDiffVisitor;
import org.eclipse.core.databinding.observable.list.WritableList;
import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.observable.set.IObservableSet;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.internal.databinding.observable.ValidatedObservableList;
import org.eclipse.core.internal.databinding.observable.ValidatedObservableMap;
import org.eclipse.core.internal.databinding.observable.ValidatedObservableSet;
import org.eclipse.core.internal.databinding.observable.ValidatedObservableValue;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
/**
* A validator for cross-constraints between observables.
*
* <p>
* Some practical examples of cross-constraints:
* <ul>
* <li>A start date cannot be later than an end date
* <li>A list of percentages should add up to 100%
* </ul>
* <p>
* Example: require two integer fields to contain either both even or both odd
* numbers.
*
* <pre>
* DataBindingContext dbc = new DataBindingContext();
*
* IObservableValue target0 = SWTObservables.observeText(text0, SWT.Modify);
* IObservableValue target1 = SWTObservables.observeText(text1, SWT.Modify);
*
* // Binding in two stages (from target to middle, then from middle to model)
* // simplifies the validation logic. Using the middle observables saves
* // the trouble of converting the target values cast(Strings) to the model type
* // (integers) manually during validation.
* final IObservableValue middle0 = new WritableValue(null, Integer.TYPE);
* final IObservableValue middle1 = new WritableValue(null, Integer.TYPE);
* dbc.bind(target0, middle0, null, null);
* dbc.bind(target1, middle1, null, null);
*
* // Create the multi-validator
* MultiValidator validator = new class() MultiValidator {
* protected IStatus validate() {
* // Calculate the validation status
* Integer value0 = cast(Integer) middle0.getValue();
* Integer value1 = cast(Integer) middle1.getValue();
* if (Math.abs(value0.intValue()) % 2 !is Math.abs(value1.intValue()) % 2)
* return ValidationStatus
* .error("Values must be both even or both odd");
* return ValidationStatus.ok();
* }
* };
* dbc.addValidationStatusProvider(validator);
*
* // Bind the middle observables to the model observables.
* IObservableValue model0 = new WritableValue(new Integer(2), Integer.TYPE);
* IObservableValue model1 = new WritableValue(new Integer(4), Integer.TYPE);
* dbc.bind(middle0, model0, null, null);
* dbc.bind(middle1, model1, null, null);
* </pre>
*
* <p>
* MultiValidator can also prevent invalid data from being copied to model. This
* is done by wrapping each target observable in a validated observable, and
* then binding the validated observable to the model.
*
* <pre>
*
* ...
*
* // Validated observables do not change value until the validator passes.
* IObservableValue validated0 = validator.observeValidatedValue(middle0);
* IObservableValue validated1 = validator.observeValidatedValue(middle1);
* IObservableValue model0 = new WritableValue(new Integer(2), Integer.TYPE);
* IObservableValue model1 = new WritableValue(new Integer(4), Integer.TYPE);
* // Bind to the validated value, not the middle/target
* dbc.bind(validated0, model0, null, null);
* dbc.bind(validated1, model1, null, null);
* </pre>
*
* Note: No guarantee is made as to the order of updates when multiple validated
* observables change value at once (i.e. multiple updates pending when the
* status becomes valid). Therefore the model may be in an invalid state after
* the first but before the last pending update.
*
* @since 1.1
*/
public abstract class MultiValidator : ValidationStatusProvider {
private Realm realm;
private IObservableValue validationStatus;
private IObservableValue unmodifiableValidationStatus;
private WritableList targets;
private IObservableList unmodifiableTargets;
private IObservableList models;
IListChangeListener targetsListener;
class TargetsListener : IListChangeListener {
public void handleListChange(ListChangeEvent event) {
event.diff.accept(new class() ListDiffVisitor {
public void handleAdd(int index, Object element) {
(cast(IObservable) element)
.addChangeListener(dependencyListener);
}
public void handleRemove(int index, Object element) {
(cast(IObservable) element)
.removeChangeListener(dependencyListener);
}
});
}
};
private IChangeListener dependencyListener;
class DependencyListener : IChangeListener {
public void handleChange(ChangeEvent event) {
revalidate();
}
};
/**
* Constructs a MultiValidator on the default realm.
*/
public this() {
this(Realm.getDefault());
}
/**
* Constructs a MultiValidator on the given realm.
*
* @param realm
* the realm on which validation takes place.
*/
public this(Realm realm) {
targetsListener = new TargetsListener();
dependencyListener = new DependencyListener();
Assert.isNotNull(realm, "Realm cannot be null"); //$NON-NLS-1$
this.realm = realm;
validationStatus = new WritableValue(realm, cast(Object)ValidationStatus.ok(),
Class.fromType!(IStatus));
targets = new WritableList(realm, new ArrayList(), Class.fromType!(IObservable));
targets.addListChangeListener(targetsListener);
unmodifiableTargets = Observables.unmodifiableObservableList(targets);
models = Observables.emptyObservableList(realm);
}
private void checkObservable(IObservable target) {
Assert.isNotNull(cast(Object)target, "Target observable cannot be null"); //$NON-NLS-1$
Assert
.isTrue(cast(bool)realm.opEquals(target.getRealm()),
"Target observable must be in the same realm as MultiValidator"); //$NON-NLS-1$
}
/**
* Returns an {@link IObservableValue} whose value is always the current
* validation status of this MultiValidator. The returned observable is in
* the same realm as this MultiValidator.
*
* @return an {@link IObservableValue} whose value is always the current
* validation status of this MultiValidator.
*/
public IObservableValue getValidationStatus() {
if (unmodifiableValidationStatus is null) {
revalidate();
unmodifiableValidationStatus = Observables
.unmodifiableObservableValue(validationStatus);
}
return unmodifiableValidationStatus;
}
private void revalidate() {
final IObservable[] dependencies = ObservableTracker.runAndMonitor(
new class() Runnable {
public void run() {
try {
IStatus status = validate();
if (status is null)
status = ValidationStatus.ok();
validationStatus.setValue(cast(Object)status);
} catch (RuntimeException e) {
// Usually an NPE as dependencies are
// init'ed
validationStatus.setValue(cast(Object)ValidationStatus.error(e
.getMessage(), e));
}
}
}, null, null);
ObservableTracker.runAndIgnore(new class() Runnable {
public void run() {
targets.clear();
targets.addAll(Arrays.asList(dependencies));
}
});
}
/**
* Return the current validation status.
* <p>
* Note: To ensure that the validation status is kept current, all
* dependencies used to calculate status should be accessed through
* {@link IObservable} instances. Each dependency observable must be in the
* same realm as the MultiValidator.
*
* @return the current validation status.
*/
protected abstract IStatus validate();
/**
* Returns a wrapper {@link IObservableValue} which stays in sync with the
* given target observable only when the validation status is valid.
* Statuses of {@link IStatus#OK OK}, {@link IStatus#INFO INFO} or
* {@link IStatus#WARNING WARNING} severity are considered valid.
* <p>
* The wrapper behaves as follows with respect to the validation status:
* <ul>
* <li>While valid, the wrapper stays in sync with its target observable.
* <li>While invalid, the wrapper's value is the target observable's last
* valid value. If the target changes value, a stale event is fired
* signaling that a change is pending.
* <li>When status changes from invalid to valid, the wrapper takes the
* value of the target observable, and synchronization resumes.
* </ul>
*
* @param target
* the target observable being wrapped. Must be in the same realm
* as the MultiValidator.
* @return an IObservableValue which stays in sync with the given target
* observable only with the validation status is valid.
*/
public IObservableValue observeValidatedValue(IObservableValue target) {
checkObservable(target);
return new ValidatedObservableValue(target, getValidationStatus());
}
/**
* Returns a wrapper {@link IObservableList} which stays in sync with the
* given target observable only when the validation status is valid.
* Statuses of {@link IStatus#OK OK}, {@link IStatus#INFO INFO} or
* {@link IStatus#WARNING WARNING} severity are considered valid.
* <p>
* The wrapper behaves as follows with respect to the validation status:
* <ul>
* <li>While valid, the wrapper stays in sync with its target observable.
* <li>While invalid, the wrapper's elements are the target observable's
* last valid elements. If the target changes elements, a stale event is
* fired signaling that a change is pending.
* <li>When status changes from invalid to valid, the wrapper takes the
* elements of the target observable, and synchronization resumes.
* </ul>
*
* @param target
* the target observable being wrapped. Must be in the same realm
* as the MultiValidator.
* @return an IObservableValue which stays in sync with the given target
* observable only with the validation status is valid.
*/
public IObservableList observeValidatedList(IObservableList target) {
checkObservable(target);
return new ValidatedObservableList(target, getValidationStatus());
}
/**
* Returns a wrapper {@link IObservableSet} which stays in sync with the
* given target observable only when the validation status is valid.
* Statuses of {@link IStatus#OK OK}, {@link IStatus#INFO INFO} or
* {@link IStatus#WARNING WARNING} severity are considered valid.
* <p>
* The wrapper behaves as follows with respect to the validation status:
* <ul>
* <li>While valid, the wrapper stays in sync with its target observable.
* <li>While invalid, the wrapper's elements are the target observable's
* last valid elements. If the target changes elements, a stale event is
* fired signaling that a change is pending.
* <li>When status changes from invalid to valid, the wrapper takes the
* elements of the target observable, and synchronization resumes.
* </ul>
*
* @param target
* the target observable being wrapped. Must be in the same realm
* as the MultiValidator.
* @return an IObservableValue which stays in sync with the given target
* observable only with the validation status is valid.
*/
public IObservableSet observeValidatedSet(IObservableSet target) {
checkObservable(target);
return new ValidatedObservableSet(target, getValidationStatus());
}
/**
* Returns a wrapper {@link IObservableMap} which stays in sync with the
* given target observable only when the validation status is valid.
* Statuses of {@link IStatus#OK OK}, {@link IStatus#INFO INFO} or
* {@link IStatus#WARNING WARNING} severity are considered valid.
* <p>
* The wrapper behaves as follows with respect to the validation status:
* <ul>
* <li>While valid, the wrapper stays in sync with its target observable.
* <li>While invalid, the wrapper's entries are the target observable's
* last valid entries. If the target changes entries, a stale event is fired
* signaling that a change is pending.
* <li>When status changes from invalid to valid, the wrapper takes the
* entries of the target observable, and synchronization resumes.
* </ul>
*
* @param target
* the target observable being wrapped. Must be in the same realm
* as the MultiValidator.
* @return an IObservableValue which stays in sync with the given target
* observable only with the validation status is valid.
*/
public IObservableMap observeValidatedMap(IObservableMap target) {
checkObservable(target);
return new ValidatedObservableMap(target, getValidationStatus());
}
public IObservableList getTargets() {
return unmodifiableTargets;
}
public IObservableList getModels() {
return models;
}
public void dispose() {
targets.clear(); // Remove listeners from dependencies
unmodifiableValidationStatus.dispose();
validationStatus.dispose();
unmodifiableTargets.dispose();
targets.dispose();
models.dispose();
realm = null;
validationStatus = null;
unmodifiableValidationStatus = null;
targets = null;
unmodifiableTargets = null;
models = null;
super.dispose();
}
}
|
D
|
module beholder.camera;
class Camera
{
this(vec2f window, vec3f position, float size)
{
_projection = mat4f.identity;
_mvp_matrix = mat4f.identity;
_model = mat4f.identity;
_view = mat4f.identity;
_position = position;
_window = window;
_size = size < 0 ? 0 : size;
updateMatrices;
}
auto size(float size)
{
_size = size;
updateMatrices();
}
auto size() const
{
return _size;
}
auto window(vec2f window)
{
_window = window;
updateMatrices();
}
auto position() const
{
return _position;
}
auto position(vec3f position)
{
_position = position;
updateMatrices();
}
ref mvpMatrix()
{
return _mvp_matrix;
}
protected:
import gfm.math;
vec2f _window;
vec3f _position;
float _size;
mat4f _projection, _view, _mvp_matrix, _model;
/// Преобразование экранных координат в мировые.
/// Возвращает луч из камеры в мировых координатах.
vec3f screenPoint2worldRay(vec2f screenCoords) pure const
{
vec3f normalized;
normalized.x = (2.0f * screenCoords.x) / _window.x - 1.0f;
normalized.y = 1.0f - (2.0f * screenCoords.y) / _window.y;
vec4f rayClip = vec4f(normalized.xy, -1.0, 1.0);
vec4f rayEye = _projection.inverse * rayClip;
rayEye = vec4f(rayEye.xy, -1.0, 0.0);
vec3f rayWorld = (_view.inverse * rayEye).xyz;
rayWorld.normalize;
return rayWorld;
}
void updateMatrices()
{
auto aspect_ratio= _window.x/_window.y;
if(_window.x <= _window.y)
_projection = mat4f.orthographic(-_size, +_size,-_size/aspect_ratio, +_size/aspect_ratio, -_size, +_size);
else
_projection = mat4f.orthographic(-_size*aspect_ratio,+_size*aspect_ratio,-_size, +_size, -_size, +_size);
_view = mat4f.lookAt(
vec3f(_position.x, _position.y, +_size), // Camera has world coordinates
vec3f(_position.x, _position.y, -_size), // and looks at origin
vec3f(0, 1, 0) // "Head" is up
);
_mvp_matrix = _projection * _view * _model;
}
}
|
D
|
module imports.test19107a.d;
alias I(alias A) = A;
|
D
|
a fertile tract in a desert (where the water table approaches the surface)
a shelter serving as a place of safety or sanctuary
|
D
|
arduino/hooks.o: C:/Arduino/hardware/arduino/avr/cores/arduino/hooks.c
|
D
|
/*
* This file is part of EvinceD.
* EvinceD is based on GtkD.
*
* EvinceD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* EvinceD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with EvinceD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
module evince.document.DocumentPrintIF;
private import cairo.Context;
private import evince.document.Page;
private import evince.document.c.functions;
public import evince.document.c.types;
/** */
public interface DocumentPrintIF{
/** Get the main Gtk struct */
public EvDocumentPrint* getDocumentPrintStruct(bool transferOwnership = false);
/** the main Gtk struct as a void* */
protected void* getStruct();
/** */
public static GType getType()
{
return ev_document_print_get_type();
}
/** */
public void printPage(Page page, Context cr);
}
|
D
|
// Written in the D programming language.
/**
This module contains common Plaform definitions.
Platform is abstraction layer for application.
Synopsis:
----
import dlangui.platforms.common.platform;
----
Copyright: Vadim Lopatin, 2014
License: Boost License 1.0
Authors: Vadim Lopatin, coolreader.org@gmail.com
*/
module dlangui.platforms.common.platform;
public import dlangui.core.config;
public import dlangui.core.events;
import dlangui.core.collections;
import dlangui.widgets.widget;
import dlangui.widgets.popup;
import dlangui.widgets.scrollbar;
import dlangui.graphics.drawbuf;
import dlangui.core.stdaction;
import dlangui.core.asyncsocket;
static if (ENABLE_OPENGL) {
private import dlangui.graphics.gldrawbuf;
}
private import std.algorithm;
private import core.sync.mutex;
private import std.string;
/// entry point - declare such function to use as main for dlangui app
extern(C) int UIAppMain(string[] args);
// specify debug=DebugMouseEvents for logging mouse handling
// specify debug=DebugRedraw for logging drawing and layouts handling
// specify debug=DebugKeys for logging of key events
/// window creation flags
enum WindowFlag : uint {
/// window can be resized
Resizable = 1,
/// window should be shown in fullscreen mode
Fullscreen = 2,
/// modal window - grabs input focus
Modal = 4,
}
/// Window states
enum WindowState : int {
/// state is unknown (not supported by platform?), as well for using in setWindowState when only want to activate window or change its size/position
unspecified,
/// normal state
normal,
/// window is maximized
maximized,
/// window is maximized
minimized,
/// fullscreen mode (supported not on all platforms)
fullscreen,
/// application is paused (e.g. on Android)
paused,
/// window is hidden
hidden,
/// closed
closed,
}
/// Dialog display modes - used to configure dialogs should be showed as a popup or window
enum DialogDisplayMode : ulong {
/// show all types of dialogs in windows
allTypesOfDialogsInWindow = 0,
/// show file dialogs in popups
fileDialogInPopup = 1,
/// show message boxes in popups
messageBoxInPopup = 2,
/// show input boxes in popups
inputBoxInPopup = 4,
/// show settings dialogs in popups
settingsDialogInPopup = 8,
/// show user dialogs in popups - flag for user dialogs
userDialogInPopup = 16,
/// show all types of dialogs in popups
allTypesOfDialogsInPopup = fileDialogInPopup | messageBoxInPopup | inputBoxInPopup | settingsDialogInPopup | userDialogInPopup
}
/// Sets what's should be done when window content is too big
enum WindowOrContentResizeMode {
/// widgets are shrink to fit in window
shrinkWidgets,
/// resize window when window is too small
resizeWindow,
/// add scrollbars to window
scrollWindow
}
/// Window state signal listener
interface OnWindowStateHandler {
/// signal listener - called when state of window is changed
bool onWindowStateChange(Window window, WindowState winState, Rect rect);
}
/// protected event list
/// references to posted messages can be stored here at least to keep live reference and avoid GC
/// as well, on some platforms it's easy to send id to message queue, but not pointer
class EventList {
protected Mutex _mutex;
protected Collection!CustomEvent _events;
this() {
_mutex = new Mutex();
}
~this() {
destroy(_mutex);
_mutex = null;
}
/// puts event into queue, returns event's unique id
long put(CustomEvent event) {
_mutex.lock();
scope(exit) _mutex.unlock();
_events.pushBack(event);
return event.uniqueId;
}
/// return next event
CustomEvent get() {
_mutex.lock();
scope(exit) _mutex.unlock();
return _events.popFront();
}
/// return event by unique id
CustomEvent get(uint uniqueId) {
_mutex.lock();
scope(exit) _mutex.unlock();
for (int i = 0; i < _events.length; i++) {
if (_events[i].uniqueId == uniqueId) {
return _events.remove(i);
}
}
// not found
return null;
}
}
class TimerInfo {
static __gshared ulong nextId;
this(Widget targetWidget, long intervalMillis) {
_id = ++nextId;
assert(intervalMillis >= 0 && intervalMillis < 7*24*60*60*1000L);
_targetWidget = targetWidget;
_interval = intervalMillis;
_nextTimestamp = currentTimeMillis + _interval;
}
/// cancel timer
void cancel() {
_targetWidget = null;
}
/// cancel timer
void notify() {
if (_targetWidget) {
_nextTimestamp = currentTimeMillis + _interval;
if (!_targetWidget.onTimer(_id)) {
_targetWidget = null;
}
}
}
/// unique Id of timer
@property ulong id() { return _id; }
/// timer interval, milliseconds
@property long interval() { return _interval; }
/// next timestamp to invoke timer at, as per currentTimeMillis()
@property long nextTimestamp() { return _nextTimestamp; }
/// widget to route timer event to
@property Widget targetWidget() { return _targetWidget; }
/// return true if timer is not yet cancelled
@property bool valid() { return _targetWidget !is null; }
protected ulong _id;
protected long _interval;
protected long _nextTimestamp;
protected Widget _targetWidget;
override bool opEquals(Object obj) const {
TimerInfo b = cast(TimerInfo)obj;
if (!b)
return false;
return b._nextTimestamp == _nextTimestamp;
}
override int opCmp(Object obj) {
TimerInfo b = cast(TimerInfo)obj;
if (!b)
return false;
if (valid && !b.valid)
return -1;
if (!valid && b.valid)
return 1;
if (!valid && !b.valid)
return 0;
if (_nextTimestamp < b._nextTimestamp)
return -1;
if (_nextTimestamp > b._nextTimestamp)
return 1;
return 0;
}
}
/**
* Window abstraction layer. Widgets can be shown only inside window.
*
*/
class Window : CustomEventTarget {
protected int _dx;
protected int _dy;
protected uint _keyboardModifiers;
protected uint _backgroundColor;
protected Widget _mainWidget;
protected EventList _eventList;
protected uint _flags;
/// minimal good looking content width
protected int _minContentWidth;
/// minimal good looking content height
protected int _minContentHeight;
// current content width calculated using _windowOrContentResizeMode flag, usually used in measure()
protected int _currentContentWidth;
// current content height calculated using _windowOrContentResizeMode flag, usually used in measure()
protected int _currentContentHeight;
@property uint flags() { return _flags; }
@property uint backgroundColor() const { return _backgroundColor; }
@property void backgroundColor(uint color) { _backgroundColor = color; }
@property int width() const { return _dx; }
@property int height() const { return _dy; }
@property uint keyboardModifiers() const { return _keyboardModifiers; }
@property Widget mainWidget() { return _mainWidget; }
@property void mainWidget(Widget widget) {
if (_mainWidget !is null) {
_mainWidget.window = null;
destroy(_mainWidget);
}
_mainWidget = widget;
if (_mainWidget !is null)
_mainWidget.window = this;
}
protected Rect _caretRect;
/// blinking caret position (empty rect if no blinking caret)
@property void caretRect(Rect rc) { _caretRect = rc; }
@property Rect caretRect() { return _caretRect; }
protected bool _caretReplace;
/// blinking caret is in Replace mode if true, insert mode if false
@property void caretReplace(bool flg) { _caretReplace = flg; }
@property bool caretReplace() { return _caretReplace; }
// window content resize mode
//protected WindowOrContentResizeMode _windowOrContentResizeMode = WindowOrContentResizeMode.resizeWindow;
//protected WindowOrContentResizeMode _windowOrContentResizeMode = WindowOrContentResizeMode.shrinkWidgets;
protected WindowOrContentResizeMode _windowOrContentResizeMode = WindowOrContentResizeMode.scrollWindow;
@property WindowOrContentResizeMode windowOrContentResizeMode() {return _windowOrContentResizeMode; }
@property void windowOrContentResizeMode(WindowOrContentResizeMode newMode) {
_windowOrContentResizeMode = newMode;
if (_mainWidget) {
_mainWidget.measure(SIZE_UNSPECIFIED, SIZE_UNSPECIFIED);
adjustWindowOrContentSize(_mainWidget.measuredWidth, _mainWidget.measuredHeight);
}
}
// Abstract methods : override in platform implementation
/// show window
abstract void show();
/// returns window caption
abstract @property dstring windowCaption();
/// sets window caption
abstract @property void windowCaption(dstring caption);
/// sets window icon
abstract @property void windowIcon(DrawBufRef icon);
/// request window redraw
abstract void invalidate();
/// close window
abstract void close();
protected WindowState _windowState = WindowState.normal;
/// returns current window state
@property WindowState windowState() {
return _windowState;
}
protected Rect _windowRect = RECT_VALUE_IS_NOT_SET;
/// returns window rectangle on screen (includes window frame and title)
@property Rect windowRect() {
if (_windowRect != RECT_VALUE_IS_NOT_SET)
return _windowRect;
// fake window rectangle -- at position 0,0 and
return Rect(0, 0, _dx, _dy);
}
/// window state change signal
Signal!OnWindowStateHandler windowStateChanged;
/// update and signal window state and/or size/positon changes - for using in platform inplementations
protected void handleWindowStateChange(WindowState newState, Rect newWindowRect = RECT_VALUE_IS_NOT_SET) {
if (newState != WindowState.unspecified)
_windowState = newState;
if (newWindowRect != RECT_VALUE_IS_NOT_SET)
_windowRect = newWindowRect;
if (windowStateChanged.assigned)
windowStateChanged(this, newState, newWindowRect);
}
/// change window state, position, or size; returns true if successful, false if not supported by platform
bool setWindowState(WindowState newState, bool activate = false, Rect newWindowRect = RECT_VALUE_IS_NOT_SET) {
// override for particular platforms
return false;
}
/// maximize window
bool maximizeWindow(bool activate = false) { return setWindowState(WindowState.maximized, activate); }
/// minimize window
bool minimizeWindow() { return setWindowState(WindowState.minimized); }
/// restore window if maximized/minimized/hidden
bool restoreWindow(bool activate = false) { return setWindowState(WindowState.normal, activate); }
/// restore window if maximized/minimized/hidden
bool hideWindow() { return setWindowState(WindowState.hidden); }
/// just activate window
bool activateWindow() { return setWindowState(WindowState.unspecified, true); }
/// change window position only
bool moveWindow(Point topLeft, bool activate = false) { return setWindowState(WindowState.unspecified, activate, Rect(topLeft.x, topLeft.y, int.min, int.min)); }
/// change window size only
bool resizeWindow(Point sz, bool activate = false) { return setWindowState(WindowState.unspecified, activate, Rect(int.min, int.min, sz.x, sz.y)); }
/// set window rectangle
bool moveAndResizeWindow(Rect rc, bool activate = false) { return setWindowState(WindowState.unspecified, activate, rc); }
// things needed for WindowOrContentResizeMode.scrollWindow:
/// vertical scrollbar control
protected ScrollBar _vScrollBar = null;
/// horizontal scrollbar control
protected ScrollBar _hScrollBar = null;
/// Sets the minimal content size and adjust window or content should be called from window show
void adjustWindowOrContentSize(int minContentWidth, int minContentHeight) {
_minContentWidth = minContentWidth;
_minContentHeight = minContentHeight;
if (_windowOrContentResizeMode == WindowOrContentResizeMode.resizeWindow)
resizeWindow(Point(minContentWidth, minContentHeight));
updateWindowOrContentSize();
}
/// update current content size based on windowOrContentResizeMode flag, usually used when window is resized
void updateWindowOrContentSize() {
final switch (_windowOrContentResizeMode) {
case WindowOrContentResizeMode.shrinkWidgets: {
_currentContentWidth = _windowRect.right;
_currentContentHeight = _windowRect.bottom;
return;
}
case WindowOrContentResizeMode.resizeWindow: {
//maybe should not permit to resize when new window size is smaller than content size, now do nothing
_currentContentWidth = _windowRect.right;
_currentContentHeight = _windowRect.bottom;
break;
}
case WindowOrContentResizeMode.scrollWindow: {
if (_windowRect.right < _minContentWidth) {
// create scrollbar
_currentContentWidth = _minContentWidth;
if (!_hScrollBar) {
_hScrollBar = new ScrollBar(null,Orientation.Horizontal);
_hScrollBar.scrollEvent = delegate bool (AbstractSlider source, ScrollEvent event) {
if (event.action == ScrollAction.SliderMoved || event.action == ScrollAction.SliderReleased)
requestLayout();
else if (event.action == ScrollAction.PageUp) {
source.position = max(0, source.position - _windowRect.right * 3 / 4);
requestLayout();
} else if (event.action == ScrollAction.PageDown) {
source.position = min(source.maxValue - _windowRect.right, source.position + _windowRect.right *3 / 4);
requestLayout();
} else if (event.action == ScrollAction.LineUp) {
source.position = max(0, source.position - _windowRect.right / 10);
requestLayout();
} else if (event.action == ScrollAction.LineDown) {
source.position = min(source.maxValue - _windowRect.right, source.position + _windowRect.right / 10);
requestLayout();
}
return true;
};
}
_hScrollBar.measure(_windowRect.right, _windowRect.bottom);
if (windowRect().bottom < _minContentHeight)
_hScrollBar.setRange(0, _minContentWidth + _hScrollBar.measuredHeight);
else
_hScrollBar.setRange(0, _minContentWidth);
_hScrollBar.pageSize(_windowRect.right);
_hScrollBar.position(0);
}
else {
if (_hScrollBar) {
destroy(_hScrollBar);
_hScrollBar = null;
}
_currentContentWidth = _windowRect.right;
}
if (windowRect().bottom < _minContentHeight) {
// create scrollbar
_currentContentHeight = _minContentHeight;
if (!_vScrollBar) {
_vScrollBar = new ScrollBar(null,Orientation.Vertical);
_vScrollBar.scrollEvent = delegate bool (AbstractSlider source, ScrollEvent event) {
if (event.action == ScrollAction.SliderMoved || event.action == ScrollAction.SliderReleased)
requestLayout();
else if (event.action == ScrollAction.PageUp) {
source.position = max(0, source.position - _windowRect.bottom * 3 / 4);
requestLayout();
} else if (event.action == ScrollAction.PageDown) {
source.position = min(source.maxValue - _windowRect.bottom, source.position + _windowRect.bottom *3 / 4);
requestLayout();
} else if (event.action == ScrollAction.LineUp) {
source.position = max(0, source.position - _windowRect.bottom / 10);
requestLayout();
} else if (event.action == ScrollAction.LineDown) {
source.position = min(source.maxValue - _windowRect.bottom, source.position + _windowRect.bottom / 10);
requestLayout();
}
return true;
};
}
_vScrollBar.measure(_windowRect.right, _windowRect.bottom);
if (_hScrollBar)
_vScrollBar.setRange(0, _minContentHeight+_hScrollBar.measuredHeight);
else
_vScrollBar.setRange(0, _minContentHeight);
_vScrollBar.pageSize(windowRect().bottom);
_vScrollBar.position(0);
if (!_hScrollBar)
_currentContentWidth = _windowRect.right - _vScrollBar.measuredWidth;
}
else {
if (_vScrollBar) {
destroy(_vScrollBar);
_vScrollBar = null;
}
_currentContentHeight = _hScrollBar ? _windowRect.bottom - _hScrollBar.measuredHeight : _windowRect.bottom;
}
return;
}
}
}
/// requests layout for main widget and popups
void requestLayout() {
if (_mainWidget)
_mainWidget.requestLayout();
if (_hScrollBar)
_hScrollBar.requestLayout();
if (_vScrollBar)
_vScrollBar.requestLayout();
foreach(p; _popups)
p.requestLayout();
if (_tooltip.popup)
_tooltip.popup.requestLayout();
}
void measure() {
if (_hScrollBar)
_hScrollBar.measure(_dx, _dy);
if (_vScrollBar)
_vScrollBar.measure(_dx, _dy);
if (_mainWidget !is null) {
_mainWidget.measure(_currentContentWidth, _currentContentHeight);
}
foreach(p; _popups)
p.measure(_currentContentWidth, _currentContentHeight);
if (_tooltip.popup)
_tooltip.popup.measure(_currentContentWidth, _currentContentHeight);
}
void layout() {
if (_hScrollBar)
_hScrollBar.layout(Rect(0, _dy - _hScrollBar.measuredHeight, _vScrollBar ? _dx - _vScrollBar.measuredWidth : _dx, _dy));
if (_vScrollBar)
_vScrollBar.layout(Rect(_dx - _vScrollBar.measuredWidth, 0, _dx, _hScrollBar ? _dy - _hScrollBar.measuredHeight : _dy));
int deltaX = 0;
if (_hScrollBar)
deltaX = -_hScrollBar.position;
int deltaY = 0;
if (_vScrollBar)
deltaY = -_vScrollBar.position;
Rect rc = Rect(deltaX, deltaY, _currentContentWidth + deltaX, _currentContentHeight + deltaY);
if (_mainWidget !is null) {
_mainWidget.layout(rc);
}
foreach(p; _popups)
p.layout(rc);
if (_tooltip.popup)
_tooltip.popup.layout(rc);
}
void onResize(int width, int height) {
if (_dx == width && _dy == height)
return;
_dx = width;
_dy = height;
// fix window rect for platforms that don't set it yet
_windowRect.right = width;
_windowRect.bottom = height;
if (_mainWidget !is null) {
Log.d("onResize ", _dx, "x", _dy);
long measureStart = currentTimeMillis;
updateWindowOrContentSize();
measure();
//Log.d("measured size: ", _mainWidget.measuredWidth, "x", _mainWidget.measuredHeight);
long measureEnd = currentTimeMillis;
debug Log.d("resize: measure took ", measureEnd - measureStart, " ms");
layout();
long layoutEnd = currentTimeMillis;
debug Log.d("resize: layout took ", layoutEnd - measureEnd, " ms");
//Log.d("layout position: ", _mainWidget.pos);
}
update(true);
}
protected PopupWidget[] _popups;
protected static struct TooltipInfo {
PopupWidget popup;
ulong timerId;
Widget ownerWidget;
uint alignment;
int x;
int y;
}
protected TooltipInfo _tooltip;
/// schedule tooltip for widget be shown with specified delay
void scheduleTooltip(Widget ownerWidget, long delay, uint alignment = PopupAlign.Below, int x = 0, int y = 0) {
_tooltip.alignment = alignment;
_tooltip.x = x;
_tooltip.y = y;
_tooltip.ownerWidget = ownerWidget;
_tooltip.timerId = setTimer(ownerWidget, delay);
}
/// call when tooltip timer is expired
private bool onTooltipTimer() {
_tooltip.timerId = 0;
if (isChild(_tooltip.ownerWidget)) {
Widget w = _tooltip.ownerWidget.createTooltip(_lastMouseX, _lastMouseY, _tooltip.alignment, _tooltip.x, _tooltip.y);
if (w)
showTooltip(w, _tooltip.ownerWidget, _tooltip.alignment, _tooltip.x, _tooltip.y);
}
return false;
}
/// called when user dragged file(s) to application window
void handleDroppedFiles(string[] filenames) {
//Log.d("handleDroppedFiles(", filenames, ")");
if (_onFilesDropped)
_onFilesDropped(filenames);
}
protected void delegate(string[]) _onFilesDropped;
/// get handler for files dropped to app window
@property void delegate(string[]) onFilesDropped() { return _onFilesDropped; }
/// set handler for files dropped to app window
@property Window onFilesDropped(void delegate(string[]) handler) { _onFilesDropped = handler; return this; }
protected bool delegate() _onCanClose;
/// get handler for closing of app (it must return true to allow immediate close, false to cancel close or close window later)
@property bool delegate() onCanClose() { return _onCanClose; }
/// set handler for closing of app (it must return true to allow immediate close, false to cancel close or close window later)
@property Window onCanClose(bool delegate() handler) { _onCanClose = handler; return this; }
protected void delegate() _onClose;
/// get handler for closing of window
@property void delegate() onClose() { return _onClose; }
/// set handler for closing of window
@property Window onClose(void delegate() handler) { _onClose = handler; return this; }
/// returns true if there is some modal window opened above this window, and this window should not process mouse/key input and should not allow closing
bool hasModalWindowsAbove() {
return platform.hasModalWindowsAbove(this);
}
/// calls onCanClose handler if set to check if system may close window
bool handleCanClose() {
if (hasModalWindowsAbove())
return false;
if (!_onCanClose)
return true;
bool res = _onCanClose();
if (!res)
update(true); // redraw window if it was decided to not close immediately
return res;
}
/// hide tooltip if shown and cancel tooltip timer if set
void hideTooltip() {
if (_tooltip.popup) {
destroy(_tooltip.popup);
_tooltip.popup = null;
if (_mainWidget)
_mainWidget.invalidate();
}
if (_tooltip.timerId)
cancelTimer(_tooltip.timerId);
}
/// show tooltip immediately
PopupWidget showTooltip(Widget content, Widget anchor = null, uint alignment = PopupAlign.Center, int x = 0, int y = 0) {
hideTooltip();
if (!content)
return null;
PopupWidget res = new PopupWidget(content, this);
res.anchor.widget = anchor !is null ? anchor : _mainWidget;
res.anchor.alignment = alignment;
res.anchor.x = x;
res.anchor.y = y;
_tooltip.popup = res;
return res;
}
/// show new popup
PopupWidget showPopup(Widget content, Widget anchor = null, uint alignment = PopupAlign.Center, int x = 0, int y = 0) {
PopupWidget res = new PopupWidget(content, this);
res.anchor.widget = anchor !is null ? anchor : _mainWidget;
res.anchor.alignment = alignment;
res.anchor.x = x;
res.anchor.y = y;
_popups ~= res;
if (_mainWidget !is null) {
_mainWidget.requestLayout();
}
update(false);
return res;
}
/// remove popup
bool removePopup(PopupWidget popup) {
if (!popup)
return false;
for (int i = 0; i < _popups.length; i++) {
PopupWidget p = _popups[i];
if (p is popup) {
for (int j = i; j < _popups.length - 1; j++)
_popups[j] = _popups[j + 1];
_popups.length--;
p.onClose();
destroy(p);
// force redraw
_mainWidget.invalidate();
return true;
}
}
return false;
}
/// returns last modal popup widget, or null if no modal popups opened
PopupWidget modalPopup() {
for (int i = cast(int)_popups.length - 1; i >= 0; i--) {
if (_popups[i].flags & PopupFlags.Modal)
return _popups[i];
}
return null;
}
/// returns true if widget is child of either main widget, one of popups or window scrollbar
bool isChild(Widget w) {
if (_mainWidget !is null && _mainWidget.isChild(w))
return true;
foreach(p; _popups)
if (p.isChild(w))
return true;
if (_tooltip.popup)
if (_tooltip.popup.isChild(w))
return true;
if (_hScrollBar !is null && _hScrollBar.isChild(w))
return true;
if (_vScrollBar !is null && _vScrollBar.isChild(w))
return true;
return false;
}
private long lastDrawTs;
this() {
_eventList = new EventList();
_timerQueue = new TimerQueue();
_backgroundColor = 0xFFFFFF;
if (currentTheme)
_backgroundColor = currentTheme.customColor(STYLE_COLOR_WINDOW_BACKGROUND);
}
~this() {
debug Log.d("Destroying window");
if (_onClose)
_onClose();
if (_tooltip.popup) {
destroy(_tooltip.popup);
_tooltip.popup = null;
}
foreach(p; _popups)
destroy(p);
_popups = null;
if (_mainWidget !is null) {
destroy(_mainWidget);
_mainWidget = null;
}
if (_hScrollBar) {
destroy(_hScrollBar);
_hScrollBar = null;
}
if (_vScrollBar) {
destroy(_vScrollBar);
_vScrollBar = null;
}
destroy(_eventList);
destroy(_timerQueue);
_eventList = null;
}
/**
Allows queue destroy of widget.
Sometimes when you have very complicated UI with dynamic create/destroy lists of widgets calling simple destroy()
on widget makes segmentation fault.
Usually because you destroy widget that on some stage call another that tries to destroy widget that calls it.
When the control flow returns widget not exist and you have seg. fault.
This function use internally $(LINK2 $(DDOX_ROOT_DIR)dlangui/core/events/QueueDestroyEvent.html, QueueDestroyEvent).
*/
void queueWidgetDestroy(Widget widgetToDestroy)
{
QueueDestroyEvent ev = new QueueDestroyEvent(widgetToDestroy);
postEvent(ev);
}
private void animate(Widget root, long interval) {
if (root is null)
return;
if (root.visibility != Visibility.Visible)
return;
for (int i = 0; i < root.childCount; i++)
animate(root.child(i), interval);
if (root.animating)
root.animate(interval);
}
private void animate(long interval) {
animate(_mainWidget, interval);
foreach(p; _popups)
p.animate(interval);
if (_tooltip.popup)
_tooltip.popup.animate(interval);
}
static immutable int PERFORMANCE_LOGGING_THRESHOLD_MS = 20;
/// set when first draw is called: don't handle mouse/key input until draw (layout) is called
protected bool _firstDrawCalled = false;
void onDraw(DrawBuf buf) {
_firstDrawCalled = true;
static import std.datetime;
try {
bool needDraw = false;
bool needLayout = false;
bool animationActive = false;
checkUpdateNeeded(needDraw, needLayout, animationActive);
if (needLayout || animationActive)
needDraw = true;
long ts = std.datetime.Clock.currStdTime;
if (animationActive && lastDrawTs != 0) {
animate(ts - lastDrawTs);
// layout required flag could be changed during animate - check again
checkUpdateNeeded(needDraw, needLayout, animationActive);
}
lastDrawTs = ts;
if (needLayout) {
long measureStart = currentTimeMillis;
measure();
long measureEnd = currentTimeMillis;
if (measureEnd - measureStart > PERFORMANCE_LOGGING_THRESHOLD_MS) {
debug(DebugRedraw) Log.d("measure took ", measureEnd - measureStart, " ms");
}
layout();
long layoutEnd = currentTimeMillis;
if (layoutEnd - measureEnd > PERFORMANCE_LOGGING_THRESHOLD_MS) {
debug(DebugRedraw) Log.d("layout took ", layoutEnd - measureEnd, " ms");
}
//checkUpdateNeeded(needDraw, needLayout, animationActive);
}
long drawStart = currentTimeMillis;
// draw main widget
_mainWidget.onDraw(buf);
PopupWidget modal = modalPopup();
// draw popups
foreach(p; _popups) {
if (p is modal) {
// TODO: get shadow color from theme
buf.fillRect(Rect(0, 0, buf.width, buf.height), 0xD0404040);
}
p.onDraw(buf);
}
if (_tooltip.popup)
_tooltip.popup.onDraw(buf);
if (_hScrollBar)
_hScrollBar.onDraw(buf);
if (_vScrollBar)
_vScrollBar.onDraw(buf);
if (_hScrollBar && _vScrollBar)
buf.fillRect(Rect(_vScrollBar.left, _hScrollBar.top, buf.width, buf.height), _backgroundColor);
long drawEnd = currentTimeMillis;
debug(DebugRedraw) {
if (drawEnd - drawStart > PERFORMANCE_LOGGING_THRESHOLD_MS)
Log.d("draw took ", drawEnd - drawStart, " ms");
}
if (animationActive)
scheduleAnimation();
_actionsUpdateRequested = false;
} catch (Exception e) {
Log.e("Exception inside winfow.onDraw: ", e);
}
}
/// after drawing, call to schedule redraw if animation is active
void scheduleAnimation() {
// override if necessary
}
protected void setCaptureWidget(Widget w, MouseEvent event) {
_mouseCaptureWidget = w;
_mouseCaptureButtons = event.flags & (MouseFlag.LButton|MouseFlag.RButton|MouseFlag.MButton);
}
protected Widget _focusedWidget;
/// returns current focused widget
@property Widget focusedWidget() {
if (!isChild(_focusedWidget))
_focusedWidget = null;
return _focusedWidget;
}
/// change focus to widget
Widget setFocus(Widget newFocus, FocusReason reason = FocusReason.Unspecified) {
if (!isChild(_focusedWidget))
_focusedWidget = null;
Widget oldFocus = _focusedWidget;
auto targetState = State.Focused;
if(reason == FocusReason.TabFocus)
targetState = State.Focused | State.KeyboardFocused;
if (oldFocus is newFocus)
return oldFocus;
if (oldFocus !is null) {
oldFocus.resetState(targetState);
if (oldFocus)
oldFocus.focusGroupFocused(false);
}
if (newFocus is null || isChild(newFocus)) {
if (newFocus !is null) {
// when calling, setState(focused), window.focusedWidget is still previously focused widget
debug(DebugFocus) Log.d("new focus: ", newFocus.id);
newFocus.setState(targetState);
}
_focusedWidget = newFocus;
if (_focusedWidget)
_focusedWidget.focusGroupFocused(true);
// after focus change, ask for actions update automatically
//requestActionsUpdate();
}
return _focusedWidget;
}
/// dispatch key event to widgets which have wantsKeyTracking == true
protected bool dispatchKeyEvent(Widget root, KeyEvent event) {
if (root.visibility != Visibility.Visible)
return false;
if (root.wantsKeyTracking) {
if (root.onKeyEvent(event))
return true;
}
for (int i = 0; i < root.childCount; i++) {
Widget w = root.child(i);
if (dispatchKeyEvent(w, event))
return true;
}
return false;
}
/// dispatch keyboard event
bool dispatchKeyEvent(KeyEvent event) {
if (hasModalWindowsAbove() || !_firstDrawCalled)
return false;
bool res = false;
hideTooltip();
PopupWidget modal = modalPopup();
if (event.action == KeyAction.KeyDown || event.action == KeyAction.KeyUp) {
_keyboardModifiers = event.flags;
if (event.keyCode == KeyCode.ALT || event.keyCode == KeyCode.LALT || event.keyCode == KeyCode.RALT) {
debug(DebugKeys) Log.d("ALT key: keyboardModifiers = ", _keyboardModifiers);
if (_mainWidget) {
_mainWidget.invalidate();
res = true;
}
}
}
if (event.action == KeyAction.Text) {
// filter text
if (event.text.length < 1)
return res;
dchar ch = event.text[0];
if (ch < ' ' || ch == 0x7F) // filter out control symbols
return res;
}
Widget focus = focusedWidget;
if (!modal || modal.isChild(focus)) {
while (focus) {
if (focus.onKeyEvent(event))
return true; // processed by focused widget
if (focus.focusGroup)
break;
focus = focus.parent;
}
}
if (modal) {
if (dispatchKeyEvent(modal, event))
return res;
return modal.onKeyEvent(event) || res;
} else if (_mainWidget) {
if (dispatchKeyEvent(_mainWidget, event))
return res;
return _mainWidget.onKeyEvent(event) || res;
}
return res;
}
protected bool dispatchMouseEvent(Widget root, MouseEvent event, ref bool cursorIsSet) {
// only route mouse events to visible widgets
if (root.visibility != Visibility.Visible)
return false;
if (!root.isPointInside(event.x, event.y))
return false;
// offer event to children first
for (int i = 0; i < root.childCount; i++) {
Widget child = root.child(i);
if (dispatchMouseEvent(child, event, cursorIsSet))
return true;
}
if (event.action == MouseAction.Move && !cursorIsSet) {
uint cursorType = root.getCursorType(event.x, event.y);
if (cursorType != CursorType.Parent) {
setCursorType(cursorType);
cursorIsSet = true;
}
}
// if not processed by children, offer event to root
if (sendAndCheckOverride(root, event)) {
debug(DebugMouseEvents) Log.d("MouseEvent is processed");
if (event.action == MouseAction.ButtonDown && _mouseCaptureWidget is null && !event.doNotTrackButtonDown) {
debug(DebugMouseEvents) Log.d("Setting active widget");
setCaptureWidget(root, event);
} else if (event.action == MouseAction.Move) {
addTracking(root);
}
return true;
}
return false;
}
/// widget which tracks Move events
//protected Widget _mouseTrackingWidget;
protected Widget[] _mouseTrackingWidgets;
private void addTracking(Widget w) {
for(int i = 0; i < _mouseTrackingWidgets.length; i++)
if (w is _mouseTrackingWidgets[i])
return;
//foreach(widget; _mouseTrackingWidgets)
// if (widget is w)
// return;
//Log.d("addTracking ", w.id, " items before: ", _mouseTrackingWidgets.length);
_mouseTrackingWidgets ~= w;
//Log.d("addTracking ", w.id, " items after: ", _mouseTrackingWidgets.length);
}
private bool checkRemoveTracking(MouseEvent event) {
bool res = false;
for(int i = cast(int)_mouseTrackingWidgets.length - 1; i >=0; i--) {
Widget w = _mouseTrackingWidgets[i];
if (!isChild(w)) {
// std.algorithm.remove does not work for me
//_mouseTrackingWidgets.remove(i);
for (int j = i; j < _mouseTrackingWidgets.length - 1; j++)
_mouseTrackingWidgets[j] = _mouseTrackingWidgets[j + 1];
_mouseTrackingWidgets.length--;
continue;
}
if (event.action == MouseAction.Leave || !w.isPointInside(event.x, event.y)) {
// send Leave message
MouseEvent leaveEvent = new MouseEvent(event);
leaveEvent.changeAction(MouseAction.Leave);
res = w.onMouseEvent(leaveEvent) || res;
// std.algorithm.remove does not work for me
//Log.d("removeTracking ", w.id, " items before: ", _mouseTrackingWidgets.length);
//_mouseTrackingWidgets.remove(i);
//_mouseTrackingWidgets.length--;
for (int j = i; j < _mouseTrackingWidgets.length - 1; j++)
_mouseTrackingWidgets[j] = _mouseTrackingWidgets[j + 1];
_mouseTrackingWidgets.length--;
//Log.d("removeTracking ", w.id, " items after: ", _mouseTrackingWidgets.length);
}
}
return res;
}
/// widget which tracks all events after processed ButtonDown
protected Widget _mouseCaptureWidget;
protected ushort _mouseCaptureButtons;
protected bool _mouseCaptureFocusedOut;
/// does current capture widget want to receive move events even if pointer left it
protected bool _mouseCaptureFocusedOutTrackMovements;
protected void clearMouseCapture() {
_mouseCaptureWidget = null;
_mouseCaptureFocusedOut = false;
_mouseCaptureFocusedOutTrackMovements = false;
_mouseCaptureButtons = 0;
}
protected bool dispatchCancel(MouseEvent event) {
event.changeAction(MouseAction.Cancel);
bool res = _mouseCaptureWidget.onMouseEvent(event);
clearMouseCapture();
return res;
}
protected bool sendAndCheckOverride(Widget widget, MouseEvent event) {
if (!isChild(widget))
return false;
bool res = widget.onMouseEvent(event);
if (event.trackingWidget !is null && _mouseCaptureWidget !is event.trackingWidget) {
setCaptureWidget(event.trackingWidget, event);
}
return res;
}
/// returns true if mouse is currently captured
bool isMouseCaptured() {
return (_mouseCaptureWidget !is null && isChild(_mouseCaptureWidget));
}
/// dispatch action to main widget
bool dispatchAction(const Action action, Widget sourceWidget = null) {
// try to handle by source widget
if(sourceWidget && isChild(sourceWidget)) {
if (sourceWidget.handleAction(action))
return true;
sourceWidget = sourceWidget.parent;
}
Widget focus = focusedWidget;
// then offer action to focused widget
if (focus && isChild(focus)) {
if (focus.handleAction(action))
return true;
focus = focus.parent;
}
// then offer to parent chain of source widget
while (sourceWidget && isChild(sourceWidget)) {
if (sourceWidget.handleAction(action))
return true;
sourceWidget = sourceWidget.parent;
}
// then offer to parent chain of focused widget
while (focus && isChild(focus)) {
if (focus.handleAction(action))
return true;
focus = focus.parent;
}
if (_mainWidget)
return _mainWidget.handleAction(action);
return false;
}
/// dispatch action to main widget
bool dispatchActionStateRequest(const Action action, Widget sourceWidget = null) {
// try to handle by source widget
if(sourceWidget && isChild(sourceWidget)) {
if (sourceWidget.handleActionStateRequest(action))
return true;
sourceWidget = sourceWidget.parent;
}
Widget focus = focusedWidget;
// then offer action to focused widget
if (focus && isChild(focus)) {
if (focus.handleActionStateRequest(action))
return true;
focus = focus.parent;
}
// then offer to parent chain of source widget
while (sourceWidget && isChild(sourceWidget)) {
if (sourceWidget.handleActionStateRequest(action))
return true;
sourceWidget = sourceWidget.parent;
}
// then offer to parent chain of focused widget
while (focus && isChild(focus)) {
if (focus.handleActionStateRequest(action))
return true;
focus = focus.parent;
}
if (_mainWidget)
return _mainWidget.handleActionStateRequest(action);
return false;
}
/// handle theme change: e.g. reload some themed resources
void dispatchThemeChanged() {
if (_hScrollBar)
_hScrollBar.onThemeChanged();
if (_vScrollBar)
_vScrollBar.onThemeChanged();
if (_mainWidget)
_mainWidget.onThemeChanged();
// draw popups
foreach(p; _popups) {
p.onThemeChanged();
}
if (_tooltip.popup)
_tooltip.popup.onThemeChanged();
if (currentTheme) {
_backgroundColor = currentTheme.customColor(STYLE_COLOR_WINDOW_BACKGROUND);
}
invalidate();
}
/// post event to handle in UI thread (this method can be used from background thread)
void postEvent(CustomEvent event) {
// override to post event into window message queue
_eventList.put(event);
}
/// post task to execute in UI thread (this method can be used from background thread)
void executeInUiThread(void delegate() runnable) {
RunnableEvent event = new RunnableEvent(CUSTOM_RUNNABLE, null, runnable);
postEvent(event);
}
/// Creates async socket
AsyncSocket createAsyncSocket(AsyncSocketCallback callback) {
AsyncClientConnection conn = new AsyncClientConnection(new AsyncSocketCallbackProxy(callback, &executeInUiThread));
return conn;
}
/// remove event from queue by unique id if not yet dispatched (this method can be used from background thread)
void cancelEvent(uint uniqueId) {
CustomEvent ev = _eventList.get(uniqueId);
if (ev) {
//destroy(ev);
}
}
/// remove event from queue by unique id if not yet dispatched and dispatch it
void handlePostedEvent(uint uniqueId) {
CustomEvent ev = _eventList.get(uniqueId);
if (ev) {
dispatchCustomEvent(ev);
}
}
/// handle all events from queue, if any (call from UI thread only)
void handlePostedEvents() {
for(;;) {
CustomEvent e = _eventList.get();
if (!e)
break;
dispatchCustomEvent(e);
}
}
/// dispatch custom event
bool dispatchCustomEvent(CustomEvent event) {
if (event.destinationWidget) {
if (!isChild(event.destinationWidget)) {
//Event is sent to widget which does not exist anymore
return false;
}
return event.destinationWidget.onEvent(event);
} else {
// no destination widget
RunnableEvent runnable = cast(RunnableEvent)event;
if (runnable) {
// handle runnable
runnable.run();
return true;
}
}
return false;
}
private int _lastMouseX;
private int _lastMouseY;
/// dispatch mouse event to window content widgets
bool dispatchMouseEvent(MouseEvent event) {
if (hasModalWindowsAbove() || !_firstDrawCalled)
return false;
// ignore events if there is no root
if (_mainWidget is null)
return false;
bool actualChange = true;
if (event.action == MouseAction.Move) {
actualChange = (_lastMouseX != event.x || _lastMouseY != event.y);
_lastMouseX = event.x;
_lastMouseY = event.y;
}
if (actualChange) hideTooltip();
PopupWidget modal = modalPopup();
// check if _mouseCaptureWidget and _mouseTrackingWidget still exist in child of root widget
if (_mouseCaptureWidget !is null && (!isChild(_mouseCaptureWidget) || (modal && !modal.isChild(_mouseCaptureWidget)))) {
clearMouseCapture();
}
debug(DebugMouseEvents) Log.d("dispatchMouseEvent ", event.action, " (", event.x, ",", event.y, ")");
bool res = false;
ushort currentButtons = event.flags & (MouseFlag.LButton|MouseFlag.RButton|MouseFlag.MButton);
if (_mouseCaptureWidget !is null) {
// try to forward message directly to active widget
if (event.action == MouseAction.Move) {
debug(DebugMouseEvents) Log.d("dispatchMouseEvent: Move; buttons state=", currentButtons);
if (!_mouseCaptureWidget.isPointInside(event.x, event.y)) {
if (currentButtons != _mouseCaptureButtons) {
debug(DebugMouseEvents) Log.d("dispatchMouseEvent: Move; buttons state changed from ", _mouseCaptureButtons, " to ", currentButtons, " - cancelling capture");
return dispatchCancel(event);
}
// point is no more inside of captured widget
if (!_mouseCaptureFocusedOut) {
// sending FocusOut message
event.changeAction(MouseAction.FocusOut);
_mouseCaptureFocusedOut = true;
_mouseCaptureButtons = currentButtons;
_mouseCaptureFocusedOutTrackMovements = sendAndCheckOverride(_mouseCaptureWidget, event);
return true;
} else if (_mouseCaptureFocusedOutTrackMovements) {
// pointer is outside, but we still need to track pointer
return sendAndCheckOverride(_mouseCaptureWidget, event);
}
// don't forward message
return true;
} else {
// point is inside widget
if (_mouseCaptureFocusedOut) {
_mouseCaptureFocusedOut = false;
if (currentButtons != _mouseCaptureButtons)
return dispatchCancel(event);
event.changeAction(MouseAction.FocusIn); // back in after focus out
}
return sendAndCheckOverride(_mouseCaptureWidget, event);
}
} else if (event.action == MouseAction.Leave) {
if (!_mouseCaptureFocusedOut) {
// sending FocusOut message
event.changeAction(MouseAction.FocusOut);
_mouseCaptureFocusedOut = true;
_mouseCaptureButtons = event.flags & (MouseFlag.LButton|MouseFlag.RButton|MouseFlag.MButton);
return sendAndCheckOverride(_mouseCaptureWidget, event);
} else {
debug(DebugMouseEvents) Log.d("dispatchMouseEvent: mouseCaptureFocusedOut + Leave - cancelling capture");
return dispatchCancel(event);
}
} else if (event.action == MouseAction.ButtonDown || event.action == MouseAction.ButtonUp) {
if (!_mouseCaptureWidget.isPointInside(event.x, event.y)) {
if (currentButtons != _mouseCaptureButtons) {
debug(DebugMouseEvents) Log.d("dispatchMouseEvent: ButtonUp/ButtonDown; buttons state changed from ", _mouseCaptureButtons, " to ", currentButtons, " - cancelling capture");
return dispatchCancel(event);
}
}
}
// other messages
res = sendAndCheckOverride(_mouseCaptureWidget, event);
if (!currentButtons) {
// usable capturing - no more buttons pressed
debug(DebugMouseEvents) Log.d("unsetting active widget");
clearMouseCapture();
}
return res;
}
bool processed = false;
if (event.action == MouseAction.Move || event.action == MouseAction.Leave) {
processed = checkRemoveTracking(event);
}
bool cursorIsSet = false;
if (!res) {
bool insideOneOfPopups = false;
for (int i = cast(int)_popups.length - 1; i >= 0; i--) {
auto p = _popups[i];
if (p.isPointInside(event.x, event.y)) {
if (p !is modal)
insideOneOfPopups = true;
}
if (p is modal)
break;
}
for (int i = cast(int)_popups.length - 1; i >= 0; i--) {
auto p = _popups[i];
if (p is modal)
break;
if (!insideOneOfPopups) {
if (p.onMouseEventOutside(event)) // stop loop when true is returned, but allow other main widget to handle event
break;
} else {
if (dispatchMouseEvent(p, event, cursorIsSet))
return true;
}
}
if (!modal) {
res = false;
if (_hScrollBar)
res = dispatchMouseEvent(_hScrollBar, event, cursorIsSet);
if (!res && _vScrollBar)
res = dispatchMouseEvent(_vScrollBar, event, cursorIsSet);
if (!res)
res = dispatchMouseEvent(_mainWidget, event, cursorIsSet);
}
else {
if (_hScrollBar)
res = dispatchMouseEvent(_hScrollBar, event, cursorIsSet);
if (!res && _vScrollBar)
res = dispatchMouseEvent(_vScrollBar, event, cursorIsSet);
if (!res)
res = dispatchMouseEvent(modal, event, cursorIsSet);
}
}
return res || processed || _mainWidget.needDraw;
}
/// calls update actions recursively
protected void dispatchWidgetUpdateActionStateRecursive(Widget root) {
if (root is null)
return;
root.updateActionState(true);
for (int i = 0; i < root.childCount; i++)
dispatchWidgetUpdateActionStateRecursive(root.child(i));
}
/// checks content widgets for necessary redraw and/or layout
protected void checkUpdateNeeded(Widget root, ref bool needDraw, ref bool needLayout, ref bool animationActive) {
if (root is null)
return;
if (root.visibility != Visibility.Visible)
return;
needDraw = root.needDraw || needDraw;
if (!needLayout) {
needLayout = root.needLayout || needLayout;
if (needLayout) {
debug(DebugRedraw) Log.d("need layout: ", root.classinfo.name, " id=", root.id);
}
}
if (root.animating && root.visible)
animationActive = true; // check animation only for visible widgets
for (int i = 0; i < root.childCount; i++)
checkUpdateNeeded(root.child(i), needDraw, needLayout, animationActive);
}
/// sets cursor type for window
protected void setCursorType(uint cursorType) {
// override to support different mouse cursors
}
/// update action states
protected void dispatchWidgetUpdateActionStateRecursive() {
if (_mainWidget !is null)
dispatchWidgetUpdateActionStateRecursive(_mainWidget);
foreach(p; _popups)
dispatchWidgetUpdateActionStateRecursive(p);
}
/// checks content widgets for necessary redraw and/or layout
bool checkUpdateNeeded(ref bool needDraw, ref bool needLayout, ref bool animationActive) {
if (_actionsUpdateRequested) {
// call update action check - as requested
dispatchWidgetUpdateActionStateRecursive();
_actionsUpdateRequested = false;
}
needDraw = needLayout = animationActive = false;
if (_mainWidget is null)
return false;
checkUpdateNeeded(_mainWidget, needDraw, needLayout, animationActive);
if (_hScrollBar)
checkUpdateNeeded(_hScrollBar, needDraw, needLayout, animationActive);
if (_vScrollBar)
checkUpdateNeeded(_vScrollBar, needDraw, needLayout, animationActive);
foreach(p; _popups)
checkUpdateNeeded(p, needDraw, needLayout, animationActive);
if (_tooltip.popup)
checkUpdateNeeded(_tooltip.popup, needDraw, needLayout, animationActive);
return needDraw || needLayout || animationActive;
}
protected bool _animationActive;
@property bool isAnimationActive() {
return _animationActive;
}
/// requests update for window (unless force is true, update will be performed only if layout, redraw or animation is required).
void update(bool force = false) {
if (_mainWidget is null)
return;
bool needDraw = false;
bool needLayout = false;
_animationActive = false;
if (checkUpdateNeeded(needDraw, needLayout, _animationActive) || force) {
debug(DebugRedraw) Log.d("Requesting update");
invalidate();
}
debug(DebugRedraw) Log.d("checkUpdateNeeded returned needDraw=", needDraw, " needLayout=", needLayout, " animationActive=", _animationActive);
}
protected bool _actionsUpdateRequested = true;
/// set action update request flag, will be cleared after redraw
void requestActionsUpdate(bool immediateUpdate = false) {
if (!immediateUpdate)
_actionsUpdateRequested = true;
else
dispatchWidgetUpdateActionStateRecursive();
}
@property bool actionsUpdateRequested() {
return _actionsUpdateRequested;
}
/// Show message box with specified title and message (title and message as UIString)
void showMessageBox(UIString title, UIString message, const (Action)[] actions = [ACTION_OK], int defaultActionIndex = 0, bool delegate(const Action result) handler = null) {
import dlangui.dialogs.msgbox;
MessageBox dlg = new MessageBox(title, message, this, actions, defaultActionIndex, handler);
dlg.show();
}
/// Show message box with specified title and message (title and message as dstring)
void showMessageBox(dstring title, dstring message, const (Action)[] actions = [ACTION_OK], int defaultActionIndex = 0, bool delegate(const Action result) handler = null) {
showMessageBox(UIString.fromRaw(title), UIString.fromRaw(message), actions, defaultActionIndex, handler);
}
static if (BACKEND_GUI) {
void showInputBox(UIString title, UIString message, dstring initialText, void delegate(dstring result) handler) {
import dlangui.dialogs.inputbox;
InputBox dlg = new InputBox(title, message, this, initialText, handler);
dlg.show();
}
}
void showInputBox(dstring title, dstring message, dstring initialText, void delegate(dstring result) handler) {
showInputBox(UIString.fromRaw(title), UIString.fromRaw(message), initialText, handler);
}
protected TimerQueue _timerQueue;
/// schedule timer for interval in milliseconds - call window.onTimer when finished
protected void scheduleSystemTimer(long intervalMillis) {
//debug Log.d("override scheduleSystemTimer to support timers");
}
/// poll expired timers; returns true if update is needed
bool pollTimers() {
bool res = _timerQueue.notify();
if (res)
update(false);
return res;
}
/// system timer interval expired - notify queue
protected void onTimer() {
//Log.d("window.onTimer");
bool res = _timerQueue.notify();
//Log.d("window.onTimer after notify");
if (res) {
// check if update needed and redraw if so
//Log.d("before update");
update(false);
//Log.d("after update");
}
//Log.d("schedule next timer");
long nextInterval = _timerQueue.nextIntervalMillis();
if (nextInterval > 0) {
scheduleSystemTimer(nextInterval);
}
//Log.d("schedule next timer done");
}
/// set timer for destination widget - destination.onTimer() will be called after interval expiration; returns timer id
ulong setTimer(Widget destination, long intervalMillis) {
if (!isChild(destination)) {
Log.e("setTimer() is called not for child widget of window");
return 0;
}
ulong res = _timerQueue.add(destination, intervalMillis);
long nextInterval = _timerQueue.nextIntervalMillis();
if (nextInterval > 0) {
scheduleSystemTimer(intervalMillis);
}
return res;
}
/// cancel previously scheduled widget timer (for timerId pass value returned from setTimer)
void cancelTimer(ulong timerId) {
_timerQueue.cancelTimer(timerId);
}
/// timers queue
private class TimerQueue {
protected TimerInfo[] _queue;
/// add new timer
ulong add(Widget destination, long intervalMillis) {
TimerInfo item = new TimerInfo(destination, intervalMillis);
_queue ~= item;
sort(_queue);
return item.id;
}
/// cancel timer
void cancelTimer(ulong timerId) {
if (!_queue.length)
return;
for (int i = cast(int)_queue.length - 1; i >= 0; i--) {
if (_queue[i].id == timerId) {
_queue[i].cancel();
break;
}
}
}
/// returns interval if millis of next scheduled event or -1 if no events queued
long nextIntervalMillis() {
if (!_queue.length || !_queue[0].valid)
return -1;
long delta = _queue[0].nextTimestamp - currentTimeMillis;
if (delta < 1)
delta = 1;
return delta;
}
private void cleanup() {
if (!_queue.length)
return;
sort(_queue);
size_t newsize = _queue.length;
for (int i = cast(int)_queue.length - 1; i >= 0; i--) {
if (!_queue[i].valid) {
newsize = i;
}
}
if (_queue.length > newsize)
_queue.length = newsize;
}
private TimerInfo[] expired() {
if (!_queue.length)
return null;
long ts = currentTimeMillis;
TimerInfo[] res;
for (int i = 0; i < _queue.length; i++) {
if (_queue[i].nextTimestamp <= ts)
res ~= _queue[i];
}
return res;
}
/// returns true if at least one widget was notified
bool notify() {
bool res = false;
checkValidWidgets();
TimerInfo[] list = expired();
if (list) {
for (int i = 0; i < list.length; i++) {
if (_queue[i].id == _tooltip.timerId) {
// special case for tooltip timer
onTooltipTimer();
_queue[i].cancel();
res = true;
} else {
Widget w = _queue[i].targetWidget;
if (w && !isChild(w))
_queue[i].cancel();
else {
_queue[i].notify();
res = true;
}
}
}
}
cleanup();
return res;
}
private void checkValidWidgets() {
for (int i = 0; i < _queue.length; i++) {
Widget w = _queue[i].targetWidget;
if (w && !isChild(w))
_queue[i].cancel();
}
cleanup();
}
}
}
/**
* Platform abstraction layer.
*
* Represents application.
*
*
*
*/
class Platform {
static __gshared Platform _instance;
static void setInstance(Platform instance) {
if (_instance)
destroy(_instance);
_instance = instance;
}
@property static Platform instance() {
return _instance;
}
/**
* create window
* Args:
* windowCaption = window caption text
* parent = parent Window, or null if no parent
* flags = WindowFlag bit set, combination of Resizable, Modal, Fullscreen
* width = window width
* height = window height
*
* Window w/o Resizable nor Fullscreen will be created with size based on measurement of its content widget
*/
abstract Window createWindow(dstring windowCaption, Window parent, uint flags = WindowFlag.Resizable, uint width = 0, uint height = 0);
static if (ENABLE_OPENGL) {
/**
* OpenGL context major version.
* Note: if the version is invalid or not supported, this value will be set to supported one.
*/
int GLVersionMajor = 3;
/**
* OpenGL context minor version.
* Note: if the version is invalid or not supported, this value will be set to supported one.
*/
int GLVersionMinor = 2;
}
/**
* close window
*
* Closes window earlier created with createWindow()
*/
abstract void closeWindow(Window w);
/**
* Starts application message loop.
*
* When returned from this method, application is shutting down.
*/
abstract int enterMessageLoop();
/// retrieves text from clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux)
abstract dstring getClipboardText(bool mouseBuffer = false);
/// sets text to clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux)
abstract void setClipboardText(dstring text, bool mouseBuffer = false);
/// calls request layout for all windows
abstract void requestLayout();
/// returns true if there is some modal window opened above this window, and this window should not process mouse/key input and should not allow closing
bool hasModalWindowsAbove(Window w) {
// override in platform specific class
return false;
}
protected string _uiLanguage;
/// returns currently selected UI language code
@property string uiLanguage() {
return _uiLanguage;
}
/// set UI language (e.g. "en", "fr", "ru") - will relayout content of all windows if language has been changed
@property Platform uiLanguage(string langCode) {
if (_uiLanguage.equal(langCode))
return this;
_uiLanguage = langCode;
Log.v("Loading language file");
if (langCode.equal("en"))
i18n.load("en.ini"); //"ru.ini", "en.ini"
else
i18n.load(langCode ~ ".ini", "en.ini");
Log.v("Calling onThemeChanged");
onThemeChanged();
requestLayout();
return this;
}
protected string _themeId;
@property string uiTheme() {
return _themeId;
}
/// sets application UI theme - will relayout content of all windows if theme has been changed
@property Platform uiTheme(string themeResourceId) {
if (_themeId.equal(themeResourceId))
return this;
Log.v("uiTheme setting new theme ", themeResourceId);
_themeId = themeResourceId;
Theme theme = loadTheme(themeResourceId);
if (!theme) {
Log.e("Cannot load theme from resource ", themeResourceId, " - will use default theme");
theme = createDefaultTheme();
} else {
Log.i("Applying loaded theme ", theme.id);
}
currentTheme = theme;
onThemeChanged();
requestLayout();
return this;
}
/// to set uiLanguage and themeId to default (en, theme_default) if not set yet
protected void setDefaultLanguageAndThemeIfNecessary() {
if (!_uiLanguage) {
Log.v("setDefaultLanguageAndThemeIfNecessary : setting UI language");
uiLanguage = "en";
}
if (!_themeId) {
Log.v("setDefaultLanguageAndThemeIfNecessary : setting UI theme");
uiTheme = "theme_default";
}
}
protected ulong _uiDialogDisplayMode = DialogDisplayMode.messageBoxInPopup | DialogDisplayMode.inputBoxInPopup;
/// returns how dialogs should be displayed - as popup or window
@property ulong uiDialogDisplayMode() {
return _uiDialogDisplayMode;
}
// sets how dialogs should be displayed - as popup or window - use DialogDisplayMode enumeration
@property Platform uiDialogDisplayMode(ulong newDialogDisplayMode) {
_uiDialogDisplayMode = newDialogDisplayMode;
return this;
}
protected string[] _resourceDirs;
/// returns list of resource directories
@property string[] resourceDirs() { return _resourceDirs; }
/// set list of directories to load resources from
@property Platform resourceDirs(string[] dirs) {
// setup resource directories - will use only existing directories
drawableCache.setResourcePaths(dirs);
_resourceDirs = drawableCache.resourcePaths;
// setup i18n - look for i18n directory inside one of passed directories
i18n.findTranslationsDir(dirs);
return this;
}
/// open url in external browser
bool openURL(string url) {
import std.process;
browse(url);
return true;
}
/// show directory or file in OS file manager (explorer, finder, etc...)
bool showInFileManager(string pathName) {
static import dlangui.core.filemanager;
return dlangui.core.filemanager.showInFileManager(pathName);
}
/// handle theme change: e.g. reload some themed resources
void onThemeChanged() {
// override and call dispatchThemeChange for all windows
}
}
/// get current platform object instance
@property Platform platform() {
return Platform.instance;
}
static if (ENABLE_OPENGL) {
private __gshared bool _OPENGL_ENABLED = true;
/// check if hardware acceleration is enabled
@property bool openglEnabled() { return _OPENGL_ENABLED; }
/// call on app initialization if OpenGL support is detected
void setOpenglEnabled(bool enabled = true) {
_OPENGL_ENABLED = enabled;
if (enabled)
glyphDestroyCallback = &onGlyphDestroyedCallback;
else
glyphDestroyCallback = null;
}
} else {
@property bool openglEnabled() { return false; }
void setOpenglEnabled(bool enabled = true) {
// ignore
}
}
static if (BACKEND_CONSOLE) {
// to remove import
extern(C) int DLANGUImain(string[] args);
} else {
version (Windows) {
// to remove import
extern(Windows) int DLANGUIWinMain(void* hInstance, void* hPrevInstance,
char* lpCmdLine, int nCmdShow);
} else {
// to remove import
extern(C) int DLANGUImain(string[] args);
}
}
/// put "mixin APP_ENTRY_POINT;" to main module of your dlangui based app
mixin template APP_ENTRY_POINT() {
static if (BACKEND_CONSOLE) {
int main(string[] args)
{
return DLANGUImain(args);
}
} else {
/// workaround for link issue when WinMain is located in library
version(Windows) {
extern (Windows) int WinMain(void* hInstance, void* hPrevInstance,
char* lpCmdLine, int nCmdShow)
{
try {
int res = DLANGUIWinMain(hInstance, hPrevInstance,
lpCmdLine, nCmdShow);
return res;
} catch (Exception e) {
Log.e("Exception: ", e);
return 1;
}
}
} else {
version (Android) {
} else {
int main(string[] args)
{
return DLANGUImain(args);
}
}
}
}
}
/// initialize font manager on startup
extern(C) bool initFontManager();
/// initialize logging (for win32 - to file ui.log, for other platforms - stderr; log level is TRACE for debug builds, and WARN for release builds)
extern(C) void initLogs();
/// call this when all resources are supposed to be freed to report counts of non-freed resources by type
extern(C) void releaseResourcesOnAppExit();
/// call this on application initialization
extern(C) void initResourceManagers();
/// call this from shared static this()
extern (C) void initSharedResourceManagers();
|
D
|
module foo.bar;
import core.vararg;
import std.stdio;
pragma (lib, "test");
pragma (msg, "Hello World");
static assert(true, "message");
alias mydbl = double;
int testmain()
in
{
assert(1 + (2 + 3) == -(1 - 2 * 3));
}
out(result)
{
assert(result == 0);
}
body
{
float f = (float).infinity;
int i = cast(int)f;
writeln((i , 1), 2);
writeln(cast(int)(float).max);
assert(i == cast(int)(float).max);
assert(i == 2147483648u);
return 0;
}
struct S
{
int m;
int n;
}
template Foo(T, int V)
{
void foo(...)
{
static if (is(Object _ : X!TL, alias X, TL...))
{
}
auto x = __traits(hasMember, Object, "noMember");
auto y = is(Object : X!TL, alias X, TL...);
assert(!x && !y, "message");
S s = {1, 2};
auto a = [1, 2, 3];
auto aa = [1:1, 2:2, 3:3];
int n, m;
}
int bar(double d, int x)
{
if (d)
{
d++;
}
else
d--;
asm { naked; }
asm { mov EAX,3; }
for (;;)
{
{
d = d + 1;
}
}
for (int i = 0;
i < 10; i++)
{
{
d = i ? d + 1 : 5;
}
}
char[] s;
foreach (char c; s)
{
d *= 2;
if (d)
break;
else
continue;
}
switch (V)
{
case 1:
{
}
case 2:
{
break;
}
case 3:
{
goto case 1;
}
case 4:
{
goto default;
}
default:
{
d /= 8;
break;
}
}
enum Label
{
A,
B,
C,
}
void fswitch(Label l)
{
final switch (l)
{
case A:
{
break;
}
case B:
{
break;
}
case C:
{
break;
}
}
}
loop:
while (x)
{
x--;
if (x)
break loop;
else
continue loop;
}
do
{
x++;
}
while (x < 10);
try
{
try
{
bar(1, 2);
}
catch(Object o)
{
x++;
}
}
finally
{
x--;
}
Object o;
synchronized(o) {
x = ~x;
}
synchronized {
x = x < 3;
}
with (o)
{
toString();
}
}
}
static this();
nothrow pure @nogc @safe static this();
nothrow pure @nogc @safe static this();
nothrow pure @nogc @safe shared static this();
nothrow pure @nogc @safe shared static this();
interface iFoo
{
}
class xFoo : iFoo
{
}
interface iFoo2
{
}
class xFoo2 : iFoo, iFoo2
{
}
class Foo3
{
this(int a, ...)
{
}
this(int* a)
{
}
}
alias myint = int;
static notquit = 1;
class Test
{
void a()
{
}
void b()
{
}
void c()
{
}
void d()
{
}
void e()
{
}
void f()
{
}
void g()
{
}
void h()
{
}
void i()
{
}
void j()
{
}
void k()
{
}
void l()
{
}
void m()
{
}
void n()
{
}
void o()
{
}
void p()
{
}
void q()
{
}
void r()
{
}
void s()
{
}
void t()
{
}
void u()
{
}
void v()
{
}
void w()
{
}
void x()
{
}
void y()
{
}
void z()
{
}
void aa()
{
}
void bb()
{
}
void cc()
{
}
void dd()
{
}
void ee()
{
}
template A(T)
{
}
alias getHUint = A!uint;
alias getHInt = A!int;
alias getHFloat = A!float;
alias getHUlong = A!ulong;
alias getHLong = A!long;
alias getHDouble = A!double;
alias getHByte = A!byte;
alias getHUbyte = A!ubyte;
alias getHShort = A!short;
alias getHUShort = A!ushort;
alias getHReal = A!real;
alias void F();
nothrow pure @nogc @safe new(size_t sz)
{
return null;
}
nothrow pure @nogc @safe delete(void* p)
{
}
}
void templ(T)(T val)
{
pragma (msg, "Invalid destination type.");
}
static char[] charArray = ['"', '\''];
class Point
{
auto x = 10;
uint y = 20;
}
template Foo2(bool bar)
{
void test()
{
static if (bar)
{
int i;
}
else
{
}
static if (!bar)
{
}
else
{
}
}
}
template Foo4()
{
void bar()
{
}
}
template Foo4x(T...)
{
}
class Baz4
{
mixin Foo4!() foo;
mixin Foo4x!(int, "str") foox;
alias baz = foo.bar;
}
int test(T)(T t)
{
if (auto o = cast(Object)t)
return 1;
return 0;
}
enum x6 = 1;
bool foo6(int a, int b, int c, int d)
{
return (a < b) != (c < d);
}
auto foo7(int x)
{
return 5;
}
class D8
{
}
void func8()
{
scope a = new D8;
}
T func9(T)() if (true)
{
T i;
scope(exit) i = 1;
scope(success) i = 2;
scope(failure) i = 3;
return i;
}
template V10(T)
{
void func()
{
for (int i, j = 4; i < 3; i++)
{
{
}
}
}
}
int foo11(int function() fn)
{
return fn();
}
int bar11(T)()
{
return foo11(function int()
{
return 0;
}
);
}
struct S6360
{
const pure nothrow @property long weeks1()
{
return 0;
}
const pure nothrow @property long weeks2()
{
return 0;
}
}
struct S12
{
nothrow this(int n)
{
}
nothrow this(string s)
{
}
}
struct T12
{
immutable this()(int args)
{
}
immutable this(A...)(A args)
{
}
}
import std.stdio : writeln, F = File;
void foo6591()()
{
import std.stdio : writeln, F = File;
}
version (unittest)
{
public {}
extern (C) {}
align {}
}
template Foo10334(T) if (Bar10334!())
{
}
template Foo10334(T) if (Bar10334!100)
{
}
template Foo10334(T) if (Bar10334!3.14)
{
}
template Foo10334(T) if (Bar10334!"str")
{
}
template Foo10334(T) if (Bar10334!1.4i)
{
}
template Foo10334(T) if (Bar10334!null)
{
}
template Foo10334(T) if (Bar10334!true)
{
}
template Foo10334(T) if (Bar10334!false)
{
}
template Foo10334(T) if (Bar10334!'A')
{
}
template Foo10334(T) if (Bar10334!int)
{
}
template Foo10334(T) if (Bar10334!string)
{
}
template Foo10334(T) if (Bar10334!wstring)
{
}
template Foo10334(T) if (Bar10334!dstring)
{
}
template Foo10334(T) if (Bar10334!this)
{
}
template Foo10334(T) if (Bar10334!([1, 2, 3]))
{
}
template Foo10334(T) if (Bar10334!(Baz10334!()))
{
}
template Foo10334(T) if (Bar10334!(Baz10334!T))
{
}
template Foo10334(T) if (Bar10334!(Baz10334!100))
{
}
template Foo10334(T) if (Bar10334!(.foo))
{
}
template Foo10334(T) if (Bar10334!(const(int)))
{
}
template Foo10334(T) if (Bar10334!(shared(T)))
{
}
template Test10334(T...)
{
}
mixin Test10334!int a;
mixin Test10334!(int, long) b;
mixin Test10334!"str" c;
auto clamp12266a(T1, T2, T3)(T1 x, T2 min_val, T3 max_val)
{
return 0;
}
pure clamp12266b(T1, T2, T3)(T1 x, T2 min_val, T3 max_val)
{
return 0;
}
@disable pure clamp12266c(T1, T2, T3)(T1 x, T2 min_val, T3 max_val)
{
return 0;
}
alias Dg13832 = ref int delegate();
class TestClass
{
int aa;
int b1;
int b2;
this(int b1, int b2)
{
this.b1 = b1;
this.b2 = b2;
}
ref foo()
{
return aa;
}
ref return retFunc()
{
return aa;
}
@trusted @nogc @disable ~this()
{
}
}
class FooA
{
protected void method42()
{
}
@safe ~this()
{
}
}
class Bar : FooA
{
override void method42()
{
}
}
@trusted double foo()
{
int a = 5;
return a;
}
struct Foo1(size_t Size = 42 / magic())
{
}
size_t magic()
{
return 42;
}
class Foo2A
{
immutable(FooA) Dummy = new immutable(FooA);
private immutable pure nothrow @nogc @safe this()
{
}
}
struct Foo3A(T)
{
@disable this(this);
@disable this();
}
|
D
|
module infiniteloop.openssl.x509_csr;
import std.array : byPair;
import std.exception : enforce;
import std.string : toStringz;
/* External modules imports */
import deimos.openssl.pem;
import deimos.openssl.x509;
import deimos.openssl.x509v3;
/* Module-local imports */
import infiniteloop.openssl.bio;
import infiniteloop.openssl.error;
import infiniteloop.openssl.evp;
import infiniteloop.openssl.password;
import infiniteloop.openssl.x509_name;
import infiniteloop.openssl.x509v3_config;
X509CertificateSigningRequest newX509CertificateSigningRequest(
const string[string] subjectName, EVPKey key,
string[string] extensions = null)
{
auto req = new X509CertificateSigningRequest();
req.setSubjectName(subjectName);
if (extensions.length)
{
req.setVersion(2 /* = v3 */ );
req.setV3ExtensionConfig(extensions);
}
req.setPublicKey(key);
req.sign(key);
return req;
}
/**
* Wrapper for C struct 'X509_REQ' certificate signing request.
*
* Reference:
* https://github.com/openssl/openssl/blob/OpenSSL_1_1_0-stable/apps/req.c
*/
class X509CertificateSigningRequest
{
private X509_REQ* csr;
this()
{
this.csr = X509_REQ_new();
}
/**
* Read in an existing PEM formatted CSR from string.
*/
this(const string pemFormattedCSR, const string password = "")
{
auto bio = new Bio(
(BIO* mem) => null != PEM_read_bio_X509_REQ(mem, &csr, &passwordCallbackWrapper,
cast(void*) toStringz(password))
);
bio.fromStr(pemFormattedCSR);
}
unittest /* Read an existing CSR from PEM formatted string */
{
import std.exception : assertNotThrown;
import infiniteloop.openssl.stubs.rsa : key;
auto csr = new X509CertificateSigningRequest();
csr.setPublicKey(key);
csr.sign(key);
assertNotThrown!OpenSSLError(
new X509CertificateSigningRequest(csr.toPEM()), "Expects to create a certificate signing request successfully from a PEM formatted string"
);
}
~this()
{
X509_REQ_free(csr);
}
/**
* Return the raw contained type when using with C API.
*/
X509_REQ* c_type()
{
return csr;
}
void setVersion(int versionNumber)
{
enforce!OpenSSLError(
1 == X509_REQ_set_version(csr, versionNumber), "Failed to set version on Certificate Signing Request"
);
}
unittest /* Set version */
{
import std.exception : assertNotThrown;
auto csr = new X509CertificateSigningRequest();
assertNotThrown!OpenSSLError(
csr.setVersion(2 /* = v3*/ ), "Expects to set a valid version on Certificate Signing Request successfully"
);
}
void setSubjectName(const string[string] subject)
{
auto name = newX509Name(subject);
X509_REQ_set_subject_name(csr, name.c_type());
}
private X509Name newX509Name(const string[string] subject) const
{
auto name = new X509Name();
foreach (entry; subject.byPair())
{
name.addNameEntry(entry.key, entry.value);
}
return name;
}
unittest /* Set SubjectName */
{
import std.exception : assertNotThrown;
import infiniteloop.openssl.stubs.x509_subj : stringFormattedSubject;
import std.algorithm.comparison : equal;
auto csr = new X509CertificateSigningRequest();
assertNotThrown!OpenSSLError(
csr.setSubjectName(stringFormattedSubject), "Expects to set a valid subject name successfully"
);
}
const(string)[string] getSubjectName() const
{
auto name = new X509Name(X509_REQ_get_subject_name(csr));
return name.getNameEntries();
}
unittest /* Get SubjectName */
{
import infiniteloop.openssl.stubs.x509_subj : stringFormattedSubject;
import std.algorithm.comparison : isPermutation;
auto csr = new X509CertificateSigningRequest();
csr.setSubjectName(stringFormattedSubject);
auto receivedSubject = csr.getSubjectName();
assert(isPermutation(stringFormattedSubject.keys, receivedSubject.keys), "Subject name keys are not equal");
assert(isPermutation(stringFormattedSubject.values, receivedSubject.values), "Subject name values are not equal");
}
void setPublicKey(EVPKey key)
{
enforce!OpenSSLError(
1 == X509_REQ_set_pubkey(csr, key.c_type()), "Failed to set public key on Certificate Signing Request"
);
}
unittest /* Set public key */
{
import std.exception : assertNotThrown;
import infiniteloop.openssl.stubs.rsa : key;
auto csr = new X509CertificateSigningRequest();
assertNotThrown!OpenSSLError(
csr.setPublicKey(key), "Expect to successfully set the public key of the certificate signing request"
);
}
EVPKey getPublicKey()
{
auto pkey = X509_REQ_get0_pubkey(csr);
return new EVPKey(pkey);
}
unittest /* Get public key */
{
import std.exception : assertNotThrown;
import infiniteloop.openssl.stubs.rsa : key;
auto csr = new X509CertificateSigningRequest();
csr.setPublicKey(key);
assertNotThrown!OpenSSLError(
csr.getPublicKey(), "Expect to successfully return the public key of the certificate signing request"
);
}
void setV3ExtensionConfig(const string[string] extensionConfig)
{
auto x509v3 = new X509v3Config(extensionConfig);
x509v3.addConfiguration(
(CONF* config, X509V3_CTX* ctx) {
// see more @ https://github.com/openssl/openssl/blob/master/apps/req.c#L821
X509V3_set_ctx(ctx, null, null, csr, null, 0);
return 1 == X509V3_EXT_REQ_add_nconf(config, ctx, "default" /* "section" in config-file */ , csr);
}
);
}
unittest /* Set valid CSR V3 extensions */
{
import std.exception : assertNotThrown;
auto csr = new X509CertificateSigningRequest();
string[string] extensions = [
"basicConstraints": "critical, CA:true",
"subjectKeyIdentifier": "hash"
];
assertNotThrown!OpenSSLError(
csr.setV3ExtensionConfig(extensions), "Expects success to set a valid v3 extensions configuration"
);
}
unittest /* Set not valid CSR V3 extensions */
{
import std.exception : assertThrown;
auto csr = new X509CertificateSigningRequest();
string[string] extensions = ["asd": "123"];
assertThrown!OpenSSLError(
csr.setV3ExtensionConfig(extensions), "Expects failure to set a non-valid v3 extensions configuration"
);
}
void sign(EVPKey key, MessageDigest md = MessageDigest.SHA_256)
{
if (key.getKeyType() == KeyType.ED25519)
{
md = MessageDigest.NONE; // MessageDigest must be null for elliptic curves.
}
enforce!OpenSSLError(
0 != X509_REQ_sign(csr, key.c_type(), getEvpMessageDigest(md)), "Failed to sign Certificate Signing Request"
);
}
unittest /* Sign CSR */
{
import std.exception : assertNotThrown;
import infiniteloop.openssl.stubs.rsa : key;
auto csr = new X509CertificateSigningRequest();
assertNotThrown!OpenSSLError(
csr.sign(key), "Expects to sign certificate with success"
);
}
bool validateSignature()
{
auto publicKey = X509_REQ_get0_pubkey(csr);
return 1 == X509_REQ_verify(csr, publicKey);
}
unittest /* Validate valid signature of CSR */
{
import infiniteloop.openssl.stubs.rsa : key;
auto csr = new X509CertificateSigningRequest();
csr.setPublicKey(key);
csr.sign(key);
bool res = csr.validateSignature();
assert(res == true, "Expecteded to succeed on Certificate Signing Request validation");
}
unittest /* Validate invalid signature of CSR */
{
import infiniteloop.openssl.stubs.rsa : key, anotherKey;
auto csr = new X509CertificateSigningRequest();
csr.setPublicKey(key);
csr.sign(anotherKey);
bool res = csr.validateSignature();
assert(res == false, "Expecteded to fail on Certificate Signing Request validation");
}
string toPEM()
{
auto bio = new Bio(
(BIO* mem) => 1 == PEM_write_bio_X509_REQ(mem, csr)
);
return bio.toString();
}
unittest /* Get CSR in PEM-formatted string */
{
import std.algorithm : startsWith, endsWith;
auto csr = new X509CertificateSigningRequest();
auto pem = csr.toPEM();
assert(startsWith(pem, "-----BEGIN CERTIFICATE REQUEST-----",), "PEM formatted certificate signing request expects to have a matching header");
assert(endsWith(pem, "-----END CERTIFICATE REQUEST-----\n"), "PEM formatted certificate signing request expects to have a matching footer");
}
}
|
D
|
// URL: https://atcoder.jp/contests/abc145/tasks/abc145_c
import std;
version(unittest) {} else
void main()
{
int N; io.getV(N);
double[] x, y; io.getC(N, x, y);
auto s = 0.0L, p = new int[](N);
foreach (i; 0..N) p[i] = i;
do {
foreach (i; 0..N-1)
s += sqrt((x[p[i]]-x[p[i+1]])^^2+(y[p[i]]-y[p[i+1]])^^2);
} while (p.nextPermutation);
foreach (i; 0..N) s /= i+1;
io.put(s);
}
auto io = IO!()();
import lib.io;
|
D
|
/Users/yermakovanton/Desktop/privatNbyTest/DerivedData/privatNbyTest/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/HTTPHeaders.o : /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/MultipartFormData.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/MultipartUpload.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/HTTPMethod.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Response.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ParameterEncoding.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Session.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Validation.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ResponseSerialization.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/RequestTaskMap.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/SessionStateProvider.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ParameterEncoder.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/RequestRetrier.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/RequestAdapter.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/AFError.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Protector.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/EventMonitor.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Notifications.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/HTTPHeaders.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Result.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Request.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/yermakovanton/Desktop/privatNbyTest/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/yermakovanton/Desktop/privatNbyTest/DerivedData/privatNbyTest/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/yermakovanton/Desktop/privatNbyTest/DerivedData/privatNbyTest/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/HTTPHeaders~partial.swiftmodule : /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/MultipartFormData.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/MultipartUpload.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/HTTPMethod.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Response.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ParameterEncoding.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Session.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Validation.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ResponseSerialization.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/RequestTaskMap.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/SessionStateProvider.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ParameterEncoder.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/RequestRetrier.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/RequestAdapter.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/AFError.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Protector.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/EventMonitor.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Notifications.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/HTTPHeaders.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Result.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Request.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/yermakovanton/Desktop/privatNbyTest/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/yermakovanton/Desktop/privatNbyTest/DerivedData/privatNbyTest/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/yermakovanton/Desktop/privatNbyTest/DerivedData/privatNbyTest/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/HTTPHeaders~partial.swiftdoc : /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/MultipartFormData.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/MultipartUpload.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/HTTPMethod.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Alamofire.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Response.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ParameterEncoding.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Session.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Validation.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ResponseSerialization.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/RequestTaskMap.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/SessionStateProvider.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/ParameterEncoder.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/RequestRetrier.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/RequestAdapter.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/AFError.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Protector.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/EventMonitor.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Notifications.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/HTTPHeaders.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Result.swift /Users/yermakovanton/Desktop/privatNbyTest/Pods/Alamofire/Source/Request.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/yermakovanton/Desktop/privatNbyTest/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/yermakovanton/Desktop/privatNbyTest/DerivedData/privatNbyTest/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
/Users/kirstenrichard/Desktop/substrate-moloch-dao/target/release/deps/libp2p_mplex-243f86d093680982.rmeta: /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.19.1/src/lib.rs /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.19.1/src/codec.rs
/Users/kirstenrichard/Desktop/substrate-moloch-dao/target/release/deps/liblibp2p_mplex-243f86d093680982.rlib: /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.19.1/src/lib.rs /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.19.1/src/codec.rs
/Users/kirstenrichard/Desktop/substrate-moloch-dao/target/release/deps/libp2p_mplex-243f86d093680982.d: /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.19.1/src/lib.rs /Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.19.1/src/codec.rs
/Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.19.1/src/lib.rs:
/Users/kirstenrichard/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-mplex-0.19.1/src/codec.rs:
|
D
|
/**
This module contains support array (vector) operations
Copyright: Copyright Digital Mars 2000 - 2019.
License: Distributed under the
$(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
(See accompanying file LICENSE)
Source: $(DRUNTIMESRC core/_internal/_array/_operations.d)
*/
module core.internal.array.operations;
import core.internal.traits : Filter, staticMap, Unqual;
version (GNU) version = GNU_OR_LDC;
version (LDC) version = GNU_OR_LDC;
/**
* Perform array (vector) operations and store the result in `res`. Operand
* types and operations are passed as template arguments in Reverse Polish
* Notation (RPN).
* Operands can be slices or scalar types. The element types of all
* slices and all scalar types must be implicitly convertible to `T`.
*
* Operations are encoded as strings, e.g. `"+"`, `"%"`, `"*="`. Unary
* operations are prefixed with "u", e.g. `"u-"`, `"u~"`. Only the last
* operation can and must be an assignment (`"="`) or op-assignment (`"op="`).
*
* All slice operands must have the same length as the result slice.
*
* Params: T[] = type of result slice
* Args = operand types and operations in RPN
* res = the slice in which to store the results
* args = operand values
*
* Returns: the slice containing the result
*/
T[] arrayOp(T : T[], Args...)(T[] res, Filter!(isType, Args) args) @trusted @nogc pure nothrow
{
alias scalarizedExp = staticMap!(toElementType, Args);
alias check = typeCheck!(true, T, scalarizedExp); // must support all scalar ops
foreach (argsIdx, arg; typeof(args))
{
static if (is(arg == U[], U))
{
assert(res.length == args[argsIdx].length, "Mismatched array lengths for vector operation");
}
}
size_t pos;
static if (vectorizeable!(T[], Args))
{
alias vec = .vec!T;
alias load = .load!(T, vec.length);
alias store = .store!(T, vec.length);
// Given that there are at most as many scalars broadcast as there are
// operations in any `ary[] = ary[] op const op const`, it should always be
// worthwhile to choose vector operations.
if (!__ctfe && res.length >= vec.length)
{
mixin(initScalarVecs!Args);
auto n = res.length / vec.length;
do
{
mixin(vectorExp!Args ~ ";");
pos += vec.length;
}
while (--n);
}
}
for (; pos < res.length; ++pos)
mixin(scalarExp!Args ~ ";");
return res;
}
private:
// SIMD helpers
version (DigitalMars)
{
import core.simd;
template vec(T)
{
enum regsz = 16; // SSE2
enum N = regsz / T.sizeof;
alias vec = __vector(T[N]);
}
void store(T, size_t N)(T* p, const scope __vector(T[N]) val)
{
pragma(inline, true);
alias vec = __vector(T[N]);
static if (is(T == float))
cast(void) __simd_sto(XMM.STOUPS, *cast(vec*) p, val);
else static if (is(T == double))
cast(void) __simd_sto(XMM.STOUPD, *cast(vec*) p, val);
else
cast(void) __simd_sto(XMM.STODQU, *cast(vec*) p, val);
}
const(__vector(T[N])) load(T, size_t N)(const scope T* p)
{
import core.simd;
pragma(inline, true);
alias vec = __vector(T[N]);
static if (is(T == float))
return cast(typeof(return)) __simd(XMM.LODUPS, *cast(const vec*) p);
else static if (is(T == double))
return cast(typeof(return)) __simd(XMM.LODUPD, *cast(const vec*) p);
else
return cast(typeof(return)) __simd(XMM.LODDQU, *cast(const vec*) p);
}
__vector(T[N]) binop(string op, T, size_t N)(const scope __vector(T[N]) a, const scope __vector(T[N]) b)
{
pragma(inline, true);
return mixin("a " ~ op ~ " b");
}
__vector(T[N]) unaop(string op, T, size_t N)(const scope __vector(T[N]) a)
if (op[0] == 'u')
{
pragma(inline, true);
return mixin(op[1 .. $] ~ "a");
}
}
// mixin gen
/**
Check whether operations on operand types are supported. This
template recursively reduces the expression tree and determines
intermediate types.
Type checking is done here rather than in the compiler to provide more
detailed error messages.
Params:
fail = whether to fail (static assert) with a human-friendly error message
T = type of result
Args = operand types and operations in RPN
Returns:
The resulting type of the expression
See_Also:
$(LREF arrayOp)
*/
template typeCheck(bool fail, T, Args...)
{
enum idx = staticIndexOf!(not!isType, Args);
static if (isUnaryOp(Args[idx]))
{
alias UT = Args[idx - 1];
enum op = Args[idx][1 .. $];
static if (is(typeof((UT a) => mixin(op ~ "cast(int) a")) RT == return))
alias typeCheck = typeCheck!(fail, T, Args[0 .. idx - 1], RT, Args[idx + 1 .. $]);
else static if (fail)
static assert(0, "Unary `" ~ op ~ "` not supported for type `" ~ UT.stringof ~ "`.");
}
else static if (isBinaryOp(Args[idx]))
{
alias LHT = Args[idx - 2];
alias RHT = Args[idx - 1];
enum op = Args[idx];
static if (is(typeof((LHT a, RHT b) => mixin("a " ~ op ~ " b")) RT == return))
alias typeCheck = typeCheck!(fail, T, Args[0 .. idx - 2], RT, Args[idx + 1 .. $]);
else static if (fail)
static assert(0,
"Binary `" ~ op ~ "` not supported for types `"
~ LHT.stringof ~ "` and `" ~ RHT.stringof ~ "`.");
}
else static if (Args[idx] == "=" || isBinaryAssignOp(Args[idx]))
{
alias RHT = Args[idx - 1];
enum op = Args[idx];
static if (is(T == __vector(ET[N]), ET, size_t N))
{
// no `cast(T)` before assignment for vectors
static if (is(typeof((T res, RHT b) => mixin("res " ~ op ~ " b")) RT == return)
&& // workaround https://issues.dlang.org/show_bug.cgi?id=17758
(op != "=" || is(Unqual!T == Unqual!RHT)))
alias typeCheck = typeCheck!(fail, T, Args[0 .. idx - 1], RT, Args[idx + 1 .. $]);
else static if (fail)
static assert(0,
"Binary op `" ~ op ~ "` not supported for types `"
~ T.stringof ~ "` and `" ~ RHT.stringof ~ "`.");
}
else
{
static if (is(typeof((RHT b) => mixin("cast(T) b"))))
{
static if (is(typeof((T res, T b) => mixin("res " ~ op ~ " b")) RT == return))
alias typeCheck = typeCheck!(fail, T, Args[0 .. idx - 1], RT, Args[idx + 1 .. $]);
else static if (fail)
static assert(0,
"Binary op `" ~ op ~ "` not supported for types `"
~ T.stringof ~ "` and `" ~ T.stringof ~ "`.");
}
else static if (fail)
static assert(0,
"`cast(" ~ T.stringof ~ ")` not supported for type `" ~ RHT.stringof ~ "`.");
}
}
else
static assert(0);
}
/// ditto
template typeCheck(bool fail, T, ResultType)
{
alias typeCheck = ResultType;
}
version (GNU_OR_LDC)
{
// leave it to the auto-vectorizer
enum vectorizeable(E : E[], Args...) = false;
}
else
{
// check whether arrayOp is vectorizable
template vectorizeable(E : E[], Args...)
{
static if (is(vec!E))
{
// type check with vector types
enum vectorizeable = is(typeCheck!(false, vec!E, staticMap!(toVecType, Args)));
}
else
enum vectorizeable = false;
}
version (X86_64) unittest
{
static assert(vectorizeable!(double[], const(double)[], double[], "+", "="));
static assert(!vectorizeable!(double[], const(ulong)[], double[], "+", "="));
// Vector type are (atm.) not implicitly convertible and would require
// lots of SIMD intrinsics. Therefor leave mixed type array ops to
// GDC/LDC's auto-vectorizers.
static assert(!vectorizeable!(double[], const(uint)[], uint, "+", "="));
}
}
bool isUnaryOp(scope string op) pure nothrow @safe @nogc
{
return op[0] == 'u';
}
bool isBinaryOp(scope string op) pure nothrow @safe @nogc
{
if (op == "^^")
return true;
if (op.length != 1)
return false;
switch (op[0])
{
case '+', '-', '*', '/', '%', '|', '&', '^':
return true;
default:
return false;
}
}
bool isBinaryAssignOp(string op)
{
return op.length >= 2 && op[$ - 1] == '=' && isBinaryOp(op[0 .. $ - 1]);
}
// Generate mixin expression to perform scalar arrayOp loop expression, assumes
// `pos` to be the current slice index, `args` to contain operand values, and
// `res` the target slice.
enum scalarExp(Args...) =
(){
string[] stack;
size_t argsIdx;
static if (is(Args[0] == U[], U))
alias Type = U;
else
alias Type = Args[0];
foreach (i, arg; Args)
{
static if (is(arg == T[], T))
stack ~= "args[" ~ argsIdx++.toString ~ "][pos]";
else static if (is(arg))
stack ~= "args[" ~ argsIdx++.toString ~ "]";
else static if (isUnaryOp(arg))
{
auto op = arg[0] == 'u' ? arg[1 .. $] : arg;
// Explicitly use the old integral promotion rules
// See also: https://dlang.org/changelog/2.078.0.html#fix16997
static if (is(Type : int))
stack[$ - 1] = "cast(typeof(" ~ stack[$ -1] ~ "))" ~ op ~ "cast(int)("~ stack[$ - 1] ~ ")";
else
stack[$ - 1] = op ~ stack[$ - 1];
}
else static if (arg == "=")
{
stack[$ - 1] = "res[pos] = cast(T)(" ~ stack[$ - 1] ~ ")";
}
else static if (isBinaryAssignOp(arg))
{
stack[$ - 1] = "res[pos] " ~ arg ~ " cast(T)(" ~ stack[$ - 1] ~ ")";
}
else static if (isBinaryOp(arg))
{
stack[$ - 2] = "(" ~ stack[$ - 2] ~ " " ~ arg ~ " " ~ stack[$ - 1] ~ ")";
stack.length -= 1;
}
else
assert(0, "Unexpected op " ~ arg);
}
assert(stack.length == 1);
return stack[0];
}();
// Generate mixin statement to perform vector loop initialization, assumes
// `args` to contain operand values.
enum initScalarVecs(Args...) =
() {
size_t scalarsIdx, argsIdx;
string res;
foreach (arg; Args)
{
static if (is(arg == T[], T))
{
++argsIdx;
}
else static if (is(arg))
res ~= "immutable vec scalar" ~ scalarsIdx++.toString ~ " = args["
~ argsIdx++.toString ~ "];\n";
}
return res;
}();
// Generate mixin expression to perform vector arrayOp loop expression, assumes
// `pos` to be the current slice index, `args` to contain operand values, and
// `res` the target slice.
enum vectorExp(Args...) =
() {
size_t scalarsIdx, argsIdx;
string[] stack;
foreach (arg; Args)
{
static if (is(arg == T[], T))
stack ~= "load(&args[" ~ argsIdx++.toString ~ "][pos])";
else static if (is(arg))
{
++argsIdx;
stack ~= "scalar" ~ scalarsIdx++.toString;
}
else static if (isUnaryOp(arg))
{
auto op = arg[0] == 'u' ? arg[1 .. $] : arg;
stack[$ - 1] = "unaop!\"" ~ arg ~ "\"(" ~ stack[$ - 1] ~ ")";
}
else static if (arg == "=")
{
stack[$ - 1] = "store(&res[pos], " ~ stack[$ - 1] ~ ")";
}
else static if (isBinaryAssignOp(arg))
{
stack[$ - 1] = "store(&res[pos], binop!\"" ~ arg[0 .. $ - 1]
~ "\"(load(&res[pos]), " ~ stack[$ - 1] ~ "))";
}
else static if (isBinaryOp(arg))
{
stack[$ - 2] = "binop!\"" ~ arg ~ "\"(" ~ stack[$ - 2] ~ ", " ~ stack[$ - 1] ~ ")";
stack.length -= 1;
}
else
assert(0, "Unexpected op " ~ arg);
}
assert(stack.length == 1);
return stack[0];
}();
// other helpers
enum isType(T) = true;
enum isType(alias a) = false;
template not(alias tmlp)
{
enum not(Args...) = !tmlp!Args;
}
/**
Find element in `haystack` for which `pred` is true.
Params:
pred = the template predicate
haystack = elements to search
Returns:
The first index for which `pred!haystack[index]` is true or -1.
*/
template staticIndexOf(alias pred, haystack...)
{
static if (pred!(haystack[0]))
enum staticIndexOf = 0;
else
{
enum next = staticIndexOf!(pred, haystack[1 .. $]);
enum staticIndexOf = next == -1 ? -1 : next + 1;
}
}
/// converts slice types to their element type, preserves anything else
alias toElementType(E : E[]) = E;
alias toElementType(S) = S;
alias toElementType(alias op) = op;
/// converts slice types to their element type, preserves anything else
alias toVecType(E : E[]) = vec!E;
alias toVecType(S) = vec!S;
alias toVecType(alias op) = op;
string toString(size_t num)
{
import core.internal.string : unsignedToTempString;
version (D_BetterC)
{
// Workaround for https://issues.dlang.org/show_bug.cgi?id=19268
if (__ctfe)
{
char[20] fixedbuf = void;
char[] buf = unsignedToTempString(num, fixedbuf);
char[] result = new char[buf.length];
result[] = buf[];
return (() @trusted => cast(string) result)();
}
else
{
// Failing at execution rather than during compilation is
// not good, but this is in `core.internal` so it should
// not be used by the unwary.
assert(0, __FUNCTION__ ~ " not available in -betterC except during CTFE.");
}
}
else
{
char[20] buf = void;
return unsignedToTempString(num, buf).idup;
}
}
bool contains(T)(const scope T[] ary, const scope T[] vals...)
{
foreach (v1; ary)
foreach (v2; vals)
if (v1 == v2)
return true;
return false;
}
// tests
version (CoreUnittest) template TT(T...)
{
alias TT = T;
}
version (CoreUnittest) template _arrayOp(Args...)
{
alias _arrayOp = arrayOp!Args;
}
unittest
{
static void check(string op, TA, TB, T, size_t N)(TA a, TB b, const scope ref T[N] exp)
{
T[N] res;
_arrayOp!(T[], TA, TB, op, "=")(res[], a, b);
foreach (i; 0 .. N)
assert(res[i] == exp[i]);
}
static void check2(string unaOp, string binOp, TA, TB, T, size_t N)(TA a, TB b, const scope ref T[N] exp)
{
T[N] res;
_arrayOp!(T[], TA, TB, unaOp, binOp, "=")(res[], a, b);
foreach (i; 0 .. N)
assert(res[i] == exp[i]);
}
static void test(T, string op, size_t N = 16)(T a, T b, T exp)
{
T[N] va = a, vb = b, vexp = exp;
check!op(va[], vb[], vexp);
check!op(va[], b, vexp);
check!op(a, vb[], vexp);
}
static void test2(T, string unaOp, string binOp, size_t N = 16)(T a, T b, T exp)
{
T[N] va = a, vb = b, vexp = exp;
check2!(unaOp, binOp)(va[], vb[], vexp);
check2!(unaOp, binOp)(va[], b, vexp);
check2!(unaOp, binOp)(a, vb[], vexp);
}
alias UINTS = TT!(ubyte, ushort, uint, ulong);
alias INTS = TT!(byte, short, int, long);
alias FLOATS = TT!(float, double);
foreach (T; TT!(UINTS, INTS, FLOATS))
{
test!(T, "+")(1, 2, 3);
test!(T, "-")(3, 2, 1);
static if (__traits(compiles, { import std.math; }))
test!(T, "^^")(2, 3, 8);
test2!(T, "u-", "+")(3, 2, 1);
}
foreach (T; TT!(UINTS, INTS))
{
test!(T, "|")(1, 2, 3);
test!(T, "&")(3, 1, 1);
test!(T, "^")(3, 1, 2);
test2!(T, "u~", "+")(3, cast(T)~2, 5);
}
foreach (T; TT!(INTS, FLOATS))
{
test!(T, "-")(1, 2, -1);
test2!(T, "u-", "+")(-3, -2, -1);
test2!(T, "u-", "*")(-3, -2, -6);
}
foreach (T; TT!(UINTS, INTS, FLOATS))
{
test!(T, "*")(2, 3, 6);
test!(T, "/")(8, 4, 2);
test!(T, "%")(8, 6, 2);
}
}
// test handling of v op= exp
unittest
{
uint[32] c;
arrayOp!(uint[], uint, "+=")(c[], 2);
foreach (v; c)
assert(v == 2);
static if (__traits(compiles, { import std.math; }))
{
arrayOp!(uint[], uint, "^^=")(c[], 3);
foreach (v; c)
assert(v == 8);
}
}
// proper error message for UDT lacking certain ops
unittest
{
static assert(!is(typeof(&arrayOp!(int[4][], int[4], "+="))));
static assert(!is(typeof(&arrayOp!(int[4][], int[4], "u-", "="))));
static struct S
{
}
static assert(!is(typeof(&arrayOp!(S[], S, "+="))));
static assert(!is(typeof(&arrayOp!(S[], S[], "*", S, "+="))));
static struct S2
{
S2 opBinary(string op)(in S2) @nogc pure nothrow
{
return this;
}
ref S2 opOpAssign(string op)(in S2) @nogc pure nothrow
{
return this;
}
}
static assert(is(typeof(&arrayOp!(S2[], S2[], S2[], S2, "*", "+", "="))));
static assert(is(typeof(&arrayOp!(S2[], S2[], S2, "*", "+="))));
}
// test mixed type array op
unittest
{
uint[32] a = 0xF;
float[32] res = 2.0f;
arrayOp!(float[], const(uint)[], uint, "&", "*=")(res[], a[], 12);
foreach (v; res[])
assert(v == 24.0f);
}
// test mixed type array op
unittest
{
static struct S
{
float opBinary(string op)(in S) @nogc const pure nothrow
{
return 2.0f;
}
}
float[32] res = 24.0f;
S[32] s;
arrayOp!(float[], const(S)[], const(S)[], "+", "/=")(res[], s[], s[]);
foreach (v; res[])
assert(v == 12.0f);
}
// test scalar after operation argument
unittest
{
float[32] res, a = 2, b = 3;
float c = 4;
arrayOp!(float[], const(float)[], const(float)[], "*", float, "+", "=")(res[], a[], b[], c);
foreach (v; res[])
assert(v == 2 * 3 + 4);
}
unittest
{
// https://issues.dlang.org/show_bug.cgi?id=17964
uint bug(){
uint[] a = [1, 2, 3, 5, 6, 7];
uint[] b = [1, 2, 3, 5, 6, 7];
a[] |= ~b[];
return a[1];
}
enum x = bug();
}
// https://issues.dlang.org/show_bug.cgi?id=19796
unittest
{
double[] data = [0.5];
double[] result;
result.length = data.length;
result[] = -data[];
assert(result[0] == -0.5);
}
// https://issues.dlang.org/show_bug.cgi?id=21110
unittest
{
import core.exception;
static void assertThrown(T : Throwable, E)(lazy E expression, string msg)
{
try
expression;
catch (T)
return;
assert(0, "msg");
}
int[] dst;
int[] a;
int[] b;
a.length = 3;
b.length = 3;
dst.length = 4;
void func() { dst[] = a[] + b[]; }
assertThrown!AssertError(func(), "Array operations with mismatched lengths must throw an error");
}
|
D
|
/Users/liujianhao/code/rust/simple_web_app/simple_web_app/target/debug/build/rand_chacha-92bdc3d538620273/build_script_build-92bdc3d538620273: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/rand_chacha-0.1.1/build.rs
/Users/liujianhao/code/rust/simple_web_app/simple_web_app/target/debug/build/rand_chacha-92bdc3d538620273/build_script_build-92bdc3d538620273.d: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/rand_chacha-0.1.1/build.rs
/Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/rand_chacha-0.1.1/build.rs:
|
D
|
/Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxNavigation.build/Objects-normal/x86_64/UIViewController.o : /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageDownload.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/GenericRouteShield.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxCoreNavigation/Sequence.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLVectorTileSource.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ErrorCode.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIImage.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Cache.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DataCache.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageCache.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Bundle.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Style.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLStyle.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DayStyle.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StyleType.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxCoreNavigation/Date.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/CGSize.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Transitioning.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxCoreNavigation/String.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NSAttributedString.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionLabel.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/FeedbackCollectionViewCell.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/RatingControl.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/FeedbackItem.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ManeuverDirection.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/VisualInstruction.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageDownloader.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StyleManager.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLAccountManager.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StyleKitMarker.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/RouteVoiceController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MapboxVoiceController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/EndOfRouteViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DialogViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/FeedbackViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/RouteMapViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StepsViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionPresenter.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIGestureRecognizer.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Error.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIEdgeInsets.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Constants.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/LanesStyleKit.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ManeuversStyleKit.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/VisualInstructionComponent.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/CGPoint.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Waypoint.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIFont.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationViewLayout.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/BottomBannerViewLayout.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionsBannerViewLayout.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/LaneView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DashedLineView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UserCourseView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIStackView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UICollectionView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLMapView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationMapView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/BottomBannerView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionsBannerView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NextBannerView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ManeuverView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/LanesView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StatusView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ExitView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Dictionary.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageRepository.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Polyline/Polyline.framework/Modules/Polyline.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Turf/Turf.framework/Modules/Turf.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxSpeech/MapboxSpeech.framework/Modules/MapboxSpeech.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxCoreNavigation/MapboxCoreNavigation.framework/Modules/MapboxCoreNavigation.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Solar/Solar.framework/Modules/Solar.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxDirections.swift/MapboxDirections.framework/Modules/MapboxDirections.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/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/CoreLocation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/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/MapKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/NSData+MMEGZIP.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/Polyline/Polyline-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/Turf/Turf-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxSpeech/MapboxSpeech-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxCoreNavigation/MapboxCoreNavigation-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxNavigation/MapboxNavigation-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/Solar/Solar-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxMobileEvents/MapboxMobileEvents-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxDirections.swift/MapboxDirections.swift-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapCamera.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMECommonEventData.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventsService.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLRasterDEMSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLImageSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLTileSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLRasterTileSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLVectorTileSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLShapeSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLComputedShapeSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAnnotationImage.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOfflineStorage.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Pinning/TSKSPKIHashCache.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLStyle.h /Users/Lorenzo/Desktop/EO18_2/Pods/Polyline/Polyline/Polyline.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPolyline.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLShape.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFeature.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapViewDelegate.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidator_Private.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBAttribute.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLStyleValue.h /Users/Lorenzo/Desktop/EO18_2/Pods/Turf/Sources/Turf/Turf.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKTrustKitConfig.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKLog.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxSpeech/MapboxSpeech/MapboxSpeech.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOfflinePack.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidatorCallback.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Pinning/TSKPublicKeyAlgorithm.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPolygon.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOfflineRegion.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLTilePyramidOfflineRegion.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKTrustDecision.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBLaneIndication.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLUserLocation.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFoundation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEUINavigation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxCoreNavigation/MapboxCoreNavigation/MapboxCoreNavigation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MapboxNavigation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventsConfiguration.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/parse_configuration.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAnnotation.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPointAnnotation.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLShapeCollection.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPointCollection.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCameraChangeReason.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAttributionInfo.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMECategoryLoader.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMELocationManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMETimerManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventsManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAccountManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEDependencyManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventLogger.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Pinning/ssl_pin_verifier.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEUniqueIdentifier.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/vendor_identifier.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MBRouteVoiceController.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxCoreNavigation/MapboxCoreNavigation/MBRouteController.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventLogReportViewController.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMENSDateWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMENSURLSessionWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEUIApplicationWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMETrustKitWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/TSKReportsRateLimiter.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/TSKBackgroundReporter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLDistanceFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCoordinateFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLClockDirectionFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCompassDirectionFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapSnapshotter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOpenGLStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLForegroundStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLBackgroundStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLHillshadeStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCircleStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLLineStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFillStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLSymbolStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFillExtrusionStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLHeatmapStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLRasterStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLVectorStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidator.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMETypes.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLTypes.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBRoadClasses.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxCoreNavigation/MapboxCoreNavigation/MBNavigationSettings.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/reporting_utils.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/configuration_utils.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MapboxDirections.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapView+IBAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/NSPredicate+MGLAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/NSValue+MGLAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/NSExpression+MGLAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLMapView+MGLNavigationAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBRouteOptions.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEConstants.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/CLLocation+MMEMobileEvents.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MapboxMobileEvents.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Polyline/Polyline.framework/Headers/Polyline-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Turf/Turf.framework/Headers/Turf-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxSpeech/MapboxSpeech.framework/Headers/MapboxSpeech-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxCoreNavigation/MapboxCoreNavigation.framework/Headers/MapboxCoreNavigation-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Solar/Solar.framework/Headers/Solar-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxDirections.swift/MapboxDirections.framework/Headers/MapboxDirections-Swift.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLLight.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TrustKit.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidatorResult.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEAPIClient.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEvent.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMultiPoint.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/TSKPinFailureReport.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAnnotationView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLUserLocationAnnotationView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCalloutView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/Mapbox.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOverlay.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLGeometry.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/Reachability/MMEReachability.h /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxNavigation.build/unextended-module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/Polyline.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/Turf.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxSpeech.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxCoreNavigation.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/Solar.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxMobileEvents.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxDirections.swift.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.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/CoreLocation.framework/Headers/CoreLocation.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/WebKit.framework/Headers/WebKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/MapKit.framework/Headers/MapKit.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/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxNavigation.build/Objects-normal/x86_64/UIViewController~partial.swiftmodule : /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageDownload.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/GenericRouteShield.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxCoreNavigation/Sequence.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLVectorTileSource.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ErrorCode.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIImage.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Cache.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DataCache.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageCache.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Bundle.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Style.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLStyle.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DayStyle.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StyleType.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxCoreNavigation/Date.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/CGSize.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Transitioning.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxCoreNavigation/String.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NSAttributedString.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionLabel.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/FeedbackCollectionViewCell.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/RatingControl.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/FeedbackItem.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ManeuverDirection.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/VisualInstruction.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageDownloader.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StyleManager.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLAccountManager.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StyleKitMarker.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/RouteVoiceController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MapboxVoiceController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/EndOfRouteViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DialogViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/FeedbackViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/RouteMapViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StepsViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionPresenter.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIGestureRecognizer.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Error.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIEdgeInsets.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Constants.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/LanesStyleKit.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ManeuversStyleKit.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/VisualInstructionComponent.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/CGPoint.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Waypoint.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIFont.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationViewLayout.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/BottomBannerViewLayout.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionsBannerViewLayout.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/LaneView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DashedLineView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UserCourseView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIStackView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UICollectionView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLMapView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationMapView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/BottomBannerView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionsBannerView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NextBannerView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ManeuverView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/LanesView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StatusView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ExitView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Dictionary.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageRepository.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Polyline/Polyline.framework/Modules/Polyline.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Turf/Turf.framework/Modules/Turf.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxSpeech/MapboxSpeech.framework/Modules/MapboxSpeech.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxCoreNavigation/MapboxCoreNavigation.framework/Modules/MapboxCoreNavigation.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Solar/Solar.framework/Modules/Solar.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxDirections.swift/MapboxDirections.framework/Modules/MapboxDirections.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/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/CoreLocation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/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/MapKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/NSData+MMEGZIP.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/Polyline/Polyline-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/Turf/Turf-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxSpeech/MapboxSpeech-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxCoreNavigation/MapboxCoreNavigation-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxNavigation/MapboxNavigation-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/Solar/Solar-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxMobileEvents/MapboxMobileEvents-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxDirections.swift/MapboxDirections.swift-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapCamera.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMECommonEventData.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventsService.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLRasterDEMSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLImageSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLTileSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLRasterTileSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLVectorTileSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLShapeSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLComputedShapeSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAnnotationImage.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOfflineStorage.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Pinning/TSKSPKIHashCache.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLStyle.h /Users/Lorenzo/Desktop/EO18_2/Pods/Polyline/Polyline/Polyline.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPolyline.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLShape.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFeature.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapViewDelegate.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidator_Private.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBAttribute.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLStyleValue.h /Users/Lorenzo/Desktop/EO18_2/Pods/Turf/Sources/Turf/Turf.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKTrustKitConfig.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKLog.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxSpeech/MapboxSpeech/MapboxSpeech.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOfflinePack.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidatorCallback.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Pinning/TSKPublicKeyAlgorithm.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPolygon.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOfflineRegion.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLTilePyramidOfflineRegion.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKTrustDecision.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBLaneIndication.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLUserLocation.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFoundation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEUINavigation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxCoreNavigation/MapboxCoreNavigation/MapboxCoreNavigation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MapboxNavigation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventsConfiguration.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/parse_configuration.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAnnotation.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPointAnnotation.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLShapeCollection.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPointCollection.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCameraChangeReason.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAttributionInfo.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMECategoryLoader.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMELocationManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMETimerManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventsManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAccountManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEDependencyManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventLogger.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Pinning/ssl_pin_verifier.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEUniqueIdentifier.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/vendor_identifier.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MBRouteVoiceController.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxCoreNavigation/MapboxCoreNavigation/MBRouteController.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventLogReportViewController.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMENSDateWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMENSURLSessionWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEUIApplicationWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMETrustKitWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/TSKReportsRateLimiter.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/TSKBackgroundReporter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLDistanceFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCoordinateFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLClockDirectionFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCompassDirectionFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapSnapshotter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOpenGLStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLForegroundStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLBackgroundStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLHillshadeStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCircleStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLLineStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFillStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLSymbolStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFillExtrusionStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLHeatmapStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLRasterStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLVectorStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidator.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMETypes.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLTypes.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBRoadClasses.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxCoreNavigation/MapboxCoreNavigation/MBNavigationSettings.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/reporting_utils.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/configuration_utils.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MapboxDirections.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapView+IBAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/NSPredicate+MGLAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/NSValue+MGLAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/NSExpression+MGLAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLMapView+MGLNavigationAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBRouteOptions.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEConstants.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/CLLocation+MMEMobileEvents.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MapboxMobileEvents.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Polyline/Polyline.framework/Headers/Polyline-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Turf/Turf.framework/Headers/Turf-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxSpeech/MapboxSpeech.framework/Headers/MapboxSpeech-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxCoreNavigation/MapboxCoreNavigation.framework/Headers/MapboxCoreNavigation-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Solar/Solar.framework/Headers/Solar-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxDirections.swift/MapboxDirections.framework/Headers/MapboxDirections-Swift.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLLight.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TrustKit.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidatorResult.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEAPIClient.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEvent.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMultiPoint.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/TSKPinFailureReport.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAnnotationView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLUserLocationAnnotationView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCalloutView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/Mapbox.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOverlay.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLGeometry.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/Reachability/MMEReachability.h /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxNavigation.build/unextended-module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/Polyline.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/Turf.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxSpeech.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxCoreNavigation.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/Solar.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxMobileEvents.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxDirections.swift.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.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/CoreLocation.framework/Headers/CoreLocation.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/WebKit.framework/Headers/WebKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/MapKit.framework/Headers/MapKit.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/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxNavigation.build/Objects-normal/x86_64/UIViewController~partial.swiftdoc : /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageDownload.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/GenericRouteShield.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxCoreNavigation/Sequence.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLVectorTileSource.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ErrorCode.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIImage.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Cache.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DataCache.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageCache.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Bundle.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Style.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLStyle.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DayStyle.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StyleType.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxCoreNavigation/Date.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/CGSize.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Transitioning.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxCoreNavigation/String.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NSAttributedString.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionLabel.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/FeedbackCollectionViewCell.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/RatingControl.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/FeedbackItem.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ManeuverDirection.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/VisualInstruction.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageDownloader.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StyleManager.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLAccountManager.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StyleKitMarker.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/RouteVoiceController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MapboxVoiceController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/EndOfRouteViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DialogViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/FeedbackViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/RouteMapViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StepsViewController.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionPresenter.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIGestureRecognizer.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Error.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIEdgeInsets.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Constants.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/LanesStyleKit.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ManeuversStyleKit.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/VisualInstructionComponent.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/CGPoint.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Waypoint.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIFont.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationViewLayout.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/BottomBannerViewLayout.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionsBannerViewLayout.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/LaneView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/DashedLineView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UserCourseView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UIStackView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/UICollectionView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLMapView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NavigationMapView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/BottomBannerView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/InstructionsBannerView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/NextBannerView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ManeuverView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/LanesView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/StatusView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ExitView.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/Dictionary.swift /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/ImageRepository.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Polyline/Polyline.framework/Modules/Polyline.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Turf/Turf.framework/Modules/Turf.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxSpeech/MapboxSpeech.framework/Modules/MapboxSpeech.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxCoreNavigation/MapboxCoreNavigation.framework/Modules/MapboxCoreNavigation.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Solar/Solar.framework/Modules/Solar.swiftmodule/x86_64.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxDirections.swift/MapboxDirections.framework/Modules/MapboxDirections.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/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/CoreLocation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/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/MapKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/NSData+MMEGZIP.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/Polyline/Polyline-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/Turf/Turf-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxSpeech/MapboxSpeech-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxCoreNavigation/MapboxCoreNavigation-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxNavigation/MapboxNavigation-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/Solar/Solar-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxMobileEvents/MapboxMobileEvents-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Target\ Support\ Files/MapboxDirections.swift/MapboxDirections.swift-umbrella.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapCamera.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMECommonEventData.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventsService.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLRasterDEMSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLImageSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLTileSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLRasterTileSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLVectorTileSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLShapeSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLComputedShapeSource.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAnnotationImage.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOfflineStorage.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Pinning/TSKSPKIHashCache.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLStyle.h /Users/Lorenzo/Desktop/EO18_2/Pods/Polyline/Polyline/Polyline.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPolyline.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLShape.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFeature.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapViewDelegate.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidator_Private.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBAttribute.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLStyleValue.h /Users/Lorenzo/Desktop/EO18_2/Pods/Turf/Sources/Turf/Turf.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKTrustKitConfig.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKLog.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxSpeech/MapboxSpeech/MapboxSpeech.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOfflinePack.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidatorCallback.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Pinning/TSKPublicKeyAlgorithm.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPolygon.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOfflineRegion.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLTilePyramidOfflineRegion.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKTrustDecision.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBLaneIndication.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLUserLocation.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFoundation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEUINavigation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxCoreNavigation/MapboxCoreNavigation/MapboxCoreNavigation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MapboxNavigation.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventsConfiguration.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/parse_configuration.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAnnotation.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPointAnnotation.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLShapeCollection.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLPointCollection.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCameraChangeReason.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAttributionInfo.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMECategoryLoader.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMELocationManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMETimerManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventsManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAccountManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEDependencyManager.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventLogger.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Pinning/ssl_pin_verifier.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEUniqueIdentifier.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/vendor_identifier.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MBRouteVoiceController.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxCoreNavigation/MapboxCoreNavigation/MBRouteController.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEventLogReportViewController.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMENSDateWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMENSURLSessionWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEUIApplicationWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMETrustKitWrapper.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/TSKReportsRateLimiter.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/TSKBackgroundReporter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLDistanceFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCoordinateFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLClockDirectionFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCompassDirectionFormatter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapSnapshotter.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOpenGLStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLForegroundStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLBackgroundStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLHillshadeStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCircleStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLLineStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFillStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLSymbolStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLFillExtrusionStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLHeatmapStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLRasterStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLVectorStyleLayer.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidator.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMETypes.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLTypes.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBRoadClasses.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxCoreNavigation/MapboxCoreNavigation/MBNavigationSettings.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/reporting_utils.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/configuration_utils.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MapboxDirections.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapView+IBAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/NSPredicate+MGLAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/NSValue+MGLAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/NSExpression+MGLAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxNavigation/MapboxNavigation/MGLMapView+MGLNavigationAdditions.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxDirections.swift/MapboxDirections/MBRouteOptions.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEConstants.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/CLLocation+MMEMobileEvents.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MapboxMobileEvents.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Polyline/Polyline.framework/Headers/Polyline-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Turf/Turf.framework/Headers/Turf-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxSpeech/MapboxSpeech.framework/Headers/MapboxSpeech-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxCoreNavigation/MapboxCoreNavigation.framework/Headers/MapboxCoreNavigation-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/Solar/Solar.framework/Headers/Solar-Swift.h /Users/Lorenzo/Desktop/EO18_2/Build/Products/Debug-iphonesimulator/MapboxDirections.swift/MapboxDirections.framework/Headers/MapboxDirections-Swift.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLLight.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TrustKit.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/TSKPinningValidatorResult.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEAPIClient.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/MMEEvent.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMultiPoint.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/vendor/TrustKit/Reporting/TSKPinFailureReport.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLAnnotationView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLUserLocationAnnotationView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLMapView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLCalloutView.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/Mapbox.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLOverlay.h /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.framework/Headers/MGLGeometry.h /Users/Lorenzo/Desktop/EO18_2/Pods/MapboxMobileEvents/MapboxMobileEvents/Reachability/MMEReachability.h /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxNavigation.build/unextended-module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/Polyline.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/Turf.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxSpeech.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxCoreNavigation.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/Solar.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxMobileEvents.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Build/Intermediates/Pods.build/Debug-iphonesimulator/MapboxDirections.swift.build/module.modulemap /Users/Lorenzo/Desktop/EO18_2/Pods/Mapbox-iOS-SDK/dynamic/Mapbox.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/CoreLocation.framework/Headers/CoreLocation.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/WebKit.framework/Headers/WebKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/MapKit.framework/Headers/MapKit.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
|
/Users/Matt/iOS/RoadInfo/DerivedData/RoadInfo/Build/Intermediates/RoadInfo.build/Debug-iphoneos/RoadInfo.build/Objects-normal/arm64/SplashScreen.o : /Users/Matt/iOS/RoadInfo/RoadInfo/ChristchurchEvent.swift /Users/Matt/iOS/RoadInfo/RoadInfo/EventViewController.swift /Users/Matt/iOS/RoadInfo/RoadInfo/SplashScreen.swift /Users/Matt/iOS/RoadInfo/RoadInfo/XMLParser.swift /Users/Matt/iOS/RoadInfo/RoadInfo/MapController.swift /Users/Matt/iOS/RoadInfo/RoadInfo/Complex.swift /Users/Matt/iOS/RoadInfo/RoadInfo/NZMGConverter.swift /Users/Matt/iOS/RoadInfo/RoadInfo/Location.swift /Users/Matt/iOS/RoadInfo/RoadInfo/ChristchurchXML.swift /Users/Matt/iOS/RoadInfo/RoadInfo/RoadEvent.swift /Users/Matt/iOS/RoadInfo/RoadInfo/Annotation.swift /Users/Matt/iOS/RoadInfo/RoadInfo/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreLocation.swiftmodule
/Users/Matt/iOS/RoadInfo/DerivedData/RoadInfo/Build/Intermediates/RoadInfo.build/Debug-iphoneos/RoadInfo.build/Objects-normal/arm64/SplashScreen~partial.swiftmodule : /Users/Matt/iOS/RoadInfo/RoadInfo/ChristchurchEvent.swift /Users/Matt/iOS/RoadInfo/RoadInfo/EventViewController.swift /Users/Matt/iOS/RoadInfo/RoadInfo/SplashScreen.swift /Users/Matt/iOS/RoadInfo/RoadInfo/XMLParser.swift /Users/Matt/iOS/RoadInfo/RoadInfo/MapController.swift /Users/Matt/iOS/RoadInfo/RoadInfo/Complex.swift /Users/Matt/iOS/RoadInfo/RoadInfo/NZMGConverter.swift /Users/Matt/iOS/RoadInfo/RoadInfo/Location.swift /Users/Matt/iOS/RoadInfo/RoadInfo/ChristchurchXML.swift /Users/Matt/iOS/RoadInfo/RoadInfo/RoadEvent.swift /Users/Matt/iOS/RoadInfo/RoadInfo/Annotation.swift /Users/Matt/iOS/RoadInfo/RoadInfo/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreLocation.swiftmodule
/Users/Matt/iOS/RoadInfo/DerivedData/RoadInfo/Build/Intermediates/RoadInfo.build/Debug-iphoneos/RoadInfo.build/Objects-normal/arm64/SplashScreen~partial.swiftdoc : /Users/Matt/iOS/RoadInfo/RoadInfo/ChristchurchEvent.swift /Users/Matt/iOS/RoadInfo/RoadInfo/EventViewController.swift /Users/Matt/iOS/RoadInfo/RoadInfo/SplashScreen.swift /Users/Matt/iOS/RoadInfo/RoadInfo/XMLParser.swift /Users/Matt/iOS/RoadInfo/RoadInfo/MapController.swift /Users/Matt/iOS/RoadInfo/RoadInfo/Complex.swift /Users/Matt/iOS/RoadInfo/RoadInfo/NZMGConverter.swift /Users/Matt/iOS/RoadInfo/RoadInfo/Location.swift /Users/Matt/iOS/RoadInfo/RoadInfo/ChristchurchXML.swift /Users/Matt/iOS/RoadInfo/RoadInfo/RoadEvent.swift /Users/Matt/iOS/RoadInfo/RoadInfo/Annotation.swift /Users/Matt/iOS/RoadInfo/RoadInfo/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreLocation.swiftmodule
|
D
|
//
//----------------------------------------------------------------------
// Copyright 2007-2011 Mentor Graphics Corporation
// Copyright 2007-2010 Cadence Design Systems, Inc.
// Copyright 2010 Synopsys, Inc.
// Copyright 2014 Coverify Systems Technology
// All Rights Reserved Worldwide
//
// 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.
//----------------------------------------------------------------------
//------------------------------------------------------------------------------
// Title: TLM Port Classes
//------------------------------------------------------------------------------
// The following classes define the TLM port classes.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// Class: uvm_*_port #(T)
//
// These unidirectional ports are instantiated by components that ~require~,
// or ~use~, the associated interface to convey transactions. A port can
// be connected to any compatible port, export, or imp port. Unless its
// ~min_size~ is 0, a port ~must~ be connected to at least one implementation
// of its assocated interface.
//
// The asterisk in ~uvm_*_port~ is any of the following
//
//| blocking_put
//| nonblocking_put
//| put
//|
//| blocking_get
//| nonblocking_get
//| get
//|
//| blocking_peek
//| nonblocking_peek
//| peek
//|
//| blocking_get_peek
//| nonblocking_get_peek
//| get_peek
//
// Type parameters
//
// T - The type of transaction to be communicated by the export
//
// Ports are connected to interface implementations directly via
// <uvm_*_imp #(T,IMP)> ports or indirectly via hierarchical connections
// to <uvm_*_port #(T)> and <uvm_*_export #(T)> ports.
//
//------------------------------------------------------------------------------
// Function: new
//
// The ~name~ and ~parent~ are the standard <uvm_component> constructor arguments.
// The ~min_size~ and ~max_size~ specify the minimum and maximum number of
// interfaces that must have been connected to this port by the end of elaboration.
//
//| function new (string name,
//| uvm_component parent,
//| int min_size=1,
//| int max_size=1)
module uvm.tlm1.uvm_ports;
class uvm_blocking_put_port(T=int): uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_BLOCKING_PUT_MASK,"uvm_blocking_put_port")
// `UVM_BLOCKING_PUT_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super (name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_BLOCKING_PUT_MASK;
}
}
public string get_type_name() {
return "uvm_blocking_put_port";
}
// task
public void put (T t) {
m_if.put(t);
}
}
class uvm_nonblocking_put_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_NONBLOCKING_PUT_MASK,"uvm_nonblocking_put_port")
// `UVM_NONBLOCKING_PUT_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_NONBLOCKING_PUT_MASK;
}
}
public string get_type_name() {
return "uvm_nonblocking_put_port";
}
public bool try_put (T t) {
return m_if.try_put(t);
}
public bool can_put() {
return m_if.can_put();
}
}
class uvm_put_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_PUT_MASK,"uvm_put_port")
// `UVM_PUT_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_PUT_MASK;
}
}
public string get_type_name() {
return "uvm_put_port";
}
// task
public void put(T t) {
m_if.put(t);
}
public bool try_put (T t) {
return m_if.try_put(t);
}
public bool can_put() {
return m_if.can_put();
}
}
class uvm_blocking_get_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_BLOCKING_GET_MASK,"uvm_blocking_get_port")
// `UVM_BLOCKING_GET_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
super (name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_BLOCKING_GET_MASK;
}
public string get_type_name() {
return "uvm_blocking_get_port";
}
// task
public void get (out T t) {
m_if.get(t);
}
}
class uvm_nonblocking_get_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_NONBLOCKING_GET_MASK,"uvm_nonblocking_get_port")
// `UVM_NONBLOCKING_GET_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
super (name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_NONBLOCKING_GET_MASK;
}
public string get_type_name() {
return "uvm_nonblocking_get_port";
}
public bool try_get (out T t) {
return m_if.try_get(t);
}
public bool can_get() {
return m_if.can_get();
}
}
class uvm_get_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_GET_MASK,"uvm_get_port")
// `UVM_GET_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super (name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_GET_MASK;
}
}
public string get_type_name() {
return "uvm_get_port";
}
// task
public void get (out T t) {
m_if.get(t);
}
public bool try_get (out T t) {
return m_if.try_get(t);
}
public bool can_get() {
return m_if.can_get();
}
}
class uvm_blocking_peek_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_BLOCKING_PEEK_MASK,"uvm_blocking_peek_port")
// `UVM_BLOCKING_PEEK_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super (name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_BLOCKING_PEEK_MASK;
}
}
public string get_type_name() {
return "uvm_blocking_peek_port";
}
// task
public void peek (out T t) {
m_if.peek(t);
}
}
class uvm_nonblocking_peek_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_NONBLOCKING_PEEK_MASK,"uvm_nonblocking_peek_port")
// `UVM_NONBLOCKING_PEEK_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super (name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_NONBLOCKING_PEEK_MASK;
}
}
public string get_type_name() {
return "uvm_nonblocking_peek_port";
}
public bool try_peek (out T t) {
return m_if.try_peek(t);
}
public bool can_peek() {
return m_if.can_peek();
}
}
class uvm_peek_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_PEEK_MASK,"uvm_peek_port")
// `UVM_PEEK_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super (name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_PEEK_MASK;
}
}
public string get_type_name() {
return "uvm_peek_port";
}
// task
public void peek (out T t) {
m_if.peek(t);
}
public bool try_peek (out T t) {
return m_if.try_peek(t);
}
public bool can_peek() {
return m_if.can_peek();
}
}
class uvm_blocking_get_peek_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_BLOCKING_GET_PEEK_MASK,"uvm_blocking_get_peek_port")
// `UVM_BLOCKING_GET_PEEK_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super (name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_BLOCKING_GET_PEEK_MASK;
}
}
public string get_type_name() {
return "uvm_blocking_get_peek_port";
}
// task
public void get (out T t) {
m_if.get(t);
}
// task
public void peek (out T t) {
m_if.peek(t);
}
}
class uvm_nonblocking_get_peek_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_NONBLOCKING_GET_PEEK_MASK,"uvm_nonblocking_get_peek_port")
// `UVM_NONBLOCKING_GET_PEEK_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super (name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_NONBLOCKING_GET_PEEK_MASK;
}
}
public string get_type_name() {
return "uvm_nonblocking_get_peek_port";
}
public bool try_get (out T t) {
return m_if.try_get(t);
}
public bool can_get() {
return m_if.can_get();
}
public bool try_peek (out T t) {
return m_if.try_peek(t);
}
public bool can_peek() {
return m_if.can_peek();
}
}
class uvm_get_peek_port(T=int):
uvm_port_base!(uvm_tlm_if_base!(T,T))
{
// `UVM_PORT_COMMON(`UVM_TLM_GET_PEEK_MASK,"uvm_get_peek_port")
// `UVM_GET_PEEK_IMP (this.m_if, T, t)
public this(string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super (name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_GET_PEEK_MASK;
}
}
public string get_type_name() {
return "uvm_get_peek_port";
}
// task
public void get (out T t) {
m_if.get(t);
}
// task
public void peek (out T t) {
m_if.peek(t);
}
public bool try_get (out T t) {
return m_if.try_get(t);
}
public bool can_get() {
return m_if.can_get();
}
public bool try_peek (out T t) {
return m_if.try_peek(t);
}
public bool can_peek() {
return m_if.can_peek();
}
}
//------------------------------------------------------------------------------
//
// Class: uvm_*_port #(REQ,RSP)
//
// These bidirectional ports are instantiated by components that ~require~,
// or ~use~, the associated interface to convey transactions. A port can
// be connected to any compatible port, export, or imp port. Unless its
// ~min_size~ is 0, a port ~must~ be connected to at least one implementation
// of its assocated interface.
//
// The asterisk in ~uvm_*_port~ is any of the following
//
//| blocking_transport
//| nonblocking_transport
//| transport
//|
//| blocking_master
//| nonblocking_master
//| master
//|
//| blocking_slave
//| nonblocking_slave
//| slave
//
// Ports are connected to interface implementations directly via
// <uvm_*_imp #(REQ,RSP,IMP,REQ_IMP,RSP_IMP)> ports or indirectly via
// hierarchical connections to <uvm_*_port #(REQ,RSP)> and
// <uvm_*_export #(REQ,RSP)> ports.
//
// Type parameters
//
// REQ - The type of request transaction to be communicated by the export
//
// RSP - The type of response transaction to be communicated by the export
//
//------------------------------------------------------------------------------
// Function: new
//
// The ~name~ and ~parent~ are the standard <uvm_component> constructor arguments.
// The ~min_size~ and ~max_size~ specify the minimum and maximum number of
// interfaces that must have been supplied to this port by the end of elaboration.
//
// function new (string name,
// uvm_component parent,
// int min_size=1,
// int max_size=1)
class uvm_blocking_master_port (REQ=int, RSP=REQ):
uvm_port_base !(uvm_tlm_if_base !(REQ, RSP))
{
// `UVM_PORT_COMMON(`UVM_TLM_BLOCKING_MASTER_MASK,"uvm_blocking_master_port")
// `UVM_BLOCKING_PUT_IMP (this.m_if, REQ, t)
// `UVM_BLOCKING_GET_PEEK_IMP (this.m_if, RSP, t)
public this (string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_BLOCKING_MASTER_MASK;
}
}
public string get_type_name() {
return "uvm_blocking_master_port";
}
// task
public void put (REQ t) {
m_if.put(t);
}
// task
public void get (out RSP t) {
m_if.get(t);
}
// task
public void peek (out RSP t) {
m_if.peek(t);
}
}
class uvm_nonblocking_master_port (REQ=int, RSP=REQ):
uvm_port_base !(uvm_tlm_if_base !(REQ, RSP))
{
// `UVM_PORT_COMMON(`UVM_TLM_NONBLOCKING_MASTER_MASK,"uvm_nonblocking_master_port")
// `UVM_NONBLOCKING_PUT_IMP (this.m_if, REQ, t)
// `UVM_NONBLOCKING_GET_PEEK_IMP (this.m_if, RSP, t)
public this (string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_NONBLOCKING_MASTER_MASK;
}
}
public string get_type_name() {
return "uvm_nonblocking_master_port";
}
public bool try_put (REQ t) {
return m_if.try_put(t);
}
public bool can_put() {
return m_if.can_put();
}
public bool try_get (out RSP t) {
return m_if.try_get(t);
}
public bool can_get() {
return m_if.can_get();
}
public bool try_peek (out RSP t) {
return m_if.try_peek(t);
}
public bool can_peek() {
return m_if.can_peek();
}
}
class uvm_master_port (REQ=int, RSP=REQ):
uvm_port_base !(uvm_tlm_if_base !(REQ, RSP))
{
// `UVM_PORT_COMMON(`UVM_TLM_MASTER_MASK,"uvm_master_port")
// `UVM_PUT_IMP (this.m_if, REQ, t)
// `UVM_GET_PEEK_IMP (this.m_if, RSP, t)
public this (string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_MASTER_MASK;
}
}
public string get_type_name() {
return "uvm_master_port";
}
// task
public void put (REQ t) {
m_if.put(t);
}
public bool try_put (REQ t) {
return m_if.try_put(t);
}
public bool can_put() {
return m_if.can_put();
}
// task
public void get (out RSP t) {
m_if.get(t);
}
// task
public void peek (out RSP t) {
m_if.peek(t);
}
public bool try_get (out RSP t) {
return m_if.try_get(t);
}
public bool can_get() {
return m_if.can_get();
}
public bool try_peek (out RSP t) {
return m_if.try_peek(t);
}
public bool can_peek() {
return m_if.can_peek();
}
}
class uvm_blocking_slave_port (REQ=int, RSP=REQ):
uvm_port_base !(uvm_tlm_if_base !(RSP, REQ))
{
// `UVM_PORT_COMMON(`UVM_TLM_BLOCKING_SLAVE_MASK,"uvm_blocking_slave_port")
// `UVM_BLOCKING_PUT_IMP (this.m_if, RSP, t)
// `UVM_BLOCKING_GET_PEEK_IMP (this.m_if, REQ, t)
public this (string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_BLOCKING_SLAVE_MASK;
}
}
public string get_type_name() {
return "uvm_blocking_slave_port";
}
// task
public void put (RSP t) {
m_if.put(t);
}
// task
public void get (out REQ t) {
m_if.get(t);
}
// task
public void peek (out REQ t) {
m_if.peek(t);
}
}
class uvm_nonblocking_slave_port (REQ=int, RSP=REQ):
uvm_port_base !(uvm_tlm_if_base !(RSP, REQ))
{
// `UVM_PORT_COMMON(`UVM_TLM_NONBLOCKING_SLAVE_MASK,"uvm_nonblocking_slave_port")
// `UVM_NONBLOCKING_PUT_IMP (this.m_if, RSP, t)
// `UVM_NONBLOCKING_GET_PEEK_IMP (this.m_if, REQ, t)
public this (string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_NONBLOCKING_SLAVE_MASK;
}
}
public string get_type_name() {
return "uvm_nonblocking_slave_port";
}
public bool try_put (RSP t) {
return m_if.try_put(t);
}
public bool can_put() {
return m_if.can_put();
}
public bool try_get (out REQ t) {
return m_if.try_get(t);
}
public bool can_get() {
return m_if.can_get();
}
public bool try_peek (out REQ t) {
return m_if.try_peek(t);
}
public bool can_peek() {
return m_if.can_peek();
}
}
class uvm_slave_port (REQ=int, RSP=REQ):
uvm_port_base !(uvm_tlm_if_base !(RSP, REQ))
{
// `UVM_PORT_COMMON(`UVM_TLM_SLAVE_MASK,"uvm_slave_port")
// `UVM_PUT_IMP (this.m_if, RSP, t)
// `UVM_GET_PEEK_IMP (this.m_if, REQ, t)
public this (string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_SLAVE_MASK;
}
}
public string get_type_name() {
return "uvm_slave_port";
}
// task
public void put (RSP t) {
m_if.put(t);
}
public bool try_put (RSP t) {
return m_if.try_put(t);
}
public bool can_put() {
return m_if.can_put();
}
// task
public void get (out REQ t) {
m_if.get(t);
}
// task
public void peek (out REQ t) {
m_if.peek(t);
}
public bool try_get (out REQ t) {
return m_if.try_get(t);
}
public bool can_get() {
m_if.can_get();
}
public bool try_peek (out REQ t) {
return m_if.try_peek(t);
}
public bool can_peek() {
return m_if.can_peek();
}
}
class uvm_blocking_transport_port (REQ=int, RSP=REQ):
uvm_port_base!(uvm_tlm_if_base !(REQ, RSP))
{
// `UVM_PORT_COMMON(`UVM_TLM_BLOCKING_TRANSPORT_MASK,"uvm_blocking_transport_port")
// `UVM_BLOCKING_TRANSPORT_IMP (this.m_if, REQ, RSP, req, rsp)
public this (string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_BLOCKING_TRANSPORT_MASK;
}
}
public string get_type_name() {
return "uvm_blocking_transport_port";
}
// task
public void transport (REQ req, out RSP rsp) {
m_if.transport(req, rsp);
}
}
class uvm_nonblocking_transport_port (REQ=int, RSP=REQ):
uvm_port_base !(uvm_tlm_if_base !(REQ, RSP))
{
// `UVM_PORT_COMMON(`UVM_TLM_NONBLOCKING_TRANSPORT_MASK,"uvm_nonblocking_transport_port")
// `UVM_NONBLOCKING_TRANSPORT_IMP (this.m_if, REQ, RSP, req, rsp)
public this (string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_NONBLOCKING_TRANSPORT_MASK;
}
}
public string get_type_name() {
return "uvm_nonblocking_transport_port";
}
public bool nb_transport (REQ req, out RSP rsp) {
return m_if.nb_transport(req, rsp);
}
}
class uvm_transport_port (REQ=int, RSP=REQ):
uvm_port_base !(uvm_tlm_if_base !(REQ, RSP))
{
// `UVM_PORT_COMMON(`UVM_TLM_TRANSPORT_MASK,"uvm_transport_port")
// `UVM_TRANSPORT_IMP (this.m_if, REQ, RSP, req, rsp)
public this (string name=null, uvm_component parent=null,
int min_size=1, int max_size=1) {
synchronized(this) {
super(name, parent, UVM_PORT, min_size, max_size);
m_if_mask = UVM_TLM_TRANSPORT_MASK;
}
}
public string get_type_name() {
return "uvm_transport_port";
}
// task
public void transport (REQ req, out RSP rsp) {
m_if.transport(req, rsp);
}
public bool nb_transport (REQ req, out RSP rsp) {
return m_if.nb_transport(req, rsp);
}
}
|
D
|
FUNC VOID NewMagic()
{
if (Seele_unterwegs == TRUE)
{
if (Npc_GetDistToNpc (PC_seele, hero) > 1800)
{
B_KillNpc(hero);
B_KillNpc(PC_seele);
};
PC_Seele.attribute[ATR_HITPOINTS_MAX] = hero.attribute[ATR_HITPOINTS_MAX];
if (PC_Seele.attribute[ATR_HITPOINTS] > hero.attribute[ATR_HITPOINTS])
{
PC_Seele.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS];
PC_Seele.aivar[AIV_Damage] = hero.attribute[ATR_HITPOINTS];
}
else if (hero.attribute[ATR_HITPOINTS] > PC_Seele.attribute[ATR_HITPOINTS])
{
hero.attribute[ATR_HITPOINTS] = PC_Seele.attribute[ATR_HITPOINTS];
hero.aivar[AIV_Damage] = PC_Seele.attribute[ATR_HITPOINTS];
};
PC_Seele.attribute[ATR_MANA_MAX] = hero.attribute[ATR_MANA_MAX];
if (Npc_IsInFightMode(PC_Seele, FMODE_MAGIC))
|| (Npc_IsInFightMode(hero, FMODE_MAGIC))
{
if (PC_Seele.attribute[ATR_MANA] > hero.attribute[ATR_MANA])
{
PC_Seele.attribute[ATR_MANA] = hero.attribute[ATR_MANA];
}
else if (hero.attribute[ATR_MANA] > PC_Seele.attribute[ATR_MANA])
{
hero.attribute[ATR_MANA] = PC_Seele.attribute[ATR_MANA];
};
}
else
{
if (PC_Seele.attribute[ATR_MANA] < hero.attribute[ATR_MANA])
{
PC_Seele.attribute[ATR_MANA] = hero.attribute[ATR_MANA];
}
else if (hero.attribute[ATR_MANA] < PC_Seele.attribute[ATR_MANA])
{
hero.attribute[ATR_MANA] = PC_Seele.attribute[ATR_MANA];
};
};
};
// Aura des Frostes
if (Mod_AuraFrost_Counter > 0)
{
if (Mod_AuraFrost%5 == 0)
{
Wld_PlayEffect("spellFX_BlueGlow", hero, hero, 0, 0, 0, FALSE );
};
if (hero.attribute[ATR_HITPOINTS] > 1)
{
hero.attribute[ATR_HITPOINTS] -= 1;
hero.aivar[AIV_Damage] = hero.attribute[ATR_HITPOINTS];
};
if (Mod_AuraFrost_Counter == 1)
{
Mod_AuraFrost = 0;
};
Mod_AuraFrost_Counter -= 1;
};
// Aura des Verbrennens
if (Mod_AuraFeuer_Counter > 0)
{
if (Mod_AuraFeuer%5 == 0)
{
Wld_PlayEffect("spellFX_RedGlow", hero, hero, 0, 0, 0, FALSE );
};
if (hero.attribute[ATR_HITPOINTS] > 1)
{
hero.attribute[ATR_HITPOINTS] -= 1;
hero.aivar[AIV_Damage] = hero.attribute[ATR_HITPOINTS];
};
if (Mod_AuraFeuer_Counter == 1)
{
Mod_AuraFeuer = 0;
};
Mod_AuraFeuer_Counter -= 1;
};
// Aura der Flammen
if (Mod_AuraFlammen_Counter > 0)
{
if (Mod_AuraFeuer%5 == 0)
{
Wld_PlayEffect("spellFX_RedGlow", hero, hero, 0, 0, 0, FALSE );
};
if (Mod_AuraFlammen_Counter == 1)
{
Mod_AuraFeuer = 0;
};
Mod_AuraFlammen_Counter -= 1;
};
// Aura der Heilung
if (Mod_AuraHeilung_Counter > 0)
{
hero.attribute[ATR_HITPOINTS] += hero.attribute[ATR_HITPOINTS_MAX]/10;
if (hero.attribute[ATR_HITPOINTS] > hero.attribute[ATR_HITPOINTS_MAX])
{
hero.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS_MAX];
};
hero.aivar[AIV_Damage] = hero.attribute[ATR_HITPOINTS];
if (CurrentLevel == NEWWORLD_ZEN)
{
if (Mod_WM_Iwan == 1)
&& (Npc_GetDistToWP(hero, "NW_CRYPT_IN_11") < 500)
{
Wld_InsertNpc (Mod_7206_NONE_Iwan_NW, "NW_CRYPT_IN_11");
Mod_WM_Iwan = 2;
};
};
if (Mod_AuraHeilung_Counter == 1)
{
Mod_AuraHeilung = 0;
};
Mod_AuraHeilung_Counter -= 1;
};
};
|
D
|
/*
* Copyright (c) 2007-2013 Scott Lembcke and Howling Moon Software
*
* 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 demo.Buoyancy;
import core.stdc.stdlib;
import std.math;
alias M_PI_2 = PI_2;
import demo.dchip;
import demo.ChipmunkDebugDraw;
import demo.ChipmunkDemo;
import demo.types;
static void update(cpSpace* space, double dt)
{
cpSpaceStep(space, dt);
}
enum FLUID_DENSITY = 0.00014;
enum FLUID_DRAG = 2.0;
char messageBuffer[1024] = 0;
static cpBool waterPreSolve(cpArbiter* arb, cpSpace* space, void* ptr)
{
mixin(CP_ARBITER_GET_SHAPES!("arb", "water", "poly"));
cpBody* body_ = cpShapeGetBody(poly);
// Get the top of the water sensor bounding box to use as the water level.
cpFloat level = cpShapeGetBB(water).t;
// Clip the polygon against the water level
int count = cpPolyShapeGetNumVerts(poly);
int clippedCount = 0;
cpVect[10] clipped;
for (int i = 0, j = count - 1; i < count; j = i, i++)
{
cpVect a = cpBodyLocal2World(body_, cpPolyShapeGetVert(poly, j));
cpVect b = cpBodyLocal2World(body_, cpPolyShapeGetVert(poly, i));
if (a.y < level)
{
clipped[clippedCount] = a;
clippedCount++;
}
cpFloat a_level = a.y - level;
cpFloat b_level = b.y - level;
if (a_level * b_level < 0.0f)
{
cpFloat t = cpfabs(a_level) / (cpfabs(a_level) + cpfabs(b_level));
clipped[clippedCount] = cpvlerp(a, b, t);
clippedCount++;
}
}
// Calculate buoyancy from the clipped polygon area
cpFloat clippedArea = cpAreaForPoly(clippedCount, clipped.ptr);
cpFloat displacedMass = clippedArea * FLUID_DENSITY;
cpVect centroid = cpCentroidForPoly(clippedCount, clipped.ptr);
cpVect r = cpvsub(centroid, cpBodyGetPos(body_));
ChipmunkDebugDrawPolygon(clippedCount, clipped.ptr, 0.0f, RGBAColor(0, 0, 1, 1), RGBAColor(0, 0, 1, 0.1f));
ChipmunkDebugDrawDot(5, centroid, RGBAColor(0, 0, 1, 1));
cpFloat dt = cpSpaceGetCurrentTimeStep(space);
cpVect g = cpSpaceGetGravity(space);
// Apply the buoyancy force as an impulse.
apply_impulse(body_, cpvmult(g, -displacedMass * dt), r);
// Apply linear damping for the fluid drag.
cpVect v_centroid = cpvadd(body_.v, cpvmult(cpvperp(r), body_.w));
cpFloat k = k_scalar_body(body_, r, cpvnormalize_safe(v_centroid));
cpFloat damping = clippedArea * FLUID_DRAG * FLUID_DENSITY;
cpFloat v_coef = cpfexp(-damping * dt * k); // linear drag
// cpFloat v_coef = 1.0/(1.0 + damping*dt*cpvlength(v_centroid)*k); // quadratic drag
apply_impulse(body_, cpvmult(cpvsub(cpvmult(v_centroid, v_coef), v_centroid), 1.0 / k), r);
// Apply angular damping for the fluid drag.
cpFloat w_damping = cpMomentForPoly(FLUID_DRAG * FLUID_DENSITY * clippedArea, clippedCount, clipped.ptr, cpvneg(body_.p));
body_.w *= cpfexp(-w_damping * dt * body_.i_inv);
return cpTrue;
}
static cpSpace* init()
{
ChipmunkDemoMessageString = messageBuffer[];
cpSpace* space = cpSpaceNew();
cpSpaceSetIterations(space, 30);
cpSpaceSetGravity(space, cpv(0, -500));
// cpSpaceSetDamping(space, 0.5);
cpSpaceSetSleepTimeThreshold(space, 0.5f);
cpSpaceSetCollisionSlop(space, 0.5f);
cpBody * body_;
cpBody * staticBody = cpSpaceGetStaticBody(space);
cpShape* shape;
// Create segments around the edge of the screen.
shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(-320, -240), cpv(-320, 240), 0.0f));
cpShapeSetElasticity(shape, 1.0f);
cpShapeSetFriction(shape, 1.0f);
cpShapeSetLayers(shape, NOT_GRABABLE_MASK);
shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(320, -240), cpv(320, 240), 0.0f));
cpShapeSetElasticity(shape, 1.0f);
cpShapeSetFriction(shape, 1.0f);
cpShapeSetLayers(shape, NOT_GRABABLE_MASK);
shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(-320, -240), cpv(320, -240), 0.0f));
cpShapeSetElasticity(shape, 1.0f);
cpShapeSetFriction(shape, 1.0f);
cpShapeSetLayers(shape, NOT_GRABABLE_MASK);
shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(-320, 240), cpv(320, 240), 0.0f));
cpShapeSetElasticity(shape, 1.0f);
cpShapeSetFriction(shape, 1.0f);
cpShapeSetLayers(shape, NOT_GRABABLE_MASK);
{
// Add the edges of the bucket
cpBB bb = cpBBNew(-300, -200, 100, 0);
cpFloat radius = 5.0f;
shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(bb.l, bb.b), cpv(bb.l, bb.t), radius));
cpShapeSetElasticity(shape, 1.0f);
cpShapeSetFriction(shape, 1.0f);
cpShapeSetLayers(shape, NOT_GRABABLE_MASK);
shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(bb.r, bb.b), cpv(bb.r, bb.t), radius));
cpShapeSetElasticity(shape, 1.0f);
cpShapeSetFriction(shape, 1.0f);
cpShapeSetLayers(shape, NOT_GRABABLE_MASK);
shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(bb.l, bb.b), cpv(bb.r, bb.b), radius));
cpShapeSetElasticity(shape, 1.0f);
cpShapeSetFriction(shape, 1.0f);
cpShapeSetLayers(shape, NOT_GRABABLE_MASK);
// Add the sensor for the water.
shape = cpSpaceAddShape(space, cpBoxShapeNew2(staticBody, bb));
cpShapeSetSensor(shape, cpTrue);
cpShapeSetCollisionType(shape, 1);
}
{
cpFloat width = 200.0f;
cpFloat height = 50.0f;
cpFloat mass = 0.3 * FLUID_DENSITY * width * height;
cpFloat moment = cpMomentForBox(mass, width, height);
body_ = cpSpaceAddBody(space, cpBodyNew(mass, moment));
cpBodySetPos(body_, cpv(-50, -100));
cpBodySetVel(body_, cpv(0, -100));
cpBodySetAngVel(body_, 1);
shape = cpSpaceAddShape(space, cpBoxShapeNew(body_, width, height));
cpShapeSetFriction(shape, 0.8f);
}
{
cpFloat width = 40.0f;
cpFloat height = width * 2;
cpFloat mass = 0.3 * FLUID_DENSITY * width * height;
cpFloat moment = cpMomentForBox(mass, width, height);
body_ = cpSpaceAddBody(space, cpBodyNew(mass, moment));
cpBodySetPos(body_, cpv(-200, -50));
cpBodySetVel(body_, cpv(0, -100));
cpBodySetAngVel(body_, 1);
shape = cpSpaceAddShape(space, cpBoxShapeNew(body_, width, height));
cpShapeSetFriction(shape, 0.8f);
}
cpSpaceAddCollisionHandler(space, 1, 0, null, safeCast!cpCollisionPreSolveFunc(&waterPreSolve), null, null, null);
return space;
}
static void destroy(cpSpace* space)
{
ChipmunkDemoFreeSpaceChildren(space);
cpSpaceFree(space);
}
ChipmunkDemo Buoyancy = {
"Simple Sensor based fluids.",
1.0 / 180.0,
&init,
&update,
&ChipmunkDemoDefaultDrawImpl,
&destroy,
};
|
D
|
func string GetHeroLocation()
{
if(Npc_GetDistToWP(hero,"HC_PRACTICE1")< 4500)
||(Npc_GetDistToWP(hero,"OW_PATH_047")< 4000)
||(Npc_GetDistToWP(hero,"PATH_OC_NC_4")< 4500)
||(Npc_GetDistToWP(hero,"OW_PATH_OC_NC5")< 3000)
{
return "OR";
}
else if(Npc_GetDistToWp(hero,"OCC_CELLAR_HALLWAY_FRONT")< 9000)
{
return "OC";
};
return "UNKNOWN";
};
|
D
|
# FIXED
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/source/F2837xD_Gpio.c
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_device.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/assert.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/_ti_config.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/linkage.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/stdarg.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/sys/_types.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/sys/cdefs.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/machine/_types.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/stdbool.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/stddef.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/stdint.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/_stdint40.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/sys/stdint.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/machine/_stdint.h
F2837xD_Gpio.obj: D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/sys/_stdint.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_adc.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_analogsubsys.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_cla.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_clb.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_clbxbar.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_cmpss.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_cputimer.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_dac.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_dcsm.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_dma.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_ecap.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_emif.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_epwm.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_epwm_xbar.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_eqep.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_flash.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_gpio.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_i2c.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_input_xbar.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_ipc.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_mcbsp.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_memconfig.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_nmiintrupt.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_output_xbar.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_piectrl.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_pievect.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_sci.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_sdfm.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_spi.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_sysctrl.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_upp.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_xbar.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_xint.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_can.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Examples.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_GlobalPrototypes.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_cputimervars.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Cla_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_EPwm_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Adc_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Emif_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Gpio_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_I2c_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Ipc_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Pie_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Dma_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_SysCtrl_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Upp_defines.h
F2837xD_Gpio.obj: D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_defaultisr.h
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/source/F2837xD_Gpio.c:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_device.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/assert.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/_ti_config.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/linkage.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/stdarg.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/sys/_types.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/sys/cdefs.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/machine/_types.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/stdbool.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/stddef.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/stdint.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/_stdint40.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/sys/stdint.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/machine/_stdint.h:
D:/TI/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/include/sys/_stdint.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_adc.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_analogsubsys.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_cla.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_clb.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_clbxbar.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_cmpss.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_cputimer.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_dac.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_dcsm.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_dma.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_ecap.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_emif.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_epwm.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_epwm_xbar.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_eqep.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_flash.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_gpio.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_i2c.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_input_xbar.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_ipc.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_mcbsp.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_memconfig.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_nmiintrupt.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_output_xbar.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_piectrl.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_pievect.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_sci.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_sdfm.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_spi.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_sysctrl.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_upp.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_xbar.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_xint.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/headers/include/F2837xD_can.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Examples.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_GlobalPrototypes.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_cputimervars.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Cla_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_EPwm_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Adc_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Emif_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Gpio_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_I2c_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Ipc_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Pie_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Dma_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_SysCtrl_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_Upp_defines.h:
D:/TI/C2000Ware_3_04_00_00_Software/device_support/f2837xd/common/include/F2837xD_defaultisr.h:
|
D
|
import std.stdio;
import std.conv;
import std.string;
import std.math;
real subgraph_density(bool[][] adj_matrix, int start_node, int n) {
FloatingPointControl fpctrl;
fpctrl.rounding = FloatingPointControl.roundToNearest;
int i = 0;
int j = 0;
int nodes_size_w = n - 1;
bool[] w = new bool[n];
for (i = 0; i < n; i++) {
w[i] = true;
}
int[] queue = new int[70];
int queue_length = 0;
w[start_node] = false;
queue_length++;
queue[queue_length - 1] = start_node;
int current_index = 0;
while (current_index != queue_length) {
int current_node = queue[current_index++];
for (j = 0; j < n; j++) {
if (adj_matrix[current_node][j] && w[j]) {
w[j] = false;
nodes_size_w--;
queue_length++;
queue[queue_length - 1] = j;
}
}
}
if (nodes_size_w == 0) {
return 0.000;
}
int edge_amount = 0;
for (i = 0; i < n; i++) {
if (w[i]) {
for (j = 0; j < n; j++) {
if (adj_matrix[i][j] && w[j]) {
edge_amount++;
}
}
}
}
return to!real(edge_amount) / (to!real(nodes_size_w * nodes_size_w));
}
int main() {
string buf;
try {
int n = to!int(strip(stdin.readln()));
bool[][] adj_matrix;
string adj_row;
for (int i = 0; i < n; i++) {
adj_row = strip(stdin.readln());
bool[] a;
for (int j = 0; j < n; j++) {
a ~= false;
}
adj_matrix ~= a;
for (int j = 0; j < n; j++) {
if (adj_row[j] == '1') {
adj_matrix[i][j] = true;
}
}
}
while(stdin.readln(buf)) {
int start_node = to!int(strip(buf));
writefln("%.3f", subgraph_density(adj_matrix, start_node, n) + cast(real)1E-12);
}
} catch (Exception e) {
writeln(e.msg);
}
return 0;
}
|
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_2_BeT-9539559292.notation#_copSALmGEeKQQp7P9cQvNQ"/>
</availablePage>
</pageList>
<sashModel currentSelection="//@sashModel/@windows.0/@children.0">
<windows>
<children xsi:type="di:TabFolder">
<children>
<emfPageIdentifier href="VAR_2_BeT-9539559292.notation#_copSALmGEeKQQp7P9cQvNQ"/>
</children>
</children>
</windows>
</sashModel>
</di:SashWindowsMngr>
|
D
|
# FIXED
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/source/F2837xS_EPwm.c
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_device.h
F2837xS_EPwm.obj: C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/assert.h
F2837xS_EPwm.obj: C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/linkage.h
F2837xS_EPwm.obj: C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/stdarg.h
F2837xS_EPwm.obj: C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/stdbool.h
F2837xS_EPwm.obj: C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/stddef.h
F2837xS_EPwm.obj: C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/stdint.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_adc.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_analogsubsys.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_cla.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_cmpss.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_cputimer.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_dac.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_dcsm.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_dma.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_defaultisr.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_ecap.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_emif.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_epwm.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_epwm_xbar.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_eqep.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_flash.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_gpio.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_i2c.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_input_xbar.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_mcbsp.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_memconfig.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_nmiintrupt.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_output_xbar.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_piectrl.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_pievect.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_sci.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_sdfm.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_spi.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_sysctrl.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_trig_xbar.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_upp.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_xbar.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_xint.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Examples.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_GlobalPrototypes.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_cputimervars.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Cla_defines.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_EPwm_defines.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Adc_defines.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Emif_defines.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Gpio_defines.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_I2c_defines.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Pie_defines.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Dma_defines.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_SysCtrl_defines.h
F2837xS_EPwm.obj: C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Upp_defines.h
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/source/F2837xS_EPwm.c:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_device.h:
C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/assert.h:
C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/linkage.h:
C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/stdarg.h:
C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/stdbool.h:
C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/stddef.h:
C:/CCStudio_v8/ccsv8/tools/compiler/ti-cgt-c2000_17.6.0.STS/include/stdint.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_adc.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_analogsubsys.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_cla.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_cmpss.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_cputimer.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_dac.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_dcsm.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_dma.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_defaultisr.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_ecap.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_emif.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_epwm.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_epwm_xbar.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_eqep.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_flash.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_gpio.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_i2c.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_input_xbar.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_mcbsp.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_memconfig.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_nmiintrupt.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_output_xbar.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_piectrl.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_pievect.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_sci.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_sdfm.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_spi.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_sysctrl.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_trig_xbar.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_upp.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_xbar.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_headers/include/F2837xS_xint.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Examples.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_GlobalPrototypes.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_cputimervars.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Cla_defines.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_EPwm_defines.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Adc_defines.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Emif_defines.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Gpio_defines.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_I2c_defines.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Pie_defines.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Dma_defines.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_SysCtrl_defines.h:
C:/ayush2_nigam4/repo/trunk/lab2switchchecker/v140/F2837xS_common/include/F2837xS_Upp_defines.h:
|
D
|
import std.file: readText;
import std.regex;
import std.format;
import std.stdio;
import std.string;
import lex;
import parse;
void main()
{
auto sourceCode = readText("testfile.txt");
auto lexer = Lexer(sourceCode);
auto lexems = lexer.parse;
foreach(l; lexems)
writeln(l);
writeln("");
auto parser = Parser(lexems);
auto nodes = parser.parse;
// foreach(n; nodes)
// writeln(n);
// ulong offset = 0;
// auto sourceCodeLen = sourceCode.length;
// while(offset < sourceCodeLen) {
// }
// auto r = r"(0|[1-9][0-9]*)".regex;
// auto r = r"\d+".regex;
// auto r = r"^[a-zA-Z_][a-zA-Z0-9_]*";
// auto data = "var3dor2 = 1;";
// // auto space_position = data.indexOf(' ');
// auto caps = matchFirst(data[0 .. $], r);
// if(!caps.empty) {
// auto resText = caps.hit;
// writeln("hit: '%s'; length: %d".format(resText, resText.length));
// }
// auto caps2 = matchFirst(data[0 .. $], r);
// if(!caps2.empty) {
// auto resText = caps2.hit;
// writeln("hit: '%s'; length: %d".format(resText, resText.length));
// }
// auto res = matchFirst(sourceCode[offset .. $], r);
// writeln(def);
}
|
D
|
/home/ubuntu/substrate-node-template/target/release/deps/libconst_random_macro-61b66ea6c0cae6b5.so: /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/const-random-macro-0.1.8/src/lib.rs
/home/ubuntu/substrate-node-template/target/release/deps/const_random_macro-61b66ea6c0cae6b5.d: /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/const-random-macro-0.1.8/src/lib.rs
/home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/const-random-macro-0.1.8/src/lib.rs:
|
D
|
//Работает на dcf на словаре CityPlan толmrj с объектами StreetCenterLine
include <windows.dh>
include <system.dh>
include <LookUp2DInc.dh>
local egs 0
local frt 0
local ch 0
local cnt 0
/*local isLine(ch,fe)
{
return( chGetFeatureCode(ch,fe) == FE_LINE &&
chGetAttrValue(ch,fe,AT_LAYERS,layer) && layer >= 1 && layer <= 3 );
}*/
local _isLine(ch,fe)
{
return( (code=chGetFeatureCode(ch,fe)) == 60160 || 60770); // Paths
}
local findIn(a,v)
{
for( i=ArSize(a); i && v!=ArGet(a,i); i-=1 );
return i;
}
local front()
{
nd=ArGet(frt,1);
if( !(es=chGetEdgesOfNode(ch,nd)) )
{
ArRemoveAt(frt,1);
return;
}
for( i=ArSize(es); i; i-=1 )
{
eg=ArGet(es,i);
if( !(j=findIn(egs,eg)) )
continue;
chGetEdgeBegEnd(ch,eg,beg,end);
if( beg != nd && !findIn(frt,beg) )
{
ArAdd(frt,beg);
//chHighlightNode(ch,beg);
}
if( end != nd && !findIn(frt,end) )
{
ArAdd(frt,end);
//chHighlightNode(ch,end);
}
ArRemoveAt(egs,j);
//chHighlightEdge(ch,eg);
//if( !((cnt+=1)%100) )
// puts(""+ArSize(egs)+" "+ArSize(frt));
}
ArFree(es);
ArRemoveAt(frt,1);
//chHighlightNode(ch,nd);
}
global main()
{
MessageBox("Перед использованем скрипта сделайте \n Compact Chart без объединения объектов \n с одинаковыми атрибутами",MB_OK|MB_ICONINFORMATION);
if( !(ch=GetEditDataset()) )
return;
//if( IDNO == MessageBox("Перед поиском необходим Compact без слияния идентичных атрибутов:\nTools -> Compact Chart\nMerge identical attributes = No\n\nЭто было сделано?",MB_ICONINFORMATION|MB_YESNO) )
// return;
chCompact(ch,0);
//ArFreeAll();
egs=ArCreate(0);
frt=ArCreate(0);
for( fe=0; fe=chNextFeature(ch,fe); )
{
if ( (code=chGetFeatureCode(ch,fe)) == 60160 || 60770)//if( isLine(ch,fe) )
{
if( chGetAttrText(ch,fe,SORDAT,sordat) )
{
MessageBox("Найдены линии с отметкой SORDAT",MB_OK|MB_ICONSTOP);
ArFreeAll();
return;
}
sz=chGetFeatureLine(ch,fe,1,eg,flag);
ArAdd(egs,eg);
for( i=2; i<=sz; i+=1 )
{
chGetFeatureLine(ch,fe,i,eg,flag);
ArAdd(egs,eg);
}
}
}
chGetEdgeBegEnd(ch,ArGet(egs,1),beg,end);
ArAdd(frt,beg);
while( (k=ArSize(frt)) )
front();
//puts("Найдено линий: "+ArSize(egs));
chHighlightOff(ch);
tot=0;
for( i=ArSize(egs); i; i-=1 )
{
if( !(fes=chGetFeaturesOfEdge(ch,eg=ArGet(egs,i))) )
{
puts("***"+eg);
chHighlightEdge(ch,eg);
}
r=0;
for( j=ArSize(fes); j; j-=1 )
{
if( (code=chGetFeatureCode(ch,fe=ArGet(fes,j))) == 60160 || 60770) //isLine(ch,fe=ArGet(fes,j)) )
{
if( !chGetAttrValue(ch,fe,SORDAT,sordat) )
{
chSetAttrValue(ch,fe,SORDAT,20000101);
tot+=1;
}
r+=1;
}
}
ArFree(fes);
if( r > 1 )
puts("*** shared edge "+eg);
else if( !r )
{
puts("***"+eg);
chHighlightEdge(ch,eg);
}
}
ArFreeAll();
if( tot )
MessageBox("Отмечено SORDAT: "+tot,MB_OK|MB_ICONINFORMATION);
else
MessageBox("Потеряных участков не найдено. Рекомедуется снова сделать Compact",MB_OK|MB_ICONINFORMATION);
puts("Найдено оторваных от дорожного графа объектов: "+tot);
}
|
D
|
import std.stdio;
import std.ascii;
import std.demangle;
void main()
{
char[] buffer;
bool inword;
while (!stdin.eof)
{
foreach(c; stdin.readln())
{
if (inword)
{
if (c == '_' || isAlphaNum(c))
buffer ~= c;
else
{
inword = false;
write(demangle(buffer.idup), c);
}
}
else
{
if (c == '_' || isAlpha(c))
{
inword = true;
buffer.length = 0;
buffer ~= c;
}
else
write(c);
}
}
if (inword)
writef(demangle(buffer.idup));
}
}
|
D
|
module hunt.wechat.bean.paymch.Authcodetoopenid;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import hunt.wechat.bean.AdaptorCDATA;
/**
* 刷卡支付 授权码查询OPENID 参数对象
*
*
*/
@XmlRootElement(name="xml")
@XmlAccessorType(XmlAccessType.FIELD)
class Authcodetoopenid {
//@XmlElement
private string appid;
//@XmlElement
private string mch_id;
//@XmlElement
private string auth_code;
//@XmlElement
private string nonce_str;
//@XmlElement
//@XmlJavaTypeAdapter(value = typeid(AdaptorCDATA))
private string sign;
private string sign_type;
/**
* @since 2.8.5
*/
protected string sub_appid;
/**
* @since 2.8.5
*/
protected string sub_mch_id;
public string getAppid() {
return appid;
}
public void setAppid(string appid) {
this.appid = appid;
}
public string getMch_id() {
return mch_id;
}
public void setMch_id(string mch_id) {
this.mch_id = mch_id;
}
public string getAuth_code() {
return auth_code;
}
public void setAuth_code(string auth_code) {
this.auth_code = auth_code;
}
public string getNonce_str() {
return nonce_str;
}
public void setNonce_str(string nonce_str) {
this.nonce_str = nonce_str;
}
public string getSign() {
return sign;
}
public void setSign(string sign) {
this.sign = sign;
}
public string getSub_appid() {
return sub_appid;
}
public void setSub_appid(string sub_appid) {
this.sub_appid = sub_appid;
}
public string getSub_mch_id() {
return sub_mch_id;
}
public void setSub_mch_id(string sub_mch_id) {
this.sub_mch_id = sub_mch_id;
}
public string getSign_type() {
return sign_type;
}
public void setSign_type(string sign_type) {
this.sign_type = sign_type;
}
}
|
D
|
proc Main()
{
(42).Foo := 42; // error,
}
|
D
|
module genome;
import derelict.sdl2.sdl;
import std.conv;
import std.stdio;
import std.random;
import std.string;
import std.algorithm;
import misc.color;
/+
+ Genomes hold the rules which define the behavior of an organism.
+ They can be edited by virocytes, or by the player.
+/
class Genome {
CellMode[] cellModes;
this() {
foreach (i; 0 .. 16) {
cellModes ~= CellMode();
cellModes[$ - 1].child1Mode = to!byte(i);
cellModes[$ - 1].child2Mode = to!byte(i);
cellModes[$ - 1].color = SDL_Color(
cast(ubyte)uniform(0, 255),
cast(ubyte)uniform(0, 255),
cast(ubyte)uniform(0, 255)
);
}
}
static Genome load(string filename) {
auto genome = new Genome();
genome.cellModes.destroy();
auto file = File(filename, "r");
int length;
file.readf("numModes: %s", &length);
foreach (i; 0 .. length) {
CellMode mode;
string cellType;
file.readf(" cellType: %s\n", &cellType);
mode.cellType = to!CellType(cellType);
file.readf(" makeAdhesin: %s", &mode.makeAdhesin);
file.readf(" nutrientPriority: %s", &mode.nutrientPriority);
file.readf(" splitThreshold: %s", &mode.splitThreshold);
file.readf(" splitRatio: %s", &mode.splitRatio);
file.readf(" splitAngle: %s", &mode.splitAngle);
file.readf(" child1Rotation: %s", &mode.child1Rotation);
file.readf(" child1Mode: %s", &mode.child1Mode);
file.readf(" child1KeepAdhesin: %s", &mode.child1KeepAdhesin);
file.readf(" child2Rotation: %s", &mode.child2Rotation);
file.readf(" child2Mode: %s", &mode.child2Mode);
file.readf(" child2KeepAdhesin: %s", &mode.child2KeepAdhesin);
file.readf(
" color: SDL_Color(%s, %s, %s, 0)",
&mode.color.r,
&mode.color.g,
&mode.color.b,
);
genome.cellModes ~= mode;
}
return genome;
}
};
enum CellType {
phagocyte,
flagellocyte,
photocyte,
devorocyte,
lipocyte,
keratinocyte,
buoyocyte,
glueocyte,
virocyte,
nitrocyte
};
struct CellMode {
CellType cellType = CellType.phagocyte;
bool makeAdhesin = false;
double nutrientPriority = 1;
double splitThreshold = 2.5;
double splitRatio = 1;
double splitAngle = 0;
double child1Rotation = 0;
byte child1Mode; // 0 - 15
bool child1KeepAdhesin = true;
double child2Rotation = 0;
byte child2Mode; // 0 - 15
bool child2KeepAdhesin = true;
SDL_Color color;
};
void save(Genome genome, string filename) {
File(filename, "w").print(genome);
}
void print(File file, Genome genome) {
file.writeln("numModes: ", genome.cellModes.length);
file.writeln();
foreach (mode; genome.cellModes) {
file.writeln("cellType: ", mode.cellType);
file.writeln("makeAdhesin: ", mode.makeAdhesin);
file.writeln("nutrientPriority: ", mode.nutrientPriority);
file.writeln("splitThreshold: ", mode.splitThreshold);
file.writeln("splitRatio: ", mode.splitRatio);
file.writeln("splitAngle: ", mode.splitAngle);
file.writeln("child1Rotation: ", mode.child1Rotation);
file.writeln("child1Mode: ", mode.child1Mode);
file.writeln("child1KeepAdhesin: ", mode.child1KeepAdhesin);
file.writeln("child2Rotation: ", mode.child2Rotation);
file.writeln("child2Mode: ", mode.child2Mode);
file.writeln("child2KeepAdhesin: ", mode.child2KeepAdhesin);
file.writeln("color: ", mode.color);
file.writeln();
}
}
|
D
|
/Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/WebSocket.build/WebSocket+Server.swift.o : /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocketFrameSequence.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocketHandler.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocket+Server.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/Exports.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocket.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocket+Client.swift /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/XPC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Swift.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/IOKit.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-macos.swiftinterface /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOHTTP1.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/HTTP.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Crypto.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/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOWebSocket.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOSHA1/include/CNIOSHA1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/asn1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/tls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/md5.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509.h /usr/local/Cellar/libressl/3.0.2/include/openssl/sha.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rsa.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOZlib/include/CNIOZlib.h /usr/local/Cellar/libressl/3.0.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/hmac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ec.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rand.h /usr/local/Cellar/libressl/3.0.2/include/openssl/conf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/lhash.h /usr/local/Cellar/libressl/3.0.2/include/openssl/stack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/safestack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bn.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bio.h /usr/local/Cellar/libressl/3.0.2/include/openssl/crypto.h /usr/local/Cellar/libressl/3.0.2/include/openssl/srtp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/evp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/3.0.2/include/openssl/buffer.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/3.0.2/include/openssl/err.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/3.0.2/include/openssl/objects.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslv.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509_vfy.h /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio-ssl-support/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/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/WebSocket.build/WebSocket+Server~partial.swiftmodule : /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocketFrameSequence.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocketHandler.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocket+Server.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/Exports.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocket.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocket+Client.swift /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/XPC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Swift.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/IOKit.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-macos.swiftinterface /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOHTTP1.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/HTTP.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Crypto.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/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOWebSocket.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOSHA1/include/CNIOSHA1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/asn1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/tls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/md5.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509.h /usr/local/Cellar/libressl/3.0.2/include/openssl/sha.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rsa.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOZlib/include/CNIOZlib.h /usr/local/Cellar/libressl/3.0.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/hmac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ec.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rand.h /usr/local/Cellar/libressl/3.0.2/include/openssl/conf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/lhash.h /usr/local/Cellar/libressl/3.0.2/include/openssl/stack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/safestack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bn.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bio.h /usr/local/Cellar/libressl/3.0.2/include/openssl/crypto.h /usr/local/Cellar/libressl/3.0.2/include/openssl/srtp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/evp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/3.0.2/include/openssl/buffer.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/3.0.2/include/openssl/err.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/3.0.2/include/openssl/objects.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslv.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509_vfy.h /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio-ssl-support/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/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/WebSocket.build/WebSocket+Server~partial.swiftdoc : /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocketFrameSequence.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocketHandler.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocket+Server.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/Exports.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocket.swift /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/websocket/Sources/WebSocket/WebSocket+Client.swift /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/XPC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Swift.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/IOKit.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-macos.swiftinterface /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOHTTP1.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/HTTP.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Crypto.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/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/NIOWebSocket.swiftmodule /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOSHA1/include/CNIOSHA1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/asn1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/tls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/md5.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509.h /usr/local/Cellar/libressl/3.0.2/include/openssl/sha.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rsa.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOZlib/include/CNIOZlib.h /usr/local/Cellar/libressl/3.0.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/hmac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ec.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rand.h /usr/local/Cellar/libressl/3.0.2/include/openssl/conf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/lhash.h /usr/local/Cellar/libressl/3.0.2/include/openssl/stack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/safestack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bn.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bio.h /usr/local/Cellar/libressl/3.0.2/include/openssl/crypto.h /usr/local/Cellar/libressl/3.0.2/include/openssl/srtp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/evp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/3.0.2/include/openssl/buffer.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/CNIOHTTPParser.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /usr/local/Cellar/libressl/3.0.2/include/openssl/err.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/3.0.2/include/openssl/objects.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslv.h /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509_vfy.h /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/christian/GitHub/vapor/HelloVapor/.build/checkouts/swift-nio-ssl-support/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
|
func int B_TeachPlayerTalentAlchemy(var C_Npc slf,var C_Npc oth,var int potion)
{
var int kosten;
kosten = B_GetLearnCostTalent(oth,NPC_TALENT_ALCHEMY,potion);
if(oth.lp < kosten)
{
PrintScreen(PRINT_NotEnoughLearnPoints,-1,-1,FONT_ScreenSmall,2);
B_Say(slf,oth,"$NOLEARNNOPOINTS");
return FALSE;
};
oth.lp = oth.lp - kosten;
Log_CreateTopic(TOPIC_TalentAlchemy,LOG_NOTE);
B_LogEntry(TOPIC_TalentAlchemy,"×òîáû ñâàðèòü çåëüå, ìíå íóæíà ïóñòàÿ ìåíçóðêà è íåîáõîäèìûå äëÿ ýòîãî çåëüÿ èíãðåäèåíòû. Èç ýòèõ èíãðåäèåíòîâ, ÿ ìîãó ïðèãîòîâèòü çåëüå íà ñòîëå àëõèìèêà.");
if(potion == POTION_Health_01)
{
PLAYER_TALENT_ALCHEMY[POTION_Health_01] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ËÅ×ÅÁÍÎÉ ÝÑÑÅÍÖÈÈ': 2 ëå÷åáíûå òðàâû è 1 ëóãîâîé ãîðåö.");
};
if(potion == POTION_Health_02)
{
PLAYER_TALENT_ALCHEMY[POTION_Health_02] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ËÅ×ÅÁÍÎÃÎ ÝÊÑÒÐÀÊÒÀ': 2 ëå÷åáíûõ ðàñòåíèÿ è 1 ëóãîâîé ãîðåö.");
};
if(potion == POTION_Health_03)
{
PLAYER_TALENT_ALCHEMY[POTION_Health_03] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ËÅ×ÅÁÍÎÃÎ ÝËÈÊÑÈÐÀ': 2 ëå÷åáíûõ êîðíÿ è 1 ëóãîâîé ãîðåö.");
};
if(potion == POTION_Mana_01)
{
PLAYER_TALENT_ALCHEMY[POTION_Mana_01] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ÝÑÑÅÍÖÈÈ ÌÀÍÛ': 2 îãíåííûõ êðàïèâû è 1 ëóãîâîé ãîðåö.");
};
if(potion == POTION_Mana_02)
{
PLAYER_TALENT_ALCHEMY[POTION_Mana_02] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ÝÊÑÒÐÀÊÒÀ ÌÀÍÛ': 2 îãíåííûõ òðàâû è 1 ëóãîâîé ãîðåö.");
};
if(potion == POTION_Mana_03)
{
PLAYER_TALENT_ALCHEMY[POTION_Mana_03] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ÝËÈÊÑÈÐÀ ÌÀÍÛ': 2 îãíåííûõ êîðíÿ è 1 ëóãîâîé ãîðåö");
};
if(potion == POTION_Speed)
{
PLAYER_TALENT_ALCHEMY[POTION_Speed] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ÇÅËÜß ÓÑÊÎÐÅÍÈß': 1 ñíåïïåð-òðàâà è 1 ëóãîâîé ãîðåö");
};
if(potion == POTION_Perm_STR)
{
PLAYER_TALENT_ALCHEMY[POTION_Perm_STR] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ÝËÈÊÑÈÐÀ ÑÈËÛ': 1 äðàêîíèé êîðåíü è 1 öàðñêèé ùàâåëü.");
};
if(potion == POTION_Perm_DEX)
{
PLAYER_TALENT_ALCHEMY[POTION_Perm_DEX] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ÝËÈÊÑÈÐÀ ËÎÂÊÎÑÒÈ': 1 ãîáëèíñêèå ÿãîäû è 1 öàðñêèé ùàâåëü.");
};
if(potion == POTION_Perm_Mana)
{
PLAYER_TALENT_ALCHEMY[POTION_Perm_Mana] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ÝËÈÊÑÈÐÀ ÄÓÕÀ': 1 îãíåííûé êîðåíü è 1 öàðñêèé ùàâåëü.");
};
if(potion == POTION_Perm_Health)
{
PLAYER_TALENT_ALCHEMY[POTION_Perm_Health] = TRUE;
B_LogEntry(TOPIC_TalentAlchemy,"Èíãðåäèåíòû äëÿ 'ÝËÈÊÑÈÐÀ ÆÈÇÍÈ': 1 ëå÷åáíûé êîðåíü è 1 öàðñêèé ùàâåëü.");
};
PrintScreen(PRINT_LearnAlchemy,-1,-1,FONT_Screen,2);
Npc_SetTalentSkill(oth,NPC_TALENT_ALCHEMY,1);
return TRUE;
};
|
D
|
module android.java.android.telephony.VisualVoicemailSmsFilterSettings_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.android.os.Parcel_d_interface;
final class VisualVoicemailSmsFilterSettings : IJavaObject {
static immutable string[] _d_canCastTo = [
"android/os/Parcelable",
];
@Import int describeContents();
@Import void writeToParcel(import0.Parcel, int);
@Import @JavaName("toString") string toString_();
override string toString() { return arsd.jni.javaObjectToString(this); }
@Import import1.Class getClass();
@Import int hashCode();
@Import bool equals(IJavaObject);
@Import void notify();
@Import void notifyAll();
@Import void wait(long);
@Import void wait(long, int);
@Import void wait();
mixin IJavaObjectImplementation!(false);
public static immutable string _javaParameterString = "Landroid/telephony/VisualVoicemailSmsFilterSettings;";
}
|
D
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
module hunt.shiro.session.mgt.ValidatingSession;
import hunt.shiro.Exceptions;
import hunt.shiro.session.Session;
/**
* A <code>ValidatingSession</code> is a <code>Session</code> that is capable of determining it is valid or not and
* is able to validate itself if necessary.
* <p/>
* Validation is usually an exercise of determining when the session was last accessed or modified and determining if
* that time is longer than a specified allowed duration.
*
*/
interface ValidatingSession : Session {
bool isValid();
void validate();
}
|
D
|
instance BDT_1044_Bandit_L(Npc_Default)
{
name[0] = NAME_Bandit;
guild = GIL_BDT;
id = 1044;
voice = 1;
flags = 0;
npcType = NPCTYPE_AMBIENT;
aivar[AIV_EnemyOverride] = TRUE;
B_SetAttributesToChapter(self,1);
fight_tactic = FAI_HUMAN_COWARD;
EquipItem(self,ItMw_1h_Bau_Mace);
B_CreateAmbientInv(self);
B_SetNpcVisual(self,MALE,"Hum_Head_Thief",Face_P_Tough_Rodriguez,BodyTex_P,ITAR_Leather_L);
Mdl_SetModelFatness(self,0);
Mdl_ApplyOverlayMds(self,"Humans_Relaxed.mds");
B_GiveNpcTalents(self);
B_SetFightSkills(self,30);
daily_routine = Rtn_Start_1044;
};
func void Rtn_Start_1044()
{
TA_Smalltalk(0,0,12,0,"NW_CASTLEMINE_TOWER_STAND_02");
TA_Smalltalk(12,0,0,0,"NW_CASTLEMINE_TOWER_STAND_02");
};
|
D
|
/Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/HTTP.build/Parser/ParseResults.swift.o : /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Async/Response+Async.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Method/Method.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Messages/Message.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Response/ResponseRepresentable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Body/BodyRepresentable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Messages/Message+CustomStringConvertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Middleware/Middleware.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Response/Response.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Middleware/Middleware+Chaining.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Method/Method+String.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Chunk/Response+Chunk.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Chunk/Body+Chunk.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Chunk/ChunkStream.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Version/Version.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/URI+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/Response+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/Client+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/Request+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Responder/Responder.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Responder/AsyncResponder.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/AsyncServerWorker.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/CHTTPParser.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/ResponseParser.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/RequestParser.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/Server.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/TCPServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/TLSServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/BasicServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/AsyncServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/Serializer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/ResponseSerializer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/RequestSerializer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/ParserError.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/ServerError.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/SerializerError.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Body/Body+Bytes.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Headers/Headers.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/ParseResults.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Status/Status.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Response/Response+Redirect.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Client/HTTP+Client.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Client/Client.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Request/Request.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/ThreadsafeArray.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Body/Body.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/URI.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/TLS.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 /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Random.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/Sockets.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/checkouts/engine.git-3311994267206676365/Sources/CHTTP/include/http_parser.h /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/ctls.git-9210868160426949823/module.modulemap /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/Darwin.apinotes
/Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/HTTP.build/ParseResults~partial.swiftmodule : /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Async/Response+Async.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Method/Method.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Messages/Message.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Response/ResponseRepresentable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Body/BodyRepresentable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Messages/Message+CustomStringConvertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Middleware/Middleware.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Response/Response.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Middleware/Middleware+Chaining.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Method/Method+String.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Chunk/Response+Chunk.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Chunk/Body+Chunk.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Chunk/ChunkStream.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Version/Version.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/URI+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/Response+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/Client+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/Request+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Responder/Responder.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Responder/AsyncResponder.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/AsyncServerWorker.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/CHTTPParser.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/ResponseParser.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/RequestParser.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/Server.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/TCPServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/TLSServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/BasicServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/AsyncServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/Serializer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/ResponseSerializer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/RequestSerializer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/ParserError.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/ServerError.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/SerializerError.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Body/Body+Bytes.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Headers/Headers.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/ParseResults.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Status/Status.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Response/Response+Redirect.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Client/HTTP+Client.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Client/Client.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Request/Request.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/ThreadsafeArray.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Body/Body.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/URI.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/TLS.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 /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Random.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/Sockets.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/checkouts/engine.git-3311994267206676365/Sources/CHTTP/include/http_parser.h /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/ctls.git-9210868160426949823/module.modulemap /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/Darwin.apinotes
/Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/HTTP.build/ParseResults~partial.swiftdoc : /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Async/Response+Async.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Method/Method.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Messages/Message.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Response/ResponseRepresentable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Body/BodyRepresentable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Messages/Message+CustomStringConvertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Middleware/Middleware.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Response/Response.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Middleware/Middleware+Chaining.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Method/Method+String.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Chunk/Response+Chunk.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Chunk/Body+Chunk.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Chunk/ChunkStream.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Version/Version.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/URI+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/Response+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/Client+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/FoundationClient/Request+Foundation.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Responder/Responder.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Responder/AsyncResponder.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/AsyncServerWorker.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/CHTTPParser.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/ResponseParser.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/RequestParser.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/Server.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/TCPServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/TLSServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/BasicServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/AsyncServer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/Serializer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/ResponseSerializer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/RequestSerializer.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/ParserError.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/ServerError.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Serializer/SerializerError.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Body/Body+Bytes.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Headers/Headers.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Parser/ParseResults.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Status/Status.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Response/Response+Redirect.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Client/HTTP+Client.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Client/Client.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Request/Request.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Server/ThreadsafeArray.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/engine.git-3311994267206676365/Sources/HTTP/Body/Body.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/URI.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/TLS.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 /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Random.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/Sockets.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/checkouts/engine.git-3311994267206676365/Sources/CHTTP/include/http_parser.h /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/ctls.git-9210868160426949823/module.modulemap /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/Darwin.apinotes
|
D
|
/Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/MultipartFormData.o : /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/MultipartFormData.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Timeline.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Response.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/TaskDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ParameterEncoding.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Validation.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ResponseSerialization.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/AFError.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Notifications.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Result.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Request.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/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/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/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/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/MultipartFormData~partial.swiftmodule : /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/MultipartFormData.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Timeline.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Response.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/TaskDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ParameterEncoding.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Validation.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ResponseSerialization.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/AFError.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Notifications.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Result.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Request.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/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/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/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/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/MultipartFormData~partial.swiftdoc : /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/MultipartFormData.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Timeline.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Response.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/TaskDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ParameterEncoding.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Validation.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ResponseSerialization.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/AFError.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Notifications.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Result.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Request.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/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/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/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
|
import std.stdio;
import std.file;
import std.string;
void main(string[] args){
if (args.length == 2) {
string cwd = getcwd();
string argument = args[1];
if (argument == "-h") {
printHelp();
exitProgram(0);
} else {
hexdump(argument);
}
} else if (args.length < 2) {
printHelp();
exitProgram(0);
} }
void hexdump(string inputPath) {
// open input file
File INPUT_FILE = File(inputPath, "r");
try{
// read into buffer
byte[] buffer = rawReadUntilEOF(inputPath);
// write buffer as hex and ascii next to each other
writeBufferFancy(buffer);
} catch (FileException) {
writeln("Something went wrong reading the file. Are you sure you have permissions?");
}
}
void printHelp() {
writeln("SYNOPSIS");
writeln("\tdhex [OPTIONS] /path/to/file");
writeln("");
writeln("OPTIONS");
writeln("\t-h\tPrint help (this text).");
}
byte[] rawReadUntilEOF(string path){
import std.array: appender;
auto output = appender!(byte[]);
// try catch later
auto file = File(path, "r");
while(!file.eof){
output.put(file.rawRead(new byte[1]));
}
return output.data;
}
void writeBufferFancy(byte[] arr){
auto chunkWidth = 24;
int lineWidth = chunkWidth / 2 + 4;
// loop through buffer
for (auto x = 0; x < arr.length; x += chunkWidth) {
// print hex
for (auto y = x; y < chunkWidth + x; y++){
if (y < arr.length) {
writef("%2X ", cast(char)arr[y]);
}
}
write(" ");
// print ascii
for (auto y = x; y < chunkWidth + x; y++) {
if (y < arr.length) {
char current = cast(char) arr[y];
/** if it's not space and bigger than 0x1f
(meaning it's not a control operator) */
if (current != cast(char) " "
&& current != cast(char) ""
&& current > cast(char) 0x20
&& current < cast(char) 0x7E
){
writef("%c", cast(char)arr[y]);
} else {
write(".");
}
}
}
write("\n");
}
}
void exitProgram(int statusCode) {
import core.stdc.stdlib : exit;
exit(statusCode);
}
|
D
|
_DATA XE 200 82
86 8b 8d 93 95 9a 9e 82
86 89 8f 93 95 9a 9e 82
86 89 8f 91 97 9a 9e 82
86 8b 8d 91 97 9a 9e 82
86 8b 8d 93 94 9a 9d 82
86 89 8f 92 95 99 9e 82
86 89 8f 90 97 99 9e 82
86 8b 8d 91 96 9a 9d 83
84 8b 8d 93 94 9a 9d 80
87 89 8f 92 95 99 9e 80
87 89 8f 90 97 99 9e 83
84 8b 8d 91 96 9a 9d 82
85 8a 8d 93 95 9a 9e 82
85 88 8f 93 95 9a 9e 81
86 89 8e 91 97 9a 9e 81
86 8b 8c 91 97 9a 9e 82
85 8a 8d 93 94 9a 9d 82
85 88 8f 92 95 99 9e 81
86 89 8e 90 97 99 9e 81
86 8b 8c 91 96 9a 9d 82
85 8a 8d 93 95 98 9f 82
85 88 8f 93 95 98 9f 81
86 89 8e 91 97 9b 9c 81
86 8b 8c 91 97 9b 9c 83
84 8a 8d 93 94 9a 9d 80
87 88 8f 92 95 99 9e 80
87 89 8e 90 97 99 9e 83
84 8b 8c 91 96 9a 9d 82
85 8a 8d 93 94 98 9f 82
85 88 8f 92 95 98 9f 81
86 89 8e 90 97 9b 9c 81
86 8b 8c 91 96 9b 9c 83
85 8a 8d 93 94 98 9d 80
85 88 8f 92 95 99 9f 81
87 89 8e 90 97 99 9c 81
84 8b 8c 91 96 9b 9d 82
85 8a 8d 93 94 98 9d 82
85 88 8f 92 95 99 9f 81
86 89 8e 90 97 99 9c 81
86 8b 8c 91 96 9b 9d 83
85 8a 8d 93 94 9a 9d 80
85 88 8f 92 95 99 9e 81
87 89 8e 90 97 99 9e 81
84 8b 8c 91 96 9a 9d 83
84 8a 8d 93 94 98 9d 80
87 88 8f 92 95 99 9f 80
87 89 8e 90 97 99 9c 83
84 8b 8c 91 96 9b 9d 83
85 8a 8d 93 94 98 9f 80
85 88 8f 92 95 98 9f 81
87 89 8e 90 97 9b 9c 81
84 8b 8c 91 96 9b 9c
_END
|
D
|
[cc]mc |
.hd ucc "compile and load a C program (Unix-style)" 10/10/84
ucc { <input_files> } [ <cc_opts> ] [ <compile_opts> ]
.ds
'Ucc' is a "UNIX-style" C compiler and loader. It does NOT,
however, behave like Unix's 'cc' or any other known Unix program!
.sp
'Ucc' compiles and loads the pathnames specified.
It assumes that all programs require C runtime support and
loads them accordingly.
.sp
'Ucc' recognizes the same set of options as 'cc'.
These are passed as C-specific options to 'compile'.
Any other options are passed on to 'compile' directly,
which does the real work of recognizing suffixes and compiling
and loading the files appropriately.
.sp
'Ucc' remains in existence mainly for compatibility
with the first release of the C compiler.
.es
ucc sort.c
ucc sort.c -ud # the -ud is automatically passed on to 'ld'
ucc main.c lib.r lib.s -R-t
.bu
Has basically become obsolete.
.sp
.bf 100
This program is only available to licensees of Version 2.0
of the Georgia Tech C Compiler.
.bf 0
.sa
compile (1), cc (1), ccl (1), vcg (1), ld (1), bind (3),
.ul
User's Guide for the Georgia Tech C Compiler
[cc]mc
|
D
|
module hunt.xml.Serialize;
T xmlToObject(T)(string xml)
{
return null;
}
|
D
|
instance VLK_413_BOSPER(NPC_DEFAULT)
{
name[0] = "Боспер";
guild = GIL_VLK;
id = 413;
voice = 11;
flags = NPC_FLAG_IMMORTAL;
npctype = NPCTYPE_MAIN;
b_setattributestochapter(self,2);
fight_tactic = FAI_HUMAN_STRONG;
EquipItem(self,itmw_1h_vlk_dagger);
EquipItem(self,itrw_sld_bow);
b_setnpcvisual(self,MALE,"Hum_Head_FatBald",FACE_L_TOUGH_SANTINO,BODYTEX_L,itar_leather_l);
Mdl_SetModelFatness(self,0.8);
Mdl_ApplyOverlayMds(self,"Humans_Relaxed.mds");
b_givenpctalents(self);
b_setfightskills(self,35);
daily_routine = rtn_start_413;
};
func void rtn_start_413()
{
ta_stand_guarding(5,0,0,0,"NW_CITY_MERCHANT_SHOP01_IN_02");
ta_sleep(0,0,5,0,"NW_CITY_BED_GRITTA");
};
|
D
|
/**
Cookie based session support.
Copyright: © 2012 RejectedSoftware e.K.
License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file.
Authors: Jan Krüger, Sönke Ludwig
*/
module vibe.http.session;
import vibe.core.log;
import std.base64;
import std.array;
import std.random;
/**
Represents a single HTTP session.
Indexing the session object with string keys allows to store arbitrary key/value pairs.
*/
final class Session {
private {
SessionStore m_store;
string m_id;
}
private this(SessionStore store, string id=null) {
m_store = store;
if (id) {
m_id = id;
} else {
auto rnd = appender!(ubyte[])();
foreach(i;0..16) rnd.put(cast(ubyte)uniform(0, 255));
m_id = cast(immutable)Base64.encode(rnd.data);
}
}
int opApply(int delegate(ref string key, ref string value) del)
{
foreach( key, ref value; m_store.iterateSession(m_id) )
if( auto ret = del(key, value) != 0 )
return ret;
return 0;
}
/// Returns the unique session id of this session.
@property string id() const { return m_id; }
/// Gets/sets a key/value pair stored within the session.
string opIndex(string name) const { return m_store.get(m_id, name); }
/// ditto
void opIndexAssign(string value, string name) { m_store.set(m_id, name, value); }
/// Queries the session for the existence of a particular key.
bool isKeySet(string key) const { return m_store.isKeySet(m_id, key); }
package void destroy() { m_store.destroy(m_id); }
}
/**
Interface for a basic session store.
A sesseion store is responsible for storing the id and the associated key/value pairs of a
session.
*/
interface SessionStore {
Session create();
Session open(string id);
void set(string id, string name, string value);
string get(string id, string name, string defaultVal = null) const;
bool isKeySet(string id, string key) const;
void destroy(string id);
int delegate(int delegate(ref string key, ref string value)) iterateSession(string id);
}
/**
Session store for storing a session in local memory.
If the server is running as a single instance (no thread or process clustering), this kind of
session store provies the fastest and simplest way to store sessions. In any other case,
a persistent session store based on a database is necessary.
*/
final class MemorySessionStore : SessionStore {
private {
string[string][string] m_sessions;
}
this() {}
Session create() {
return new Session(this);
}
Session open(string id) {
auto pv = id in m_sessions;
return pv ? new Session(this, id) : null;
}
void set(string id, string name, string value) {
m_sessions[id][name] = value;
foreach(k,v; m_sessions[id]) logTrace("Csession[%s][%s] = %s", id, k, v);
}
string get(string id, string name, string defaultVal=null)
const {
assert(id in m_sessions, "session not in store");
foreach(k,v; m_sessions[id]) logTrace("Dsession[%s][%s] = %s", id, k, v);
if (auto pv = name in m_sessions[id]) {
return *pv;
} else {
return defaultVal;
}
}
bool isKeySet(string id, string key)
const {
return (key in m_sessions[id]) !is null;
}
void destroy(string id)
{
m_sessions.remove(id);
}
int delegate(int delegate(ref string key, ref string value)) iterateSession(string id)
{
assert(id in m_sessions, "session not in store");
return (int delegate(ref string, ref string) del){
foreach( key, ref value; m_sessions[id] )
if( auto ret = del(key, value) != 0 )
return ret;
return 0;
};
}
}
|
D
|
PLONG PLAT ED95 KD LOMAGAGE HIMAGAGE SLAT SLONG RESULTNO DP DM WT ROCKTYPE
-65.400002 61.2999992 1.39999998 297 50 70 -31.6000004 145.600006 9339 2.20000005 2.20000005 0.1 sediments, saprolite
264.399994 75 15.6000004 0 2 65 -8.80000019 126.699997 1206 10.3999996 18 0.0317460317 extrusives, intrusives
346 61 9 41.2000008 35 100 -31.3999996 138.600006 1170 13 15 0.0307692308 sediments
333 45 9 16.5 35 100 -30.3999996 139.399994 1161 17 18 0.0307692308 sediments, tillite
317 57 5 200 35 100 -30.5 139.300003 1165 9 10 0.0307692308 sediments, redbeds
329 58 25 4.0999999 35 100 -30.2000008 139 1166 41.5999985 45.5999985 0.0307692308 sediments, sandstone, tillite
223 26 13 14.8000002 35 100 -30.2999992 139.5 1157 26 26 0.0307692308 extrusives
320 63 9 15.5 34 65 -38 145.5 1854 16 16 0.064516129 extrusives
317 63 14 16 23 56 -32.5 151 1840 20 20 0.0606060606 extrusives, basalts
302.700012 66.8000031 6.80000019 35 34 65 -38 145.5 1819 10.8000002 12.1000004 0.064516129 extrusives
305 73 17 29 23 56 -42 147 1821 25 29 0.0606060606 extrusives, basalts
274 66 27.6000004 8.60000038 25 65 -41.2999992 145.899994 1873 39.7999992 46.9000015 0.05 intrusives, granite
321 64 6 27.5 25 65 -35.5999985 137.5 1874 10 11 0.05 sediments
269 40 0 0 50 300 -32.5999985 151.5 1868 0 0 0.008 extrusives, andesites
294 75 11 7 25 65 -41.0999985 146.100006 1871 16.2999992 18.8999996 0.05 sediments, sandstone
315 66 10.5 18 25 65 -41 145.5 1872 18.2000008 19.6000004 0.05 extrusives, sediments
298 58.7999992 2.4000001 0 35 65 -27 141.5 1972 3.79999995 3.79999995 0.0666666667 sediments, weathered
297.200012 59.2000008 6 0 50 70 -30.5 151.5 1964 9.10000038 9.89999962 0.1 sediments, weathered
310.899994 68.5 0 0 40 60 -35 150 1927 5.19999981 5.19999981 0.1 extrusives, basalts
271 63 2.9000001 352 50 80 -34 151 1595 3.5 4.5 0.0666666667 intrusives
|
D
|
a dark oil consisting mainly of hydrocarbons
not carefully or expertly made
conspicuously and tastelessly indecent
not refined or processed
belonging to an early stage of technical development
devoid of any qualifications or disguise or adornment
not processed or subjected to analysis
|
D
|
module android.java.java.nio.file.attribute.AclEntryPermission_d_interface;
import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers;
static import arsd.jni;
import import2 = android.java.java.lang.Class_d_interface;
import import0 = android.java.java.nio.file.attribute.AclEntryPermission_d_interface;
import import1 = android.java.java.lang.Enum_d_interface;
final class AclEntryPermission : IJavaObject {
static immutable string[] _d_canCastTo = [
];
@Import static import0.AclEntryPermission[] values();
@Import static import0.AclEntryPermission valueOf(string);
@Import string name();
@Import int ordinal();
@Import @JavaName("toString") string toString_();
override string toString() { return arsd.jni.javaObjectToString(this); }
@Import bool equals(IJavaObject);
@Import int hashCode();
@Import int compareTo(import1.Enum);
@Import import2.Class getDeclaringClass();
@Import static import1.Enum valueOf(import2.Class, string);
@Import int compareTo(IJavaObject);
@Import import2.Class getClass();
@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/nio/file/attribute/AclEntryPermission;";
}
|
D
|
# FIXED
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/utils/uartstdio.c
utils/uartstdio.obj: C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdbool.h
utils/uartstdio.obj: C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdint.h
utils/uartstdio.obj: C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h
utils/uartstdio.obj: C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/cdefs.h
utils/uartstdio.obj: C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h
utils/uartstdio.obj: C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h
utils/uartstdio.obj: C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_stdint.h
utils/uartstdio.obj: C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h
utils/uartstdio.obj: C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdarg.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/inc/hw_ints.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/inc/hw_memmap.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/inc/hw_types.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/inc/hw_uart.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/debug.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/interrupt.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/rom.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/rom_map.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/sysctl.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/uart.h
utils/uartstdio.obj: C:/ti/TivaWare_C_Series-2.1.4.178/utils/uartstdio.h
C:/ti/TivaWare_C_Series-2.1.4.178/utils/uartstdio.c:
C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdbool.h:
C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdint.h:
C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h:
C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/cdefs.h:
C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h:
C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h:
C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_stdint.h:
C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h:
C:/ti1/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdarg.h:
C:/ti/TivaWare_C_Series-2.1.4.178/inc/hw_ints.h:
C:/ti/TivaWare_C_Series-2.1.4.178/inc/hw_memmap.h:
C:/ti/TivaWare_C_Series-2.1.4.178/inc/hw_types.h:
C:/ti/TivaWare_C_Series-2.1.4.178/inc/hw_uart.h:
C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/debug.h:
C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/interrupt.h:
C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/rom.h:
C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/rom_map.h:
C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/sysctl.h:
C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/uart.h:
C:/ti/TivaWare_C_Series-2.1.4.178/utils/uartstdio.h:
|
D
|
/Users/omac/Desktop/TestTask/PicturesNetwork/build/PicturesNetwork.build/Debug-iphonesimulator/PicturesNetwork.build/Objects-normal/x86_64/PicturesNetwork.o : /Users/omac/Desktop/TestTask/PicturesNetwork/PicturesNetwork/PicturesNetwork.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/omac/Desktop/TestTask/PicturesNetwork/PicturesNetwork/PicturesNetwork.h /Users/omac/Desktop/TestTask/PicturesNetwork/build/PicturesNetwork.build/Debug-iphonesimulator/PicturesNetwork.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/omac/Desktop/TestTask/PicturesNetwork/build/PicturesNetwork.build/Debug-iphonesimulator/PicturesNetwork.build/Objects-normal/x86_64/PicturesNetwork~partial.swiftmodule : /Users/omac/Desktop/TestTask/PicturesNetwork/PicturesNetwork/PicturesNetwork.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/omac/Desktop/TestTask/PicturesNetwork/PicturesNetwork/PicturesNetwork.h /Users/omac/Desktop/TestTask/PicturesNetwork/build/PicturesNetwork.build/Debug-iphonesimulator/PicturesNetwork.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/omac/Desktop/TestTask/PicturesNetwork/build/PicturesNetwork.build/Debug-iphonesimulator/PicturesNetwork.build/Objects-normal/x86_64/PicturesNetwork~partial.swiftdoc : /Users/omac/Desktop/TestTask/PicturesNetwork/PicturesNetwork/PicturesNetwork.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/omac/Desktop/TestTask/PicturesNetwork/PicturesNetwork/PicturesNetwork.h /Users/omac/Desktop/TestTask/PicturesNetwork/build/PicturesNetwork.build/Debug-iphonesimulator/PicturesNetwork.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
instance DIA_Andre_EXIT(C_Info)
{
npc = MIL_311_Andre;
nr = 999;
condition = DIA_Andre_EXIT_Condition;
information = DIA_Andre_EXIT_Info;
permanent = TRUE;
description = Dialog_Ende;
};
func int DIA_Andre_EXIT_Condition()
{
if(self.aivar[AIV_TalkedToPlayer] == TRUE)
{
return TRUE;
};
};
func void DIA_Andre_EXIT_Info()
{
B_PlayerEnteredCity();
AI_StopProcessInfos(self);
};
instance DIA_Andre_FIRSTEXIT(C_Info)
{
npc = MIL_311_Andre;
nr = 999;
condition = DIA_Andre_FIRSTEXIT_Condition;
information = DIA_Andre_FIRSTEXIT_Info;
permanent = FALSE;
description = Dialog_Ende;
};
func int DIA_Andre_FIRSTEXIT_Condition()
{
if(self.aivar[AIV_TalkedToPlayer] == FALSE)
{
return TRUE;
};
};
func void DIA_Andre_FIRSTEXIT_Info()
{
AI_StopProcessInfos(self);
Npc_ExchangeRoutine(self,"START");
B_StartOtherRoutine(Wulfgar,"START");
};
var int Andre_Steckbrief;
func void B_Andre_Steckbrief()
{
AI_Output(self,other,"DIA_Andre_Add_08_00"); //Один из моих людей сказал мне, что бандиты распространяют объявления о розыске с твоим изображением.
AI_Output(self,other,"DIA_Andre_Add_08_01"); //Он также сказал, что поначалу ты это отрицал.
AI_Output(self,other,"DIA_Andre_Add_08_02"); //Так что все это значит?
AI_Output(other,self,"DIA_Andre_Add_15_03"); //Я не знаю, почему они ищут меня...
AI_Output(self,other,"DIA_Andre_Add_08_04"); //Надеюсь, ради твоего же блага, что ты говоришь мне правду.
if((other.guild == GIL_NONE) || (other.guild == GIL_MIL))
{
AI_Output(self,other,"DIA_Andre_Add_08_05"); //Мне не нужны в ополчении люди с запятнанной репутацией.
};
AI_Output(self,other,"DIA_Andre_Add_08_06"); //Большинство из этих бандитов - бывшие каторжники из колонии.
AI_Output(self,other,"DIA_Andre_Add_08_07"); //Я надеюсь, что ты никак не связан с этими головорезами!
Andre_Steckbrief = TRUE;
};
var int Andre_CantharFalle;
func void B_Andre_CantharFalle()
{
AI_Output(self,other,"B_Andre_CantharFalle_08_00"); //Ко мне приходил торговец Кантар. Он сказал, что ты беглый каторжник из колонии.
AI_Output(self,other,"B_Andre_CantharFalle_08_01"); //Я не знаю, правда ли это, и предпочитаю не спрашивать тебя об этом, но ты должен уладить этот вопрос.
if((other.guild == GIL_NONE) || (other.guild == GIL_MIL))
{
if(Andre_Steckbrief == FALSE)
{
AI_Output(self,other,"DIA_Andre_Add_08_05"); //Мне не нужны в ополчении люди с запятнанной репутацией.
};
};
if(SarahWeaponsRemoved == FALSE)
{
B_GiveTradeInv_Sarah(Sarah);
B_RemoveSarahWeapons();
};
B_RemoveNpc(Sarah);
if((Canthar_Ausgeliefert == TRUE) && (Npc_GetDistToWP(Canthar,"NW_CITY_HABOUR_KASERN_RENGARU") <= 1000))
{
B_NpcSetReleased(Canthar);
Canthar.aivar[AIV_IGNORE_Murder] = FALSE;
Canthar.aivar[AIV_IGNORE_Theft] = FALSE;
Canthar.aivar[AIV_IGNORE_Sheepkiller] = FALSE;
};
B_StartOtherRoutine(Canthar,"MARKTSTAND");
AI_Teleport(Canthar,"NW_CITY_SARAH");
if((Canthar_Sperre == FALSE) && (Canthar_Pay == FALSE))
{
Canthar_Sperre = TRUE;
};
MIS_Canthars_KomproBrief = LOG_OBSOLETE;
B_CheckLog();
Andre_CantharFalle = TRUE;
};
instance DIA_Andre_CantharFalle(C_Info)
{
npc = MIL_311_Andre;
nr = 3;
condition = DIA_Andre_CantharFalle_Condition;
information = DIA_Andre_CantharFalle_Info;
permanent = TRUE;
important = TRUE;
};
func int DIA_Andre_CantharFalle_Condition()
{
if((MIS_Canthars_KomproBrief == LOG_Running) && (MIS_Canthars_KomproBrief_Day <= (Wld_GetDay() - 2)) && (Andre_CantharFalle == FALSE) && !Npc_IsDead(Canthar))
{
return TRUE;
};
if((Pablo_AndreMelden == TRUE) && !Npc_IsDead(Pablo) && (Andre_Steckbrief == FALSE))
{
return TRUE;
};
};
func void DIA_Andre_CantharFalle_Info()
{
if(Andre_Steckbrief == FALSE)
{
B_Andre_Steckbrief();
};
if((Andre_CantharFalle == FALSE) && (MIS_Canthars_KomproBrief == LOG_Running) && (MIS_Canthars_KomproBrief_Day <= (Wld_GetDay() - 2)))
{
B_Andre_CantharFalle();
};
};
var int Andre_LastPetzCounter;
var int Andre_LastPetzCrime;
instance DIA_Andre_PMSchulden(C_Info)
{
npc = MIL_311_Andre;
nr = 1;
condition = DIA_Andre_PMSchulden_Condition;
information = DIA_Andre_PMSchulden_Info;
permanent = TRUE;
important = TRUE;
};
func int DIA_Andre_PMSchulden_Condition()
{
if(Npc_IsInState(self,ZS_Talk) && (Andre_Schulden > 0) && (B_GetGreatestPetzCrime(self) <= Andre_LastPetzCrime))
{
return TRUE;
};
};
func void DIA_Andre_PMSchulden_Info()
{
var int diff;
B_PlayerEnteredCity();
AI_Output(self,other,"DIA_Andre_PMSchulden_08_00"); //Ты пришел заплатить штраф?
if((Pablo_AndreMelden == TRUE) && !Npc_IsDead(Pablo) && (Andre_Steckbrief == FALSE))
{
B_Andre_Steckbrief();
};
if((MIS_Canthars_KomproBrief == LOG_Running) && (MIS_Canthars_KomproBrief_Day <= (Wld_GetDay() - 2)) && (Andre_CantharFalle == FALSE))
{
B_Andre_CantharFalle();
};
if(B_GetTotalPetzCounter(self) > Andre_LastPetzCounter)
{
AI_Output(self,other,"DIA_Andre_PMSchulden_08_01"); //Я даже задавался вопросом, осмелишься ли ты появиться здесь?!
AI_Output(self,other,"DIA_Andre_PMSchulden_08_02"); //Обвинения против тебя только множатся!
if(Andre_Schulden < 1000)
{
AI_Output(self,other,"DIA_Andre_PMSchulden_08_03"); //Я предупреждал тебя! Теперь штраф, который тебе придется заплатить, только увеличился!
AI_Output(other,self,"DIA_Andre_PMAdd_15_00"); //Сколько?
diff = B_GetTotalPetzCounter(self) - Andre_LastPetzCounter;
if(diff > 0)
{
Andre_Schulden += diff * 50;
};
if(Andre_Schulden > 1000)
{
Andre_Schulden = 1000;
};
B_Say_Gold(self,other,Andre_Schulden);
}
else
{
AI_Output(self,other,"DIA_Andre_PMSchulden_08_04"); //Ты глубоко разочаровал меня!
};
}
else if(B_GetGreatestPetzCrime(self) < Andre_LastPetzCrime)
{
AI_Output(self,other,"DIA_Andre_PMSchulden_08_05"); //Выяснились новые подробности.
if(Andre_LastPetzCrime == CRIME_MURDER)
{
AI_Output(self,other,"DIA_Andre_PMSchulden_08_06"); //Неожиданно не осталось никого, кто бы мог обвинить тебя в убийстве.
};
if((Andre_LastPetzCrime == CRIME_THEFT) || ((Andre_LastPetzCrime > CRIME_THEFT) && (B_GetGreatestPetzCrime(self) < CRIME_THEFT)))
{
AI_Output(self,other,"DIA_Andre_PMSchulden_08_07"); //Никто больше не помнит, чтобы ты что-то крал.
};
if((Andre_LastPetzCrime == CRIME_ATTACK) || ((Andre_LastPetzCrime > CRIME_ATTACK) && (B_GetGreatestPetzCrime(self) < CRIME_ATTACK)))
{
AI_Output(self,other,"DIA_Andre_PMSchulden_08_08"); //Больше нет свидетелей того, как ты принимал участие в драке.
};
if(B_GetGreatestPetzCrime(self) == CRIME_NONE)
{
AI_Output(self,other,"DIA_Andre_PMSchulden_08_09"); //Похоже, что все обвинения против тебя оказались несостоятельными.
};
AI_Output(self,other,"DIA_Andre_PMSchulden_08_10"); //Я не знаю, что произошло, но я предупреждаю тебя: не пытайся провести меня!
if(B_GetGreatestPetzCrime(self) == CRIME_NONE)
{
AI_Output(self,other,"DIA_Andre_PMSchulden_08_11"); //Как бы то ни было, я решил снять с тебя все обвинения.
AI_Output(self,other,"DIA_Andre_PMSchulden_08_12"); //Смотри, чтобы больше не было никаких проблем!
Andre_Schulden = 0;
Andre_LastPetzCounter = 0;
Andre_LastPetzCrime = CRIME_NONE;
}
else
{
AI_Output(self,other,"DIA_Andre_PMSchulden_08_13"); //Я хочу, чтобы тебе было понятно: тебе все равно придется заплатить полную сумму штрафа.
B_Say_Gold(self,other,Andre_Schulden);
AI_Output(self,other,"DIA_Andre_PMSchulden_08_14"); //Что скажешь?
};
};
if(B_GetGreatestPetzCrime(self) != CRIME_NONE)
{
Info_ClearChoices(DIA_Andre_PMSchulden);
Info_ClearChoices(DIA_Andre_PETZMASTER);
Info_AddChoice(DIA_Andre_PMSchulden,"У меня недостаточно золота.",DIA_Andre_PETZMASTER_PayLater);
Info_AddChoice(DIA_Andre_PMSchulden,"Сколько там еще?",DIA_Andre_PMSchulden_HowMuchAgain);
if(Npc_HasItems(other,ItMi_Gold) >= Andre_Schulden)
{
Info_AddChoice(DIA_Andre_PMSchulden,"Я хочу заплатить штраф!",DIA_Andre_PETZMASTER_PayNow);
};
};
};
func void DIA_Andre_PMSchulden_HowMuchAgain()
{
AI_Output(other,self,"DIA_Andre_PMSchulden_HowMuchAgain_15_00"); //Сколько там еще?
B_Say_Gold(self,other,Andre_Schulden);
Info_ClearChoices(DIA_Andre_PMSchulden);
Info_ClearChoices(DIA_Andre_PETZMASTER);
Info_AddChoice(DIA_Andre_PMSchulden,"У меня недостаточно золота.",DIA_Andre_PETZMASTER_PayLater);
Info_AddChoice(DIA_Andre_PMSchulden,"Сколько там нужно?",DIA_Andre_PMSchulden_HowMuchAgain);
if(Npc_HasItems(other,ItMi_Gold) >= Andre_Schulden)
{
Info_AddChoice(DIA_Andre_PMSchulden,"Я хочу заплатить штраф!",DIA_Andre_PETZMASTER_PayNow);
};
};
instance DIA_Andre_PETZMASTER(C_Info)
{
npc = MIL_311_Andre;
nr = 1;
condition = DIA_Andre_PETZMASTER_Condition;
information = DIA_Andre_PETZMASTER_Info;
permanent = TRUE;
important = TRUE;
};
func int DIA_Andre_PETZMASTER_Condition()
{
if(B_GetGreatestPetzCrime(self) > Andre_LastPetzCrime)
{
return TRUE;
};
};
func void DIA_Andre_PETZMASTER_Info()
{
Andre_Schulden = 0;
B_PlayerEnteredCity();
if(self.aivar[AIV_TalkedToPlayer] == FALSE)
{
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_00"); //Ты тот новичок, что баламутит город.
};
if((Pablo_AndreMelden == TRUE) && !Npc_IsDead(Pablo) && (Andre_Steckbrief == FALSE))
{
B_Andre_Steckbrief();
};
if((MIS_Canthars_KomproBrief == LOG_Running) && (MIS_Canthars_KomproBrief_Day <= (Wld_GetDay() - 2)) && (Andre_CantharFalle == FALSE))
{
B_Andre_CantharFalle();
};
if(B_GetGreatestPetzCrime(self) == CRIME_MURDER)
{
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_01"); //Хорошо, что ты пришел ко мне пока все еще можно уладить.
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_02"); //Убийство - серьезное преступление!
Andre_Schulden = B_GetTotalPetzCounter(self) * 50 + 500;
if((PETZCOUNTER_City_Theft + PETZCOUNTER_City_Attack + PETZCOUNTER_City_Sheepkiller) > 0)
{
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_03"); //Не говоря уже о других делах, что ты натворил.
};
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_04"); //Страже приказано казнить убийц на месте.
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_05"); //И большинство горожан не потерпят убийц в городе!
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_06"); //Но я не заинтересован в том, чтобы повесить тебя. Идет война, и нам нужен каждый солдат.
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_07"); //Но будет не так-то просто успокоить народ.
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_08"); //Ты мог бы подтвердить свое раскаяние, заплатив штраф - естественно, он должен быть довольно значительным.
};
if(B_GetGreatestPetzCrime(self) == CRIME_THEFT)
{
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_09"); //Хорошо, что ты пришел! Тебя обвиняют в воровстве! Есть свидетели!
if((PETZCOUNTER_City_Attack + PETZCOUNTER_City_Sheepkiller) > 0)
{
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_10"); //Не говоря уже о других твоих прегрешениях, о которых я слышал.
};
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_11"); //Я не потерплю такого поведения в моем городе!
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_12"); //Ты должен заплатить штраф, чтобы искупить свою вину.
Andre_Schulden = B_GetTotalPetzCounter(self) * 50;
};
if(B_GetGreatestPetzCrime(self) == CRIME_ATTACK)
{
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_13"); //Если ты дерешься со всяким сбродом в гавани - это одно...
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_14"); //Но когда ты нападаешь на граждан или королевских солдат, я должен принять меры.
if(PETZCOUNTER_City_Sheepkiller > 0)
{
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_15"); //А эту овцу было обязательно убивать?
};
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_16"); //Если я просто так отпущу тебя, скоро все будут делать то, что хотят.
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_17"); //Так что тебе придется заплатить соответствующий штраф - и твои прегрешения будут забыты.
Andre_Schulden = B_GetTotalPetzCounter(self) * 50;
};
if(B_GetGreatestPetzCrime(self) == CRIME_SHEEPKILLER)
{
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_18"); //Я слышал, что ты зарезал овцу.
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_19"); //Ты же понимаешь, что я не могу оставить это дело просто так.
AI_Output(self,other,"DIA_Andre_PETZMASTER_08_20"); //Тебе придется заплатить компенсацию!
Andre_Schulden = 100;
};
AI_Output(other,self,"DIA_Andre_PETZMASTER_15_21"); //Сколько?
if(Andre_Schulden > 1000)
{
Andre_Schulden = 1000;
};
B_Say_Gold(self,other,Andre_Schulden);
Info_ClearChoices(DIA_Andre_PMSchulden);
Info_ClearChoices(DIA_Andre_PETZMASTER);
Info_AddChoice(DIA_Andre_PETZMASTER,"У меня недостаточно золота.",DIA_Andre_PETZMASTER_PayLater);
if(Npc_HasItems(other,ItMi_Gold) >= Andre_Schulden)
{
Info_AddChoice(DIA_Andre_PETZMASTER,"Я хочу заплатить штраф!",DIA_Andre_PETZMASTER_PayNow);
};
};
func void DIA_Andre_PETZMASTER_PayNow()
{
AI_Output(other,self,"DIA_Andre_PETZMASTER_PayNow_15_00"); //Я хочу заплатить штраф!
B_GiveInvItems(other,self,ItMi_Gold,Andre_Schulden);
AI_Output(self,other,"DIA_Andre_PETZMASTER_PayNow_08_01"); //Хорошо! Я позабочусь, чтобы все в городе узнали об этом - это хоть как-то восстановит твою репутацию.
B_GrantAbsolution(LOC_CITY);
Andre_Schulden = 0;
Andre_LastPetzCounter = 0;
Andre_LastPetzCrime = CRIME_NONE;
Info_ClearChoices(DIA_Andre_PETZMASTER);
Info_ClearChoices(DIA_Andre_PMSchulden);
};
func void DIA_Andre_PETZMASTER_PayLater()
{
AI_Output(other,self,"DIA_Andre_PETZMASTER_PayLater_15_00"); //У меня недостаточно золота.
AI_Output(self,other,"DIA_Andre_PETZMASTER_PayLater_08_01"); //Тогда постарайся собрать необходимую сумму как можно быстрее.
AI_Output(self,other,"DIA_Andre_PETZMASTER_PayLater_08_02"); //Но должен предупредить тебя: если ты при этом усугубишь свою вину, то твой штраф только возрастет.
Andre_LastPetzCounter = B_GetTotalPetzCounter(self);
Andre_LastPetzCrime = B_GetGreatestPetzCrime(self);
AI_StopProcessInfos(self);
};
instance DIA_Andre_Hallo(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_Hallo_Condition;
information = DIA_Andre_Hallo_Info;
permanent = FALSE;
important = TRUE;
};
func int DIA_Andre_Hallo_Condition()
{
if(Npc_IsInState(self,ZS_Talk) && (self.aivar[AIV_TalkedToPlayer] == FALSE))
{
return TRUE;
};
};
func void DIA_Andre_Hallo_Info()
{
AI_Output(self,other,"DIA_Andre_Hallo_08_00"); //Да пребудет с тобой Иннос, чужеземец! Что привело тебя ко мне?
B_PlayerEnteredCity();
};
func void B_Andre_GotoLordHagen()
{
AI_Output(self,other,"DIA_Andre_Add_08_11"); //Тебе лучше отправиться прямо к нему.
};
func void B_Andre_LordHagenNichtZuSprechen()
{
AI_Output(self,other,"B_Andre_LordHagenNichtZuSprechen_08_00"); //Лорд Хаген принимает только паладинов и тех, кто служит паладинам.
AI_Output(self,other,"B_Andre_LordHagenNichtZuSprechen_08_01"); //Он считает ниже своего достоинства тратить время на простых людей.
Andre_LordHagenNichtZuSprechen = TRUE;
};
instance DIA_Andre_Message(C_Info)
{
npc = MIL_311_Andre;
nr = 1;
condition = DIA_Andre_Message_Condition;
information = DIA_Andre_Message_Info;
permanent = FALSE;
description = "У меня есть важное сообщение для лорда Хагена.";
};
func int DIA_Andre_Message_Condition()
{
if(LordHagen.aivar[AIV_TalkedToPlayer] == FALSE)
{
return TRUE;
};
};
func void DIA_Andre_Message_Info()
{
AI_Output(other,self,"DIA_Andre_Message_15_00"); //У меня есть важное сообщение для лорда Хагена.
AI_Output(self,other,"DIA_Andre_Message_08_01"); //Ну, ты стоишь перед его представителем. Так что там такое?
Info_ClearChoices(DIA_Andre_Message);
Info_AddChoice(DIA_Andre_Message,"Это я могу сказать только лорду Хагену.",DIA_Andre_Message_Personal);
Info_AddChoice(DIA_Andre_Message,"Армия орков, возглавляемая драконами, готовится к атаке!",DIA_Andre_Message_Dragons);
Info_AddChoice(DIA_Andre_Message,"Это насчет священного артефакта - Глаза Инноса.",DIA_Andre_Message_EyeInnos);
};
func void DIA_Andre_Message_EyeInnos()
{
AI_Output(other,self,"DIA_Andre_Message_EyeInnos_15_00"); //Это насчет священного артефакта - Глаза Инноса.
AI_Output(self,other,"DIA_Andre_Message_EyeInnos_08_01"); //Глаз Инноса - никогда не слышал о таком. Но это еще ничего не значит.
AI_Output(self,other,"DIA_Andre_Message_EyeInnos_08_02"); //Если действительно существует артефакт, носящий Его имя, только самые высокопоставленные члены нашего ордена могут знать о нем.
AI_Output(other,self,"DIA_Andre_Message_EyeInnos_15_03"); //Вот почему мне нужно поговорить именно с лордом Хагеном.
Andre_EyeInnos = TRUE;
if((other.guild != GIL_KDF) && (other.guild != GIL_PAL) && (other.guild != GIL_MIL))
{
B_Andre_LordHagenNichtZuSprechen();
}
else
{
B_Andre_GotoLordHagen();
};
Info_ClearChoices(DIA_Andre_Message);
};
func void DIA_Andre_Message_Dragons()
{
AI_Output(other,self,"DIA_Andre_Message_Dragons_15_00"); //Армия орков, возглавляемая дра...
AI_Output(self,other,"DIA_Andre_Message_Dragons_08_01"); //(прерывает) Я ЗНАЮ, что армия орков становится все сильнее.
AI_Output(self,other,"DIA_Andre_Message_Dragons_08_02"); //Ты же не хочешь мне сказать, что ты только ЭТО хочешь доложить лорду Хагену.
if((other.guild != GIL_KDF) && (other.guild != GIL_PAL))
{
AI_Output(self,other,"DIA_Andre_Message_Dragons_08_03"); //Он оторвет тебе голову, если ты будешь попусту тратить его время, отвлекая его такими историями.
AI_Output(self,other,"DIA_Andre_Message_Dragons_08_04"); //Я уверен, что ты достаточно умен и понимаешь это сам.
};
AI_Output(self,other,"DIA_Andre_Message_Dragons_08_05"); //Так все-таки, зачем тебе нужно увидеть его?
Player_TalkedAboutDragonsToSomeone = TRUE;
};
func void DIA_Andre_Message_Personal()
{
AI_Output(other,self,"DIA_Andre_Message_Personal_15_00"); //Это я могу сказать только лорду Хагену.
if((other.guild != GIL_KDF) && (other.guild != GIL_PAL) && (other.guild != GIL_MIL))
{
AI_Output(self,other,"DIA_Andre_Message_Personal_08_01"); //Как знаешь. Но ты должен понять одно:
B_Andre_LordHagenNichtZuSprechen();
}
else
{
B_Andre_GotoLordHagen();
};
Info_ClearChoices(DIA_Andre_Message);
};
instance DIA_Andre_Paladine(C_Info)
{
npc = MIL_311_Andre;
nr = 3;
condition = DIA_Andre_Paladine_Condition;
information = DIA_Andre_Paladine_Info;
permanent = FALSE;
description = "Почему паладины прибыли в город?";
};
func int DIA_Andre_Paladine_Condition()
{
if((other.guild != GIL_MIL) && (Kapitel < 3))
{
return TRUE;
};
};
func void DIA_Andre_Paladine_Info()
{
AI_Output(other,self,"DIA_Andre_Paladine_15_00"); //Почему паладины прибыли в город?
AI_Output(self,other,"DIA_Andre_Paladine_08_01"); //Цели нашей операции являются тайной.
if(other.guild != GIL_SLD)
{
AI_Output(self,other,"DIA_Andre_Paladine_08_02"); //Я могу сказать тебе только, что гражданам города не грозит никакая опасность.
AI_Output(self,other,"DIA_Andre_Paladine_08_03"); //Тебе не о чем волноваться.
};
};
func void B_Andre_PaladinsReason()
{
AI_Output(self,other,"DIA_Andre_PaladineAgain_08_04"); //Мы прибыли по поручению короля Робара. С разрушением Барьера поставки руды прекратились.
AI_Output(self,other,"DIA_Andre_PaladineAgain_08_05"); //Поэтому теперь мы добываем руду и доставляем ее на материк. При помощи этой руды мы выкуем новое оружие и победим орков.
KnowsPaladins_Ore = TRUE;
};
instance DIA_Andre_PaladineAgain(C_Info)
{
npc = MIL_311_Andre;
nr = 3;
condition = DIA_Andre_PaladineAgain_Condition;
information = DIA_Andre_PaladineAgain_Info;
permanent = FALSE;
description = "Так ты скажешь мне, зачем паладины прибыли в Хоринис?";
};
func int DIA_Andre_PaladineAgain_Condition()
{
if((other.guild == GIL_MIL) && (Kapitel < 3) && Npc_KnowsInfo(other,DIA_Andre_Paladine))
{
return TRUE;
};
};
func void DIA_Andre_PaladineAgain_Info()
{
AI_Output(other,self,"DIA_Andre_PaladineAgain_15_00"); //Так ты скажешь мне, зачем паладины прибыли в Хоринис?
AI_Output(self,other,"DIA_Andre_PaladineAgain_08_02"); //Теперь, когда ты вступил в городскую стражу, ты подчиняешься паладинам.
AI_Output(self,other,"DIA_Andre_PaladineAgain_08_03"); //И теперь я могу доверять тебе.
B_Andre_PaladinsReason();
};
instance DIA_Andre_PaladineAgain2(C_Info)
{
npc = MIL_311_Andre;
nr = 3;
condition = DIA_Andre_PaladineAgain2_Condition;
information = DIA_Andre_PaladineAgain2_Info;
permanent = FALSE;
description = "Что паладины делают в городе?";
};
func int DIA_Andre_PaladineAgain2_Condition()
{
if((other.guild == GIL_MIL) && (Kapitel < 3) && !Npc_KnowsInfo(other,DIA_Andre_Paladine))
{
return TRUE;
};
};
func void DIA_Andre_PaladineAgain2_Info()
{
AI_Output(other,self,"DIA_Andre_PaladineAgain_15_01"); //Что паладины делают в городе?
B_Andre_PaladinsReason();
};
instance DIA_Andre_AskToJoin(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_AskToJoin_Condition;
information = DIA_Andre_AskToJoin_Info;
permanent = FALSE;
description = "Я хочу поступить на службу к паладинам!";
};
func int DIA_Andre_AskToJoin_Condition()
{
if(hero.guild == GIL_NONE)
{
return TRUE;
};
};
func void DIA_Andre_AskToJoin_Info()
{
AI_Output(other,self,"DIA_Andre_AskToJoin_15_00"); //Я хочу поступить на службу к паладинам!
if(Npc_KnowsInfo(other,DIA_Andre_Message))
{
AI_Output(self,other,"DIA_Andre_AskToJoin_08_01"); //Хорошо. Нам нужны люди. И меня не интересует, почему ты решил присоединиться к нам.
AI_Output(self,other,"DIA_Andre_AskToJoin_08_02"); //Если ты поступишь на службу к паладинам, я помогу тебе добиться аудиенции у лорда Хагена.
}
else
{
AI_Output(self,other,"DIA_Andre_AskToJoin_08_03"); //Достойное решение.
};
AI_Output(self,other,"DIA_Andre_AskToJoin_08_04"); //Однако у меня есть приказ принимать в ополчение только граждан этого города.
AI_Output(self,other,"DIA_Andre_AskToJoin_08_05"); //Мой командующий опасается, что в наши ряды могут проникнуть шпионы или диверсанты.
AI_Output(self,other,"DIA_Andre_AskToJoin_08_06"); //Он хочет таким образом свести риск к минимуму.
AI_Output(self,other,"DIA_Andre_AskToJoin_08_07"); //Поэтому ты сначала должен стать гражданином города. Не знаю, имеет это правило смысл или нет, но приказ есть приказ.
Log_CreateTopic(TOPIC_BecomeMIL,LOG_MISSION);
Log_SetTopicStatus(TOPIC_BecomeMIL,LOG_Running);
B_LogEntry(TOPIC_BecomeMIL,"Прежде чем я смогу вступить в ряды городской стражи, я должен стать гражданином города.");
};
instance DIA_Andre_AboutMiliz(C_Info)
{
npc = MIL_311_Andre;
nr = 5;
condition = DIA_Andre_AboutMiliz_Condition;
information = DIA_Andre_AboutMiliz_Info;
permanent = FALSE;
description = "Что я получу от вступления в ополчение?";
};
func int DIA_Andre_AboutMiliz_Condition()
{
if((other.guild == GIL_NONE) && Npc_KnowsInfo(other,DIA_Andre_AskToJoin))
{
return TRUE;
};
};
func void DIA_Andre_AboutMiliz_Info()
{
AI_Output(other,self,"DIA_Andre_AboutMiliz_15_00"); //Что я получу от вступления в ополчение?
AI_Output(self,other,"DIA_Andre_AboutMiliz_08_01"); //Позволь мне прояснить один момент. Обязанности солдата ополчения не ограничиваются расхаживанием по городу в униформе.
AI_Output(self,other,"DIA_Andre_AboutMiliz_08_02"); //Это грязная и даже кровавая работа. Когда ты станешь одним из нас, тебя будет ждать целая гора работы.
AI_Output(self,other,"DIA_Andre_AboutMiliz_08_03"); //Но это того стоит. Помимо жалования, у тебя появляется шанс однажды стать священным воином Инноса.
};
instance DIA_Addon_Andre_MartinEmpfehlung(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Addon_Andre_MartinEmpfehlung_Condition;
information = DIA_Addon_Andre_MartinEmpfehlung_Info;
description = "Я принес рекомендательное письмо от вашего интенданта.";
};
func int DIA_Addon_Andre_MartinEmpfehlung_Condition()
{
if(Npc_HasItems(other,ItWr_Martin_MilizEmpfehlung_Addon) && Npc_KnowsInfo(other,DIA_Andre_AskToJoin))
{
return TRUE;
};
};
func void DIA_Addon_Andre_MartinEmpfehlung_Info()
{
AI_Output(other,self,"DIA_Addon_Andre_MartinEmpfehlung_15_00"); //Я принес рекомендательное письмо от вашего интенданта.
AI_Output(self,other,"DIA_Addon_Andre_MartinEmpfehlung_08_01"); //(недоверчиво) Что? А ну-ка, покажи.
B_GiveInvItems(other,self,ItWr_Martin_MilizEmpfehlung_Addon,1);
B_UseFakeScroll();
AI_Output(self,other,"DIA_Addon_Andre_MartinEmpfehlung_08_02"); //(удивленно) Ну надо же! Тебе, должно быть, пришлось потрудиться! Не так-то просто получить нечто подобное от Мартина.
if(hero.guild == GIL_NONE)
{
AI_Output(self,other,"DIA_Addon_Andre_MartinEmpfehlung_08_03"); //Ладно, я убежден. Если Мартин за тебя ручается, я согласен тебя принять. Скажи мне, когда ты будешь готов.
}
else
{
B_GivePlayerXP(50);
};
Andre_Knows_MartinEmpfehlung = TRUE;
};
instance DIA_Andre_Alternative(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_Alternative_Condition;
information = DIA_Andre_Alternative_Info;
permanent = FALSE;
description = "А нет более быстрого способа присоединиться к вам?";
};
func int DIA_Andre_Alternative_Condition()
{
if(Npc_KnowsInfo(other,DIA_Andre_AskToJoin) && (other.guild == GIL_NONE))
{
return TRUE;
};
};
func void DIA_Andre_Alternative_Info()
{
AI_Output(other,self,"DIA_Andre_Alternative_15_00"); //А нет более быстрого способа присоединиться к вам?
AI_Output(self,other,"DIA_Andre_Alternative_08_01"); //М-м-м. (задумывается) У тебя действительно серьезные намерения, да?
AI_Output(self,other,"DIA_Andre_Alternative_08_02"); //Хорошо. Слушай. У меня есть проблема. Если ты решишь ее для меня, я обещаю, что ты будешь зачислен в ополчение.
AI_Output(self,other,"DIA_Andre_Alternative_08_03"); //И самое главное: никому ни слова!
};
instance DIA_Andre_GuildOfThieves(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_GuildOfThieves_Condition;
information = DIA_Andre_GuildOfThieves_Info;
permanent = FALSE;
description = "Что у тебя за проблема?";
};
func int DIA_Andre_GuildOfThieves_Condition()
{
if(Npc_KnowsInfo(other,DIA_Andre_Alternative))
{
return TRUE;
};
if((other.guild == GIL_PAL) && (MIS_Andre_GuildOfThieves == FALSE))
{
return TRUE;
};
};
func void DIA_Andre_GuildOfThieves_Info()
{
AI_Output(other,self,"DIA_Andre_GuildOfThieves_15_00"); //Что у тебя за проблема?
AI_Output(self,other,"DIA_Andre_GuildOfThieves_08_01"); //Последнее время в городе развелось слишком много воров. И мы никак не можем поймать ни одного из них. Воры действуют очень осторожно.
AI_Output(self,other,"DIA_Andre_GuildOfThieves_08_02"); //Эти мерзавцы знают свое дело. Я уверен, что в городе действует организованная банда.
AI_Output(self,other,"DIA_Andre_GuildOfThieves_08_03"); //Я не удивлюсь, если в Хоринисе появилась гильдия воров. Найди главарей этой банды и ликвидируй их.
MIS_Andre_GuildOfThieves = LOG_Running;
if(other.guild == GIL_NONE)
{
AI_Output(self,other,"DIA_Andre_GuildOfThieves_08_04"); //Тогда я смогу гарантировать, что ты будешь принят в ополчение - неважно, гражданин ты или нет.
AI_Output(self,other,"DIA_Andre_GuildOfThieves_08_05"); //Но ты никому не должен говорить о нашем соглашении!
B_LogEntry(TOPIC_BecomeMIL,"Есть также другой способ вступить в ряды городской стражи - найти и уничтожить гильдию воров Хориниса.");
};
};
instance DIA_Andre_WhereThieves(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_WhereThieves_Condition;
information = DIA_Andre_WhereThieves_Info;
permanent = FALSE;
description = "Где мне лучше начать искать этих воров?";
};
func int DIA_Andre_WhereThieves_Condition()
{
if(MIS_Andre_GuildOfThieves == LOG_Running)
{
return TRUE;
};
};
func void DIA_Andre_WhereThieves_Info()
{
AI_Output(other,self,"DIA_Andre_WhereThieves_15_00"); //Где мне лучше начать искать этих воров?
AI_Output(self,other,"DIA_Andre_WhereThieves_08_01"); //Если бы я знал это, я бы сделал это сам!
AI_Output(self,other,"DIA_Andre_WhereThieves_08_02"); //Могу сказать одно: мы недавно перевернули вверх дном весь портовый квартал и ничего не нашли. Абсолютно ничего.
AI_Output(self,other,"DIA_Andre_WhereThieves_08_03"); //Люди, живущие там, не склонны к сотрудничеству, особенно, если на тебе доспехи паладина.
AI_Output(self,other,"DIA_Andre_WhereThieves_08_04"); //Но ты нездешний. Возможно, тебе они будут больше доверять.
AI_Output(self,other,"DIA_Andre_WhereThieves_08_05"); //Ты можешь поспрашивать в портовом квартале. Но будь осторожен. Если люди поймут, что ты работаешь на паладинов, ты не узнаешь НИЧЕГО!
if(other.guild == GIL_NONE)
{
B_LogEntry(TOPIC_BecomeMIL,"Если я хочу найти гильдию воров, мне лучше начать прислушиваться к тому, что говорят в портовом квартале.");
};
};
instance DIA_Andre_WhatToDo(C_Info)
{
npc = MIL_311_Andre;
nr = 3;
condition = DIA_Andre_WhatToDo_Condition;
information = DIA_Andre_WhatToDo_Info;
permanent = FALSE;
description = "Что мне делать, когда я найду этих воров?";
};
func int DIA_Andre_WhatToDo_Condition()
{
if(MIS_Andre_GuildOfThieves == LOG_Running)
{
return TRUE;
};
};
func void DIA_Andre_WhatToDo_Info()
{
AI_Output(other,self,"DIA_Andre_WhatToDo_15_00"); //Что мне делать, когда я найду этих воров?
AI_Output(self,other,"DIA_Andre_WhatToDo_08_01"); //Если дело касается мелкой рыбешки - рядового вора или наводчика, лучше всего избежать схватки.
AI_Output(self,other,"DIA_Andre_WhatToDo_08_02"); //Просто приди ко мне и доложи. А я позабочусь, чтобы эта мразь оказалась за решеткой.
if(other.guild == GIL_NONE)
{
AI_Output(self,other,"DIA_Andre_WhatToDo_08_03"); //Городская стража может вмешаться в драку и у тебя не будет возможности объяснить им, что происходит.
B_LogEntry(TOPIC_BecomeMIL,"Если я поймаю какую-нибудь мелкую рыбешку гильдии воров, я должен привести его прямо к лорду Андрэ. А чтобы ликвидировать гильдию воров, я должен найти их логово.");
};
AI_Output(self,other,"DIA_Andre_WhatToDo_08_04"); //Кроме того, за каждого преступника, который с твоей помощью будет засажен за решетку, тебе полагается награда.
AI_Output(self,other,"DIA_Andre_WhatToDo_08_05"); //Однако, если ты найдешь логово главарей - ну, тогда тебе, вероятно, не удастся избежать боя.
};
func void B_AndreSold()
{
if(other.guild == GIL_MIL)
{
AI_Output(self,other,"DIA_Andre_Sold_08_00"); //Вот твое жалование.
}
else
{
AI_Output(self,other,"DIA_Andre_Auslieferung_Nagur_08_02"); //Вот, получи награду. Ты ее заслужил.
};
AI_WaitTillEnd(other,self);
B_GiveInvItems(self,other,ItMi_Gold,Andre_Sold);
};
instance DIA_Andre_Auslieferung(C_Info)
{
npc = MIL_311_Andre;
nr = 200;
condition = DIA_Andre_Auslieferung_Condition;
information = DIA_Andre_Auslieferung_Info;
permanent = TRUE;
description = "Я пришел получить награду за преступника.";
};
func int DIA_Andre_Auslieferung_Condition()
{
if((Rengaru_Ausgeliefert == FALSE) || (Halvor_Ausgeliefert == FALSE) || (Nagur_Ausgeliefert == FALSE) || (MIS_Canthars_KomproBrief == LOG_Running) || (Fernando_Ausgeliefert == FALSE))
{
return TRUE;
};
};
func void DIA_Andre_Auslieferung_Info()
{
AI_Output(other,self,"DIA_Andre_Auslieferung_15_00"); //Я пришел получить награду за преступника.
Info_ClearChoices(DIA_Andre_Auslieferung);
Info_AddChoice(DIA_Andre_Auslieferung,"Я вернусь позже...",DIA_Andre_Auslieferung_Back);
if((Rengaru_InKnast == TRUE) && (Rengaru_Ausgeliefert == FALSE))
{
Info_AddChoice(DIA_Andre_Auslieferung,"Ренгару украл у торговца Джоры.",DIA_Andre_Auslieferung_Rengaru);
};
if((Betrayal_Halvor == TRUE) && (Halvor_Ausgeliefert == FALSE))
{
Info_AddChoice(DIA_Andre_Auslieferung,"Халвор торгует краденым.",DIA_Andre_Auslieferung_Halvor);
};
if(((MIS_Nagur_Bote == LOG_Running) || (MIS_Nagur_Bote == LOG_FAILED)) && (Nagur_Ausgeliefert == FALSE))
{
if(Bote_Killed == TRUE)
{
Info_AddChoice(DIA_Andre_Auslieferung,"Нагур убил посыльного Бальтрама.",DIA_Andre_Auslieferung_Nagur);
}
else
{
Info_AddChoice(DIA_Andre_Auslieferung,"Нагур пытался украсть товар с фермы Акила.",DIA_Andre_Auslieferung_Nagur);
};
};
if((MIS_Canthars_KomproBrief == LOG_Running) && (MIS_Canthars_KomproBrief_Day > (Wld_GetDay() - 2)))
{
Info_AddChoice(DIA_Andre_Auslieferung,"Торговец Кантар пытается избавиться от Сары!",DIA_Andre_Auslieferung_Canthar);
};
if((MIS_Canthars_KomproBrief == LOG_Running) && Npc_HasItems(Sarah,ItWr_Canthars_KomproBrief_MIS) && (MIS_Canthars_KomproBrief_Day > (Wld_GetDay() - 2)))
{
Info_AddChoice(DIA_Andre_Auslieferung,"Сара продает оружие Онару.",DIA_Andre_Auslieferung_Sarah);
};
if((Fernando_ImKnast == TRUE) && (Fernando_Ausgeliefert == FALSE))
{
Info_AddChoice(DIA_Andre_Auslieferung,"Я знаю торговца, который продает оружие бандитам!",DIA_Andre_Auslieferung_Fernando);
};
};
func void DIA_Andre_Auslieferung_Back()
{
AI_Output(other,self,"DIA_Addon_Logan_EXIT_15_00"); //Я вернусь позже...
Info_ClearChoices(DIA_Andre_Auslieferung);
};
func void DIA_Andre_Auslieferung_Rengaru()
{
AI_Teleport(Rengaru,"NW_CITY_HABOUR_KASERN_RENGARU");
AI_Output(other,self,"DIA_Andre_Auslieferung_Rengaru_15_00"); //Ренгару украл у торговца Джоры. Он пытался скрыться, но я поймал его.
AI_Output(self,other,"DIA_Andre_Auslieferung_Rengaru_08_01"); //Хорошо, мои люди уже схватили его. Больше он не сможет воровать у добропорядочных граждан.
AI_Output(self,other,"DIA_Andre_Auslieferung_Rengaru_08_02"); //Вот твои деньги.
B_GiveInvItems(self,other,ItMi_Gold,Kopfgeld);
B_NpcSetJailed(Rengaru);
B_StartOtherRoutine(Rengaru,"PRISON");
Rengaru_Ausgeliefert = TRUE;
MIS_ThiefGuild_sucked = TRUE;
B_GivePlayerXP(XP_Andre_Auslieferung);
Info_ClearChoices(DIA_Andre_Auslieferung);
};
func void DIA_Andre_Auslieferung_Halvor()
{
AI_Teleport(Halvor,"NW_CITY_HABOUR_KASERN_HALVOR");
AI_Output(other,self,"DIA_Andre_Auslieferung_Halvor_15_00"); //Халвор торгует краденым. Он продает товары, украденные бандитами у торговцев.
if(Npc_HasItems(other,ItWr_HalvorMessage))
{
AI_WaitTillEnd(self,other);
B_GiveInvItems(other,self,ItWr_HalvorMessage,1);
B_UseFakeScroll();
};
AI_Output(self,other,"DIA_Andre_Auslieferung_Halvor_08_01"); //Так вот, кто этим занимается. Мои люди немедленно схватят его.
AI_Output(self,other,"DIA_Andre_Auslieferung_Halvor_08_02"); //Я не думаю, что это будет сложно. Я готов вручить тебе твою награду прямо сейчас.
B_GiveInvItems(self,other,ItMi_Gold,Kopfgeld);
B_NpcSetJailed(Halvor);
B_StartOtherRoutine(Halvor,"PRISON");
MIS_ThiefGuild_sucked = TRUE;
Halvor_Ausgeliefert = TRUE;
B_GivePlayerXP(XP_Andre_Auslieferung);
Info_ClearChoices(DIA_Andre_Auslieferung);
};
func void DIA_Andre_Auslieferung_Nagur()
{
AI_Teleport(Nagur,"NW_CITY_HABOUR_KASERN_NAGUR");
if(Bote_Killed == TRUE)
{
AI_Output(other,self,"DIA_Andre_Auslieferung_Nagur_15_00"); //Нагур убил посыльного Бальтрама. Он пытался использовать меня в качестве нового посыльного, чтобы перехватить товар с фермы Акила.
}
else
{
AI_Output(other,self,"DIA_Andre_Auslieferung_Nagur_15_00_add"); //Нагур пытался использовать меня в качестве подставного посыльного, чтобы украсть товар с фермы Акила.
};
AI_Output(self,other,"DIA_Andre_Auslieferung_Nagur_08_01"); //Он понесет заслуженное наказание. Я немедленно прикажу посадить его за решетку.
AI_Output(self,other,"DIA_Andre_Auslieferung_Nagur_08_02"); //Вот, получи награду. Ты ее заслужил.
B_GiveInvItems(self,other,ItMi_Gold,Kopfgeld);
B_NpcSetJailed(Nagur);
B_StartOtherRoutine(Nagur,"PRISON");
MIS_ThiefGuild_sucked = TRUE;
Nagur_Ausgeliefert = TRUE;
B_GivePlayerXP(XP_Andre_Auslieferung);
Info_ClearChoices(DIA_Andre_Auslieferung);
};
func void DIA_Andre_Auslieferung_Canthar()
{
AI_Teleport(Canthar,"NW_CITY_HABOUR_KASERN_RENGARU");
AI_Output(other,self,"DIA_Andre_Auslieferung_Canthar_15_00"); //Торговец Кантар пытается избавиться от Сары!
AI_Output(self,other,"DIA_Andre_Auslieferung_Canthar_08_01"); //Сары? Торговки оружием с рыночной площади?
AI_Output(other,self,"DIA_Andre_Auslieferung_Canthar_15_02"); //Я должен был подсунуть Саре письмо, которое подтвердило бы, что она поставляет оружие Онару.
if(Npc_HasItems(other,ItWr_Canthars_KomproBrief_MIS))
{
B_GiveInvItems(other,self,ItWr_Canthars_KomproBrief_MIS,1);
B_UseFakeScroll();
};
AI_Output(self,other,"DIA_Andre_Auslieferung_Canthar_08_03"); //Понимаю. Я с радостью заплачу награду за этого ублюдка. Можешь считать, что он уже за решеткой.
B_GiveInvItems(self,other,ItMi_Gold,Kopfgeld);
B_NpcSetJailed(Canthar);
B_StartOtherRoutine(Canthar,"KNAST");
MIS_Canthars_KomproBrief = LOG_FAILED;
B_CheckLog();
Canthar_Ausgeliefert = TRUE;
B_GivePlayerXP(XP_Andre_Auslieferung);
Info_ClearChoices(DIA_Andre_Auslieferung);
};
func void DIA_Andre_Auslieferung_Sarah()
{
AI_Teleport(Sarah,"NW_CITY_HABOUR_KASERN_RENGARU");
AI_Teleport(Canthar,"NW_CITY_SARAH");
AI_Output(other,self,"DIA_Andre_Auslieferung_Sarah_15_00"); //Сара продает оружие Онару.
AI_Output(self,other,"DIA_Andre_Auslieferung_Sarah_08_01"); //Сара? Торговка оружием с рыночной площади? У тебя есть доказательство?
AI_Output(other,self,"DIA_Andre_Auslieferung_Sarah_15_02"); //В ее кармане письмо с деталями поставки оружия ему.
AI_Output(self,other,"DIA_Andre_Auslieferung_Sarah_08_03"); //Она поплатится за это. Я прикажу арестовать ее.
AI_Output(self,other,"DIA_Andre_Auslieferung_Nagur_08_02"); //Вот, получи награду. Ты ее заслужил.
B_GiveInvItems(self,other,ItMi_Gold,Kopfgeld);
if(SarahWeaponsRemoved == FALSE)
{
B_GiveTradeInv_Sarah(Sarah);
B_RemoveSarahWeapons();
};
B_NpcSetJailed(Sarah);
B_StartOtherRoutine(Sarah,"KNAST");
B_StartOtherRoutine(Canthar,"MARKTSTAND");
Sarah_Ausgeliefert = TRUE;
MIS_Canthars_KomproBrief = LOG_SUCCESS;
B_GivePlayerXP(XP_Andre_Auslieferung);
Info_ClearChoices(DIA_Andre_Auslieferung);
};
func void DIA_Andre_Auslieferung_Fernando()
{
AI_Output(other,self,"DIA_Addon_Vatras_Waffen_Success_15_00"); //Я знаю торговца, который продает оружие бандитам!
AI_Output(other,self,"DIA_Addon_Vatras_Waffen_Success_15_01"); //Его зовут Фернандо.
AI_Output(self,other,"DIA_Andre_DGRunning_Success_08_01"); //Ты оказал городу большую услугу.
if(other.guild == GIL_MIL)
{
B_AndreSold();
}
else
{
AI_Output(self,other,"DIA_Andre_Auslieferung_Nagur_08_02"); //Вот, получи награду. Ты ее заслужил.
B_GiveInvItems(self,other,ItMi_Gold,Kopfgeld);
};
Fernando_Ausgeliefert = TRUE;
B_GivePlayerXP(XP_Andre_Auslieferung);
Info_ClearChoices(DIA_Andre_Auslieferung);
};
func void B_AndreAskAboutSewer()
{
AI_Output(self,other,"DIA_Andre_DGRunning_Verrat_08_01"); //Где?
AI_Output(other,self,"DIA_Andre_DGRunning_Verrat_15_02"); //В канализации под городом.
AI_Output(self,other,"DIA_Andre_DGRunning_Verrat_08_03"); //Что? Мы запечатали канализацию...
AI_Output(other,self,"DIA_Andre_DGRunning_Verrat_15_04"); //Похоже, это не помешало им проникнуть туда.
};
instance DIA_Andre_DGRunning(C_Info)
{
npc = MIL_311_Andre;
nr = 4;
condition = DIA_Andre_DGRunning_Condition;
information = DIA_Andre_DGRunning_Info;
permanent = TRUE;
description = "Насчет гильдии воров...";
};
func int DIA_Andre_DGRunning_Condition()
{
if(MIS_Andre_GuildOfThieves == LOG_Running)
{
return TRUE;
};
};
func void DIA_Andre_DGRunning_Info()
{
AI_Output(other,self,"DIA_Andre_DGRunning_15_00"); //Насчет гильдии воров...
AI_Output(self,other,"DIA_Andre_DGRunning_08_03"); //Да?
Info_ClearChoices(DIA_Andre_DGRunning);
Info_AddChoice(DIA_Andre_DGRunning,"Я работаю над этим...",DIA_Andre_DGRunning_BACK);
if(Npc_IsDead(Cassia) && Npc_IsDead(Jesper) && Npc_IsDead(Ramirez))
{
Info_AddChoice(DIA_Andre_DGRunning,"Я всех их ликвидировал!",DIA_Andre_DGRunning_Success);
};
if(((Cassia.aivar[AIV_TalkedToPlayer] == TRUE) || (Jesper.aivar[AIV_TalkedToPlayer] == TRUE) || (Ramirez.aivar[AIV_TalkedToPlayer] == TRUE)) && (Andre_FoundThieves_Reported == FALSE))
{
Info_AddChoice(DIA_Andre_DGRunning,"Я нашел логово гильдии воров!",DIA_Andre_DGRunning_Verrat);
};
};
func void DIA_Andre_DGRunning_BACK()
{
AI_Output(other,self,"DIA_Andre_DGRunning_BACK_15_00"); //Я работаю над этим...
if(Andre_FoundThieves_Reported == TRUE)
{
AI_Output(self,other,"DIA_Andre_DGRunning_BACK_08_01"); //Хорошо. Я дам тебе еще немного времени на выполнение этого задания.
}
else
{
AI_Output(self,other,"DIA_Andre_DGRunning_BACK_08_02"); //Хорошо! Держи меня в курсе.
};
Info_ClearChoices(DIA_Andre_DGRunning);
};
func void DIA_Andre_DGRunning_Verrat()
{
AI_Output(other,self,"DIA_Andre_DGRunning_Verrat_15_00"); //Я нашел логово гильдии воров!
B_AndreAskAboutSewer();
AI_Output(self,other,"DIA_Andre_DGRunning_Verrat_08_05"); //Ты ликвидировал этих преступников?
Andre_FoundThieves_Reported_Day = Wld_GetDay();
Andre_FoundThieves_Reported = TRUE;
DG_gefunden = TRUE;
};
func void DIA_Andre_DGRunning_Success()
{
AI_Output(other,self,"DIA_Andre_DGRunning_Success_15_00"); //Я всех их ликвидировал!
if(Andre_FoundThieves_Reported == FALSE)
{
B_AndreAskAboutSewer();
};
AI_Output(self,other,"DIA_Andre_DGRunning_Success_08_01"); //Ты оказал городу большую услугу.
DG_gefunden = TRUE;
MIS_Andre_GuildOfThieves = LOG_SUCCESS;
if(MIS_CassiaRing == LOG_Running)
{
MIS_CassiaRing = LOG_FAILED;
};
if(MIS_CassiaKelche == LOG_Running)
{
MIS_CassiaKelche = LOG_FAILED;
};
if(MIS_RamirezSextant == LOG_Running)
{
MIS_RamirezSextant = LOG_FAILED;
};
B_GivePlayerXP(XP_GuildOfThievesPlatt);
if(other.guild == GIL_NONE)
{
AI_Output(self,other,"DIA_Andre_DGRunning_Success_08_02"); //Если ты все еще хочешь вступить в ополчение, дай мне знать.
}
else if((other.guild == GIL_MIL) || (other.guild == GIL_PAL))
{
AI_Output(self,other,"DIA_Andre_DGRunning_Success_08_03"); //Ты выполнил нашу работу, как настоящий слуга Инноса и солдат короля.
};
AI_Output(self,other,"DIA_Andre_DGRunning_Success_08_04"); //Тебе полагается награда за этих бандитов. Вот, возьми.
B_GiveInvItems(self,other,ItMi_Gold,Kopfgeld * 3);
Info_ClearChoices(DIA_Andre_DGRunning);
};
instance DIA_Andre_FoundThieves_KilledByMilitia(C_Info)
{
npc = MIL_311_Andre;
nr = 9;
condition = DIA_Andre_FoundThieves_KilledByMilitia_Condition;
information = DIA_Andre_FoundThieves_KilledByMilitia_Info;
permanent = FALSE;
important = TRUE;
};
func int DIA_Andre_FoundThieves_KilledByMilitia_Condition()
{
if(Andre_FoundThieves_Reported == TRUE)
{
if(Andre_FoundThieves_Reported_Day <= (Wld_GetDay() - 2))
{
if(!Npc_IsDead(Cassia) || !Npc_IsDead(Jesper) || !Npc_IsDead(Ramirez))
{
return TRUE;
};
};
};
};
func void DIA_Andre_FoundThieves_KilledByMilitia_Info()
{
AI_Output(self,other,"DIA_Andre_DGRunning_08_01"); //Ты можешь забыть об этом деле. Я послал своих людей в канализацию.
AI_Output(self,other,"DIA_Andre_DGRunning_08_02"); //Гильдия воров теперь не более чем перевернутая страница истории этого города.
B_AndreSold();
B_KillThievesGuild();
MIS_Andre_GuildOfThieves = LOG_FAILED;
if(MIS_CassiaRing == LOG_Running)
{
MIS_CassiaRing = LOG_FAILED;
};
if(MIS_CassiaKelche == LOG_Running)
{
MIS_CassiaKelche = LOG_FAILED;
};
if(MIS_RamirezSextant == LOG_Running)
{
MIS_RamirezSextant = LOG_FAILED;
};
B_CheckLog();
};
instance DIA_Andre_JOIN(C_Info)
{
npc = MIL_311_Andre;
nr = 100;
condition = DIA_Andre_JOIN_Condition;
information = DIA_Andre_JOIN_Info;
permanent = TRUE;
description = "Я готов вступить в ополчение!";
};
func int DIA_Andre_JOIN_Condition()
{
if((hero.guild == GIL_NONE) && Npc_KnowsInfo(other,DIA_Andre_AskToJoin))
{
return TRUE;
};
};
func void DIA_Andre_JOIN_Info()
{
AI_Output(other,self,"DIA_Andre_JOIN_15_00"); //Я готов вступить в ополчение!
if(Andre_Knows_MartinEmpfehlung == TRUE)
{
AI_Output(self,other,"DIA_Addon_Andre_JOIN_08_00"); //Интендант Мартин ручается за тебя и даже рекомендует тебя мне. Этого мне достаточно.
}
else if((MIS_Andre_GuildOfThieves == LOG_SUCCESS) && (Player_IsApprentice == APP_NONE))
{
AI_Output(self,other,"DIA_Andre_JOIN_08_01"); //Я сдержу свое слово и приму тебя в ополчение, даже хотя ты и не являешься гражданином этого города.
AI_Output(self,other,"DIA_Andre_JOIN_08_02"); //Но никому об этом не говори! Чем меньше людей будут знать об этом исключении, тем меньше мне придется оправдываться.
}
else if(Player_IsApprentice > APP_NONE)
{
AI_Output(self,other,"DIA_Andre_JOIN_08_03"); //А ты являешься гражданином Хориниса?
if(Player_IsApprentice == APP_Harad)
{
AI_Output(other,self,"DIA_Andre_JOIN_15_04"); //Кузнец взял меня в ученики.
AI_Output(self,other,"DIA_Andre_JOIN_08_05"); //Гарад? Я знаю его. Он работает на нас. Он достойный человек.
};
if(Player_IsApprentice == APP_Constantino)
{
AI_Output(other,self,"DIA_Andre_JOIN_15_06"); //Я ученик алхимика!
AI_Output(self,other,"DIA_Andre_JOIN_08_07"); //У нас, в ополчении, не так уж много ученых мужей. Возможно, твои навыки весьма пригодятся нам.
AI_Output(self,other,"DIA_Andre_JOIN_08_08"); //Я мало что знаю об алхимии. Но люди говорят, что он уважаемый человек.
};
if(Player_IsApprentice == APP_Bosper)
{
AI_Output(other,self,"DIA_Andre_JOIN_15_09"); //Боспер, мастер-лучник, взял меня в ученики.
AI_Output(self,other,"DIA_Andre_JOIN_08_10"); //Тогда ты наверняка знаешь кое-что о том, как выжить в лесу? Это хорошо, потому что ополчению приходится выполнять задачи не только в городе.
AI_Output(self,other,"DIA_Andre_JOIN_08_11"); //Нам, определенно, нужны люди, умеющие ориентироваться в дикой местности.
AI_Output(self,other,"DIA_Andre_JOIN_08_12"); //И Боспер уважаемый человек в этом городе.
};
AI_Output(self,other,"DIA_Andre_JOIN_08_13"); //Если он поручился за тебя, ничто не мешает твоему вступлению в ряды ополчения.
if(MIS_Andre_GuildOfThieves == LOG_SUCCESS)
{
AI_Output(self,other,"DIA_Andre_JOIN_08_14"); //Кроме того, тебе удалось избавить город от гильдии воров. Я бы принял тебя только за этот подвиг.
};
}
else
{
AI_Output(self,other,"DIA_Andre_JOIN_08_15"); //Может быть - но ты все еще не гражданин этого города, а у меня есть приказ.
return;
};
AI_Output(self,other,"DIA_Andre_JOIN_08_16"); //Ты можешь вступить в наши ряды, если хочешь. Но твое решение должно быть окончательным.
AI_Output(self,other,"DIA_Andre_JOIN_08_17"); //После того, как ты наденешь доспех ополчения, ты уже не сможешь просто так снять его и выйти из наших рядов.
AI_Output(self,other,"DIA_Andre_JOIN_08_18"); //Ты готов сражаться вместе с нами за Инноса и короля?
Info_ClearChoices(DIA_Andre_JOIN);
Info_AddChoice(DIA_Andre_JOIN,"Я пока не уверен...",DIA_Andre_JOIN_No);
Info_AddChoice(DIA_Andre_JOIN,"Я готов!",DIA_Andre_JOIN_Yes);
};
func void DIA_Andre_JOIN_Yes()
{
AI_Output(other,self,"DIA_Andre_JOIN_Yes_15_00"); //Я готов!
AI_Output(self,other,"DIA_Andre_JOIN_Yes_08_01"); //Тогда так тому и быть. Добро пожаловать в ряды ополчения.
AI_Output(self,other,"DIA_Andre_JOIN_Yes_08_02"); //Вот твои доспехи.
AI_Output(self,other,"DIA_Andre_JOIN_Yes_08_03"); //Носи их с гордостью и достоинством.
hero.guild = GIL_MIL;
Npc_SetTrueGuild(hero,GIL_MIL);
CreateInvItem(hero,ITAR_MIL_L);
AI_PrintScreen("Легкие доспехи ополчения получено",-1,YPOS_ItemTaken,FONT_ScreenSmall,2);
// AI_EquipArmor(hero,ITAR_MIL_L);
Snd_Play("LEVELUP");
Npc_ExchangeRoutine(Lothar,"START");
SLD_Aufnahme = LOG_OBSOLETE;
KDF_Aufnahme = LOG_OBSOLETE;
MIL_Aufnahme = LOG_SUCCESS;
B_GivePlayerXP(XP_BecomeMiliz);
Info_ClearChoices(DIA_Andre_JOIN);
};
func void DIA_Andre_JOIN_No()
{
AI_Output(other,self,"DIA_Andre_JOIN_No_15_00"); //Я пока не уверен...
AI_Output(self,other,"DIA_Andre_JOIN_No_08_01"); //Если ты еще сомневаешься в своем решении, я не могу принять тебя в ополчение.
Info_ClearChoices(DIA_Andre_JOIN);
};
instance DIA_Andre_LORDHAGEN(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_LORDHAGEN_Condition;
information = DIA_Andre_LORDHAGEN_Info;
permanent = FALSE;
description = "Могу я теперь увидеть лорда Хагена?";
};
func int DIA_Andre_LORDHAGEN_Condition()
{
if((other.guild == GIL_MIL) && (LordHagen.aivar[AIV_TalkedToPlayer] == FALSE) && (Andre_LordHagenNichtZuSprechen == TRUE))
{
return TRUE;
};
};
func void DIA_Andre_LORDHAGEN_Info()
{
AI_Output(other,self,"DIA_Andre_LORDHAGEN_15_00"); //Могу я теперь увидеть лорда Хагена?
AI_Output(self,other,"DIA_Andre_LORDHAGEN_08_01"); //Теперь ты состоишь на службе у паладинов. Они пропустят тебя. Но твое сообщение должно быть действительно важным.
AI_Output(other,self,"DIA_Andre_LORDHAGEN_15_02"); //Не волнуйся, это так и есть...
AI_Output(self,other,"DIA_Andre_LORDHAGEN_08_03"); //Помни, что ты встречаешься с главой паладинов. Веди себя соответствующе. Теперь ты представляешь не только себя, но все ополчение.
};
instance DIA_Andre_Waffe(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_Waffe_Condition;
information = DIA_Andre_Waffe_Info;
permanent = FALSE;
description = "А я получу оружие?";
};
func int DIA_Andre_Waffe_Condition()
{
if((other.guild == GIL_MIL) && (Kapitel < 3))
{
return TRUE;
};
};
func void DIA_Andre_Waffe_Info()
{
AI_Output(other,self,"DIA_Andre_Waffe_15_00"); //А я получу оружие?
AI_Output(self,other,"DIA_Andre_Waffe_08_01"); //Конечно. Обычно этим занимается Пек. Но что-то я давно его не видел.
AI_Output(self,other,"DIA_Andre_Waffe_08_02"); //Найди, где он скрывается, и приведи его сюда. Тогда он выдаст тебе оружие.
AI_Output(self,other,"DIA_Andre_Waffe_08_03"); //А если ты хочешь поспать, можешь выбрать любую койку в наших казармах.
MIS_Andre_Peck = LOG_Running;
Log_CreateTopic(TOPIC_Peck,LOG_MISSION);
Log_SetTopicStatus(TOPIC_Peck,LOG_Running);
B_LogEntry(TOPIC_Peck,"Пек где-то в городе. Если я приведу его назад, в казармы, я смогу получить от него оружие.");
AI_StopProcessInfos(self);
};
instance DIA_Andre_FOUND_PECK(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_FOUND_PECK_Condition;
information = DIA_Andre_FOUND_PECK_Info;
permanent = FALSE;
description = "Мне удалось найти Пека.";
};
func int DIA_Andre_FOUND_PECK_Condition()
{
if(MIS_Andre_Peck == LOG_Running)
{
if(Npc_IsDead(Peck))
{
return TRUE;
}
else if(Npc_KnowsInfo(hero,DIA_Peck_FOUND_PECK) && (Kapitel < 3))
{
return TRUE;
}
else if((Peck.aivar[AIV_TalkedToPlayer] == TRUE) && (Kapitel >= 3))
{
return TRUE;
};
};
};
func void DIA_Andre_FOUND_PECK_Info()
{
AI_Output(other,self,"DIA_Andre_FOUND_PECK_15_00"); //Мне удалось найти Пека.
if(Npc_IsDead(Peck))
{
AI_Output(other,self,"DIA_Addon_Cord_TalkedToDexter_15_02"); //Он мертв.
AI_Output(self,other,"DIA_Maleth_GEHSTOCK_08_01"); //Это невероятно! Я...
AI_Output(self,other,"DIA_Maleth_BanditsDEAD_08_04"); //Я расскажу остальным об этом!
MIS_Andre_Peck = LOG_OBSOLETE;
B_GivePlayerXP(XP_FoundPeck / 2);
}
else if(Kapitel < 3)
{
AI_Output(self,other,"DIA_Andre_FOUND_PECK_08_01"); //Да, он уже вернулся на свой пост и приступил к выполнению своих обязанностей. Где ты нашел его?
Info_ClearChoices(DIA_Andre_FOUND_PECK);
Info_AddChoice(DIA_Andre_FOUND_PECK,"Я случайно наткнулся на него в городе.",DIA_Andre_FOUND_PECK_SOMEWHERE);
Info_AddChoice(DIA_Andre_FOUND_PECK,"Он был в Красном Фонаре.",DIA_Andre_FOUND_PECK_REDLIGHT);
}
else
{
AI_Output(self,other,"DIA_Addon_Andre_ReturnedMissingPeople_08_01"); //А я-то думал, где ты был все это время!
AI_Output(self,other,"DIA_Andre_PMSchulden_08_04"); //Ты глубоко разочаровал меня!
MIS_Andre_Peck = LOG_FAILED;
B_CheckLog();
AI_StopProcessInfos(self);
};
};
func void DIA_Andre_FOUND_PECK_SOMEWHERE()
{
AI_Output(other,self,"DIA_Andre_FOUND_PECK_SOMEWHERE_15_00"); //Я случайно наткнулся на него в городе.
AI_Output(self,other,"DIA_Andre_FOUND_PECK_SOMEWHERE_08_01"); //Хорошо, а теперь иди к нему и получи оружие.
MIS_Andre_Peck = LOG_OBSOLETE;
B_GivePlayerXP(XP_FoundPeck);
Info_ClearChoices(DIA_Andre_FOUND_PECK);
};
func void DIA_Andre_FOUND_PECK_REDLIGHT()
{
AI_Output(other,self,"DIA_Andre_FOUND_PECK_REDLIGHT_15_00"); //Он был в Красном Фонаре.
AI_Output(self,other,"DIA_Andre_FOUND_PECK_REDLIGHT_08_01"); //То есть он развлекался с девочками вместо того, чтобы выполнять свои обязанности.
AI_Output(self,other,"DIA_Andre_FOUND_PECK_REDLIGHT_08_02"); //Я думаю, мне нужно серьезно поговорить с ним.
B_GivePlayerXP(XP_FoundPeck * 2);
MIS_Andre_Peck = LOG_SUCCESS;
Info_ClearChoices(DIA_Andre_FOUND_PECK);
};
func void B_ReportToHagenNow()
{
AI_Output(self,other,"DIA_Andre_PERM_08_03"); //С этого времени ты должен докладывать непосредственно лорду Хагену. Иди, поговори с ним.
};
instance DIA_Andre_FIRSTMISSION(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_FIRSTMISSION_Condition;
information = DIA_Andre_FIRSTMISSION_Info;
permanent = FALSE;
description = "У тебя есть задание для меня?";
};
func int DIA_Andre_FIRSTMISSION_Condition()
{
if((other.guild == GIL_MIL) || (other.guild == GIL_PAL))
{
return TRUE;
};
};
func void DIA_Andre_FIRSTMISSION_Info()
{
AI_Output(other,self,"DIA_Andre_FIRSTMISSION_15_00"); //У тебя есть задание для меня?
if(other.guild == GIL_MIL)
{
AI_Output(self,other,"DIA_Andre_FIRSTMISSION_08_01"); //Последнее время в городе появилось очень много болотной травы.
AI_Output(self,other,"DIA_Andre_FIRSTMISSION_08_02"); //Мы не можем позволить, чтобы эта зараза расползлась по городу.
AI_Output(self,other,"DIA_Andre_FIRSTMISSION_08_03"); //В противном случае, все будут только курить травку и не смогут работать, не говоря уже о том, чтобы держать оружие.
AI_Output(self,other,"DIA_Andre_FIRSTMISSION_08_04"); //Это недопустимо. Особенно сейчас, когда так велика опасность нападения орков или наемников.
AI_Output(self,other,"DIA_Andre_FIRSTMISSION_08_05"); //Я подозреваю, что к этому имеют отношение наемники. Ручаюсь, это они принесли траву в город.
AI_Output(other,self,"DIA_Andre_FIRSTMISSION_15_06"); //Что я могу сделать?
AI_Output(self,other,"DIA_Andre_FIRSTMISSION_08_07"); //Мортис, один из наших людей, слышал в портовом кабаке, что где-то в порту находится целый тюк этой травы.
AI_Output(self,other,"DIA_Andre_FIRSTMISSION_08_08"); //Поищи там и принеси этот тюк мне.
MIS_Andre_WAREHOUSE = LOG_Running;
Log_CreateTopic(TOPIC_Warehouse,LOG_MISSION);
Log_SetTopicStatus(TOPIC_Warehouse,LOG_Running);
B_LogEntry(TOPIC_Warehouse,"Тюк болотной травы прибыл в гавань. Мортис прослышал об этом в местном пабе. Я должен найти этот тюк и принести его лорду Андрэ.");
}
else
{
B_ReportToHagenNow();
};
};
instance DIA_Andre_FOUND_STUFF(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_FOUND_STUFF_Condition;
information = DIA_Andre_FOUND_STUFF_Info;
permanent = TRUE;
description = "Насчет тюка...";
};
func int DIA_Andre_FOUND_STUFF_Condition()
{
if(MIS_Andre_WAREHOUSE == LOG_Running)
{
return TRUE;
};
};
func void DIA_Andre_FOUND_STUFF_Info()
{
AI_Output(other,self,"DIA_Andre_FOUND_STUFF_15_00"); //Насчет тюка...
AI_Output(self,other,"DIA_Andre_FOUND_STUFF_08_01"); //Ты нашел его?
if(Npc_HasItems(other,ItMi_HerbPaket) || (MIS_Cipher_Paket == LOG_SUCCESS))
{
Info_ClearChoices(DIA_Andre_FOUND_STUFF);
if(Npc_HasItems(other,ItMi_HerbPaket))
{
Info_AddChoice(DIA_Andre_FOUND_STUFF,"Да, вот он.",DIA_Andre_FOUND_STUFF_Ja);
};
Info_AddChoice(DIA_Andre_FOUND_STUFF,"Я выбросил ее в море.",DIA_Andre_FOUND_STUFF_Becken);
}
else
{
AI_Output(other,self,"DIA_Andre_FOUND_STUFF_15_02"); //Пока нет.
};
};
func void B_AndreStartFindDealerQuest()
{
B_AndreSold();
MIS_Andre_WAREHOUSE = LOG_SUCCESS;
if(MIS_Cipher_Paket == LOG_FAILED)
{
B_GivePlayerXP(XP_Warehouse_Super * 2);
}
else
{
B_GivePlayerXP(XP_Warehouse_Super);
};
AI_Output(self,other,"DIA_Andre_FIND_DEALER_08_01"); //Ты вывел болотную траву из оборота - это хорошо.
if(other.guild == GIL_MIL)
{
if(!Npc_IsDead(Borka) && !Npc_IsDead(Nadja))
{
AI_Output(self,other,"DIA_Andre_FIND_DEALER_08_02"); //Но я хочу знать, кто распространяет ее среди горожан.
AI_Output(self,other,"DIA_Andre_FIND_DEALER_08_03"); //Это, должно быть, кто-то в портовом квартале.
AI_Output(self,other,"DIA_Andre_FIND_DEALER_08_04"); //Если бы этот человек часто приходил в город, он давно бы был пойман.
AI_Output(other,self,"DIA_Andre_FIND_DEALER_15_05"); //Что именно мне нужно сделать?
AI_Output(self,other,"DIA_Andre_FIND_DEALER_08_06"); //Найди торговца и заставь его продать тебе этой травы. Это будет непросто, но иначе мы не сможем арестовать его.
AI_Output(self,other,"DIA_Andre_FIND_DEALER_08_07"); //Поговори с Мортисом. Он хорошо знает портовый квартал. Возможно, он сможет помочь тебе.
MIS_Andre_REDLIGHT = LOG_Running;
if(Bromor_Pay != 2)
{
B_StartOtherRoutine(Nadja,"SMOKE");
};
Log_CreateTopic(TOPIC_Redlight,LOG_MISSION);
Log_SetTopicStatus(TOPIC_Redlight,LOG_Running);
B_LogEntry(TOPIC_Redlight,"Я должен найти человека, продающего болотную траву в портовом квартале. Я должен заставить его продать мне немного травы. Мортис может помочь мне в этом.");
}
else
{
AI_Output(self,other,"DIA_Andre_REDLIGHT_SUCCESS_08_01"); //Я не думаю, что мы теперь сможем что-то узнать в портовом квартале.
if(Npc_IsDead(Borka))
{
AI_Output(self,other,"DIA_Andre_REDLIGHT_SUCCESS_08_02"); //Только не теперь, когда этот вышибала мертв.
};
if(Npc_IsDead(Nadja))
{
AI_Output(self,other,"DIA_Andre_REDLIGHT_SUCCESS_08_03"); //Эта девочка из Красного Фонаря, Надя, мертва. Возможно, это просто случайное совпадение.
};
};
};
Info_ClearChoices(DIA_Andre_FOUND_STUFF);
};
func void DIA_Andre_FOUND_STUFF_Ja()
{
AI_Output(other,self,"DIA_Andre_FOUND_STUFF_Ja_15_00"); //Да, вот он.
B_GiveInvItems(other,self,ItMi_HerbPaket,1);
AI_Output(self,other,"DIA_Andre_FOUND_STUFF_Ja_08_01"); //Отлично. Мы будем охранять эту траву.
MIS_Cipher_Paket = LOG_FAILED;
B_AndreStartFindDealerQuest();
};
func void DIA_Andre_FOUND_STUFF_Becken()
{
AI_Output(other,self,"DIA_Andre_FOUND_STUFF_Becken_15_00"); //Я выбросил ее в море.
AI_Output(self,other,"DIA_Andre_FOUND_STUFF_Becken_08_01"); //Да? Ну, главное, что она теперь не может попасть в плохие руки.
B_AndreStartFindDealerQuest();
};
instance DIA_Andre_REDLIGHT_SUCCESS(C_Info)
{
npc = MIL_311_Andre;
nr = 2;
condition = DIA_Andre_REDLIGHT_SUCCESS_Condition;
information = DIA_Andre_REDLIGHT_SUCCESS_Info;
permanent = TRUE;
description = "Насчет травы...";
};
func int DIA_Andre_REDLIGHT_SUCCESS_Condition()
{
if(MIS_Andre_REDLIGHT == LOG_Running)
{
return TRUE;
};
};
func void DIA_Andre_REDLIGHT_SUCCESS_Info()
{
AI_Output(other,self,"DIA_Andre_REDLIGHT_SUCCESS_15_00"); //Насчет травы...
if(Npc_IsDead(Borka) || (Undercover_Failed == TRUE) || (Npc_IsDead(Nadja) && (Knows_Borka_Dealer == FALSE)))
{
AI_Output(self,other,"DIA_Andre_REDLIGHT_SUCCESS_08_01"); //Я не думаю, что мы теперь сможем что-то узнать в портовом квартале.
if(Npc_IsDead(Borka))
{
AI_Output(self,other,"DIA_Andre_REDLIGHT_SUCCESS_08_02"); //Только не теперь, когда этот вышибала мертв.
};
if((Nadja_Victim == TRUE) || (Npc_IsDead(Nadja) && (Knows_Borka_Dealer == FALSE)))
{
AI_Output(self,other,"DIA_Andre_REDLIGHT_SUCCESS_08_03"); //Эта девочка из Красного Фонаря, Надя, мертва. Возможно, это просто случайное совпадение.
B_RemoveNpc(Nadja);
};
if(Undercover_Failed == TRUE)
{
AI_Output(self,other,"DIA_Andre_REDLIGHT_SUCCESS_08_04"); //Ты был недостаточно осторожен.
};
MIS_Andre_REDLIGHT = LOG_FAILED;
B_CheckLog();
}
else if(Borka_Deal == 2)
{
AI_Output(other,self,"DIA_Andre_REDLIGHT_SUCCESS_15_05"); //Я знаю, кто распространяет траву в городе. Это Борка, вышибала в Красном Фонаре.
AI_Output(self,other,"DIA_Andre_REDLIGHT_SUCCESS_08_06"); //Точно? У тебя есть доказательства?
AI_Output(other,self,"DIA_Andre_REDLIGHT_SUCCESS_15_07"); //Он продал мне болотной травы.
AI_Output(self,other,"DIA_Andre_REDLIGHT_SUCCESS_08_08"); //Отлично, этого достаточно для нас. Я прикажу немедленно арестовать его.
B_AndreSold();
B_NpcSetJailed(Borka);
B_StartOtherRoutine(Borka,"PRISON");
MIS_Andre_REDLIGHT = LOG_SUCCESS;
B_GivePlayerXP(XP_Redlight);
}
else
{
AI_Output(other,self,"DIA_Andre_REDLIGHT_SUCCESS_15_09"); //...я все еще работаю над этим.
AI_Output(self,other,"DIA_Andre_REDLIGHT_SUCCESS_08_10"); //Хорошо. Помни, что ты должен заставить этого человека совершить сделку с тобой.
};
};
instance DIA_Andre_HILFBAUERLOBART(C_Info)
{
npc = MIL_311_Andre;
nr = 3;
condition = DIA_Andre_HILFBAUERLOBART_Condition;
information = DIA_Andre_HILFBAUERLOBART_Info;
description = "У тебя есть еще задания для меня?";
};
func int DIA_Andre_HILFBAUERLOBART_Condition()
{
if(MIS_Andre_WAREHOUSE == LOG_SUCCESS)
{
return TRUE;
};
};
func void DIA_Andre_HILFBAUERLOBART_Info()
{
if(other.guild == GIL_MIL)
{
AI_Output(other,self,"DIA_Andre_HILFBAUERLOBART_15_00"); //У тебя есть еще задания для меня?
AI_Output(self,other,"DIA_Andre_HILFBAUERLOBART_08_01"); //У фермера Лобарта какие-то проблемы на его полях.
AI_Output(self,other,"DIA_Andre_HILFBAUERLOBART_08_02"); //Если мы поможем ему, это укрепит его отношения с городом. Так что отправляйся туда и посмотри, что там не так.
Log_CreateTopic(TOPIC_Feldraeuber,LOG_MISSION);
Log_SetTopicStatus(TOPIC_Feldraeuber,LOG_Running);
B_LogEntry(TOPIC_Feldraeuber,"Андрэ отправил меня на ферму Лобарта. Я опять должен помочь Лобарту восстановить порядок на ферме.");
MIS_AndreHelpLobart = LOG_Running;
Wld_InsertNpc(Lobarts_Giant_Bug1,"NW_FARM1_FIELD_06");
Wld_InsertNpc(Lobarts_Giant_Bug2,"NW_FARM1_FIELD_06");
Wld_InsertNpc(Lobarts_Giant_Bug3,"NW_FARM1_FIELD_05");
Wld_InsertNpc(Lobarts_Giant_Bug4,"NW_FARM1_FIELD_05");
Wld_InsertNpc(Lobarts_Giant_Bug5,"NW_FARM1_FIELD_04");
Wld_InsertNpc(Lobarts_Giant_Bug6,"NW_FARM1_FIELD_04");
Wld_InsertNpc(Lobarts_Giant_Bug7,"NW_FARM1_FIELD_03");
B_StartOtherRoutine(Vino,"BUGSTHERE");
B_StartOtherRoutine(LobartsBauer1,"BUGSTHERE");
B_StartOtherRoutine(LobartsBauer2,"BUGSTHERE");
}
else if(other.guild == GIL_PAL)
{
B_ReportToHagenNow();
};
AI_StopProcessInfos(self);
};
instance DIA_Andre_LOBART_SUCCESS(C_Info)
{
npc = MIL_311_Andre;
condition = DIA_Andre_LOBART_SUCCESS_Condition;
information = DIA_Andre_LOBART_SUCCESS_Info;
description = "Я помог Лобарту.";
};
func int DIA_Andre_LOBART_SUCCESS_Condition()
{
if(MIS_AndreHelpLobart == LOG_SUCCESS)
{
return TRUE;
};
};
func void DIA_Andre_LOBART_SUCCESS_Info()
{
AI_Output(other,self,"DIA_Andre_LOBART_SUCCESS_15_00"); //Я помог Лобарту.
AI_Output(self,other,"DIA_Andre_LOBART_SUCCESS_08_01"); //Превосходно. Если Лобарт будет счастлив, он продолжит продавать репу городу.
B_AndreSold();
B_GivePlayerXP(XP_LobartBugs);
};
instance DIA_Andre_ThievesGuildQuestForMIL(C_Info)
{
npc = MIL_311_Andre;
condition = DIA_Andre_ThievesGuildQuestForMIL_Condition;
information = DIA_Andre_ThievesGuildQuestForMIL_Info;
description = "У тебя есть еще задания для меня?";
};
func int DIA_Andre_ThievesGuildQuestForMIL_Condition()
{
if(Npc_KnowsInfo(other,DIA_Andre_LOBART_SUCCESS))
{
return TRUE;
};
};
func void DIA_Andre_ThievesGuildQuestForMIL_Info()
{
AI_Output(other,self,"DIA_Andre_HILFBAUERLOBART_15_00"); //У тебя есть еще задания для меня?
if(MIS_Andre_GuildOfThieves == FALSE)
{
AI_Output(self,other,"DIA_Andre_GuildOfThieves_08_01"); //Последнее время в городе развелось слишком много воров. И мы никак не можем поймать ни одного из них. Воры действуют очень осторожно.
AI_Output(self,other,"DIA_Andre_GuildOfThieves_08_02"); //Эти мерзавцы знают свое дело. Я уверен, что в городе действует организованная банда.
AI_Output(self,other,"DIA_Andre_GuildOfThieves_08_03"); //Я не удивлюсь, если в Хоринисе появилась гильдия воров. Найди главарей этой банды и ликвидируй их.
MIS_Andre_GuildOfThieves = LOG_Running;
}
else
{
AI_Output(self,other,"DIA_Andre_PERM_08_01"); //Все под контролем.
};
};
instance DIA_Addon_Andre_MissingPeople(C_Info)
{
npc = MIL_311_Andre;
nr = 5;
condition = DIA_Addon_Andre_MissingPeople_Condition;
information = DIA_Addon_Andre_MissingPeople_Info;
description = "Что насчет пропавших людей?";
};
func int DIA_Addon_Andre_MissingPeople_Condition()
{
if((SC_HearedAboutMissingPeople == TRUE) && ((other.guild == GIL_MIL) || (other.guild == GIL_PAL)) && (MIS_Addon_Andre_MissingPeople != LOG_SUCCESS))
{
return TRUE;
};
};
func void DIA_Addon_Andre_MissingPeople_Info()
{
AI_Output(other,self,"DIA_Addon_Andre_MissingPeople_15_00"); //Что насчет пропавших людей?
AI_Output(self,other,"DIA_Addon_Andre_MissingPeople_08_01"); //А что насчет них?
AI_Output(other,self,"DIA_Addon_Andre_MissingPeople_15_02"); //Разве мы не должны попытаться их найти?
AI_Output(self,other,"DIA_Addon_Andre_MissingPeople_08_03"); //Лорд Хаген поручил мне защиту города и близлежащих ферм.
AI_Output(self,other,"DIA_Addon_Andre_MissingPeople_08_04"); //Это значит, что мы заботимся о тех людях, которые все еще ЗДЕСЬ.
AI_Output(self,other,"DIA_Addon_Andre_MissingPeople_08_05"); //Солдаты ополчения патрулируют по ночам улицы. Это все, что я могу сделать.
if(other.guild == GIL_MIL)
{
AI_Output(self,other,"DIA_Addon_Andre_MissingPeople_08_06"); //А ТЫ будешь заниматься тем, чем я тебе прикажу. Понимаешь меня?
};
MIS_Addon_Andre_MissingPeople = LOG_Running;
};
instance DIA_Addon_Andre_MissingPeople2(C_Info)
{
npc = MIL_311_Andre;
nr = 5;
condition = DIA_Addon_Andre_MissingPeople2_Condition;
information = DIA_Addon_Andre_MissingPeople2_Info;
description = "По поводу пропавших людей...";
};
func int DIA_Addon_Andre_MissingPeople2_Condition()
{
if((SC_HearedAboutMissingPeople == TRUE) && (other.guild != GIL_MIL) && (other.guild != GIL_PAL) && (MIS_Addon_Andre_MissingPeople != LOG_SUCCESS))
{
return TRUE;
};
};
func void DIA_Addon_Andre_MissingPeople2_Info()
{
AI_Output(other,self,"DIA_Addon_Andre_MissingPeople2_15_00"); //По поводу пропавших людей...
AI_Output(self,other,"DIA_Addon_Andre_MissingPeople2_08_01"); //Оставь меня в покое! У меня полно других забот.
MIS_Addon_Andre_MissingPeople = LOG_Running;
};
instance DIA_Addon_Andre_ReturnedMissingPeople(C_Info)
{
npc = MIL_311_Andre;
nr = 5;
condition = DIA_Addon_Andre_ReturnedMissingPeople_Condition;
information = DIA_Addon_Andre_ReturnedMissingPeople_Info;
description = "Мне удалось спасти часть пропавших людей.";
};
func int DIA_Addon_Andre_ReturnedMissingPeople_Condition()
{
if((MissingPeopleReturnedHome == TRUE) && (MIS_Addon_Andre_MissingPeople == LOG_Running))
{
return TRUE;
};
};
func void DIA_Addon_Andre_ReturnedMissingPeople_Info()
{
AI_Output(other,self,"DIA_Addon_Andre_ReturnedMissingPeople_15_00"); //Мне удалось спасти часть пропавших людей.
if(other.guild == GIL_MIL)
{
AI_Output(self,other,"DIA_Addon_Andre_ReturnedMissingPeople_08_01"); //А я-то думал, где ты был все это время!
AI_Output(self,other,"DIA_Addon_Andre_ReturnedMissingPeople_08_02"); //Ты - солдат ополчения! И ты не получал приказа заниматься поисками пропавших!
AI_Output(other,self,"DIA_Addon_Andre_ReturnedMissingPeople_15_03"); //Но...
};
AI_Output(self,other,"DIA_Addon_Andre_ReturnedMissingPeople_08_04"); //Как много людей ты спас?
AI_Output(other,self,"DIA_Addon_Andre_ReturnedMissingPeople_15_05"); //Всех тех, кто был еще жив...
AI_Output(self,other,"DIA_Addon_Andre_ReturnedMissingPeople_08_06"); //Всех?! Я... Э-э-э...
if((other.guild == GIL_MIL) || (other.guild == GIL_PAL))
{
AI_Output(self,other,"DIA_Addon_Andre_ReturnedMissingPeople_08_07"); //Я тобой горжусь! И я рад, что принял тебя в наши ряды.
B_AndreSold();
};
AI_Output(self,other,"DIA_Addon_Andre_ReturnedMissingPeople_08_08"); //Ты сделал великое дело!
MIS_Addon_Andre_MissingPeople = LOG_SUCCESS;
B_GivePlayerXP(XP_Addon_Andre_MissingPeople);
};
instance DIA_Andre_BerichtDrachen(C_Info)
{
npc = MIL_311_Andre;
nr = 1;
condition = DIA_Andre_BerichtDrachen_Condition;
information = DIA_Andre_BerichtDrachen_Info;
permanent = FALSE;
description = "Я был в Долине Рудников и видел драконов!";
};
func int DIA_Andre_BerichtDrachen_Condition()
{
if((EnterOW_Kapitel2 == TRUE) && (MIS_OLDWORLD != LOG_SUCCESS))
{
return TRUE;
};
};
func void DIA_Andre_BerichtDrachen_Info()
{
AI_Output(other,self,"DIA_Andre_Add_15_13"); //Я был в Долине Рудников и видел драконов!
if(Npc_HasItems(hero,ItWr_PaladinLetter_MIS))
{
AI_Output(other,self,"DIA_Andre_Add_15_14"); //У меня есть письмо от командующего Гаронда, подтверждающее то, что я сказал.
};
AI_Output(self,other,"DIA_Andre_Add_08_10"); //Это заинтересует лорда Хагена!
B_Andre_GotoLordHagen();
};
instance DIA_Andre_BennetInPrison(C_Info)
{
npc = MIL_311_Andre;
condition = DIA_Andre_BennetInPrison_Condition;
information = DIA_Andre_BennetInPrison_Info;
permanent = TRUE;
description = "А что насчет Беннета, кузнеца?";
};
func int DIA_Andre_BennetInPrison_Condition()
{
if(MIS_RescueBennet == LOG_Running)
{
return TRUE;
};
};
func void DIA_Andre_BennetInPrison_Info()
{
AI_Output(other,self,"DIA_Andre_BennetInPrison_15_00"); //А что насчет Беннета, кузнеца?
AI_Output(self,other,"DIA_Andre_BennetInPrison_08_01"); //Ты имеешь в виду этого наемника? Он сидит за решеткой, где ему самое место.
AI_Output(other,self,"DIA_Andre_BennetInPrison_Talk_15_00"); //Могу я поговорить с ним?
AI_Output(self,other,"DIA_Andre_BennetInPrison_Talk_08_01"); //Конечно. Но если ты попытаешься помочь ему бежать, ты окажешься за решеткой рядом с ним.
};
instance DIA_Andre_Cornelius_Liar(C_Info)
{
npc = MIL_311_Andre;
condition = DIA_Andre_Cornelius_Liar_Condition;
information = DIA_Andre_Cornelius_Liar_Info;
permanent = TRUE;
description = "Я думаю, Корнелиус лжет.";
};
func int DIA_Andre_Cornelius_Liar_Condition()
{
if((Cornelius_ThreatenByMilSC == TRUE) && (CorneliusFlee == FALSE) && (MIS_RescueBennet != LOG_SUCCESS))
{
return TRUE;
};
};
func void DIA_Andre_Cornelius_Liar_Info()
{
AI_Output(other,self,"DIA_Andre_Cornelius_Liar_15_00"); //Я думаю, Корнелиус лжет.
AI_Output(self,other,"DIA_Andre_Cornelius_Liar_08_01"); //Ты уверен?
Info_ClearChoices(DIA_Andre_Cornelius_Liar);
Info_AddChoice(DIA_Andre_Cornelius_Liar,"Нет.",DIA_Andre_Cornelius_Liar_No);
Info_AddChoice(DIA_Andre_Cornelius_Liar,"Да.",DIA_Andre_Cornelius_Liar_Yes);
};
func void DIA_Andre_Cornelius_Liar_No()
{
AI_Output(other,self,"DIA_Andre_Cornelius_Liar_No_15_00"); //Нет.
AI_Output(self,other,"DIA_Andre_Cornelius_Liar_No_08_01"); //Тогда не стоит заявлять о своих подозрениях во весь голос.
AI_Output(self,other,"DIA_Andre_Cornelius_Liar_No_08_02"); //Корнелиус - влиятельный человек. Он может сделать твою жизнь адом, если захочет.
AI_Output(self,other,"DIA_Andre_Cornelius_Liar_No_08_03"); //Пока у тебя нет доказательств, я ничем не могу помочь тебе.
Info_ClearChoices(DIA_Andre_Cornelius_Liar);
};
func void DIA_Andre_Cornelius_Liar_Yes()
{
AI_Output(other,self,"DIA_Andre_Cornelius_Liar_Yes_15_00"); //Да.
AI_Output(self,other,"DIA_Andre_Cornelius_Liar_Yes_08_01"); //Что за доказательства у тебя есть?
if(Cornelius_IsLiar == TRUE)
{
AI_Output(other,self,"DIA_Andre_Cornelius_Liar_Yes_15_02"); //Я прочел его дневник! Его подкупили. Все, что он сказал, было ложью.
AI_Output(self,other,"DIA_Andre_Cornelius_Liar_Yes_08_03"); //Если это действительно так, ты должен немедленно сообщить об этом лорду Хагену.
AI_Output(self,other,"DIA_Andre_Cornelius_Liar_Yes_08_04"); //Покажи ему этот дневник. Он разберется в этом деле.
}
else
{
AI_Output(other,self,"DIA_Andre_Cornelius_Liar_Yes_15_05"); //Э-э-э, ну, я думаю...
AI_Output(self,other,"DIA_Andre_Cornelius_Liar_Yes_08_06"); //Мне нужны доказательства, а не предположения. Принеси доказательства, и тогда я смогу что-нибудь сделать.
AI_Output(self,other,"DIA_Andre_Cornelius_Liar_Yes_08_07"); //А до того времени тебе стоит поосторожнее выбирать слова.
};
Info_ClearChoices(DIA_Andre_Cornelius_Liar);
};
instance DIA_Andre_Paladin(C_Info)
{
npc = MIL_311_Andre;
condition = DIA_Andre_Paladin_Condition;
information = DIA_Andre_Paladin_Info;
permanent = FALSE;
important = TRUE;
};
func int DIA_Andre_Paladin_Condition()
{
if(other.guild == GIL_PAL)
{
return TRUE;
};
};
func void DIA_Andre_Paladin_Info()
{
AI_Output(self,other,"DIA_Andre_Paladin_08_00"); //Теперь ты паладин! Поздравляю!
AI_Output(self,other,"DIA_Andre_Paladin_08_01"); //Я с самого начала знал, что ты не задержишься долго в ополчении.
};
instance DIA_Andre_PERM(C_Info)
{
npc = MIL_311_Andre;
nr = 100;
condition = DIA_Andre_PERM_Condition;
information = DIA_Andre_PERM_Info;
permanent = TRUE;
description = "Как обстановка в городе?";
};
func int DIA_Andre_PERM_Condition()
{
if(other.guild != GIL_NONE)
{
return TRUE;
};
};
func void DIA_Andre_PERM_Info()
{
AI_Output(other,self,"DIA_Andre_PERM_15_00"); //Как обстановка в городе?
AI_Output(self,other,"DIA_Andre_PERM_08_01"); //Все под контролем.
if(other.guild == GIL_MIL)
{
AI_Output(self,other,"DIA_Andre_PERM_08_02"); //Выполняй свои задания.
};
if(other.guild == GIL_PAL)
{
B_ReportToHagenNow();
};
};
instance DIA_Andre_BerichtDrachenTot(C_Info)
{
npc = MIL_311_Andre;
nr = 1;
condition = DIA_Andre_BerichtDrachenTot_Condition;
information = DIA_Andre_BerichtDrachenTot_Info;
permanent = FALSE;
description = "Я убил всех драконов в Долине Рудников!";
};
func int DIA_Andre_BerichtDrachenTot_Condition()
{
if(Kapitel == 5)
{
return TRUE;
};
};
func void DIA_Andre_BerichtDrachenTot_Info()
{
AI_Output(other,self,"DIA_Andre_Add_15_15"); //Я убил всех драконов в Долине Рудников!
AI_Output(self,other,"DIA_Andre_Add_08_08"); //Если это правда, ты должен рассказать об этом лорду Хагену.
B_Andre_GotoLordHagen();
};
instance DIA_Andre_BerichtTorAuf(C_Info)
{
npc = MIL_311_Andre;
nr = 1;
condition = DIA_Andre_BerichtTorAuf_Condition;
information = DIA_Andre_BerichtTorAuf_Info;
permanent = FALSE;
description = "Замок в Долине Рудников штурмовали орки!";
};
func int DIA_Andre_BerichtTorAuf_Condition()
{
if((Kapitel == 5) && (MIS_OCGateOpen == TRUE) && Npc_KnowsInfo(other,DIA_Andre_BerichtDrachenTot))
{
return TRUE;
};
};
func void DIA_Andre_BerichtTorAuf_Info()
{
AI_Output(other,self,"DIA_Andre_Add_15_16"); //Замок в Долине Рудников штурмовали орки!
AI_Output(self,other,"DIA_Andre_Add_08_09"); //Лорд Хаген должен услышать об этом.
B_Andre_GotoLordHagen();
};
|
D
|
/* $OpenBSD: tree.h,v 1.29 2017/07/30 19:27:20 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 libressl_d.compat.sys.tree;
private static import core.stdc.config;
//#include <sys/_null.h>
extern (C):
nothrow @nogc:
/*
* This file defines data structures for different types of trees:
* splay trees and red-black trees.
*
* A splay tree is a self-organizing data structure. Every operation
* on the tree causes a splay to happen. The splay moves the requested
* node to the root of the tree and partly rebalances it.
*
* This has the benefit that request locality causes faster lookups as
* the requested nodes move to the top of the tree. On the other hand,
* every lookup causes memory writes.
*
* The Balance Theorem bounds the total access time for m operations
* and n inserts on an initially empty tree as O((m + n)lg n). The
* amortized cost for a sequence of m accesses to a splay tree is O(lg n);
*
* A red-black tree is a binary search tree with the node color as an
* extra attribute. It fulfills a set of conditions:
* - every search path from the root to a leaf consists of the
* same number of black nodes,
* - each red node (except for the root) has a black parent,
* - each leaf node is black.
*
* Every operation on a red-black tree is bounded as O(lg n).
* The maximum height of a red-black tree is 2lg (n+1).
*/
//#define SPLAY_HEAD(name, type) struct name { struct type* sph_root; /* root of the tree */ }
//#define SPLAY_INITIALIZER(root) { NULL }
//#define SPLAY_INIT(root) do { (root)->sph_root = NULL; } while (0)
//#define SPLAY_ENTRY(type) struct { struct type* spe_left; /* left element */ struct type* spe_right; /* right element */ }
//#define SPLAY_LEFT(elm, field) (elm)->field.spe_left
//#define SPLAY_RIGHT(elm, field) (elm)->field.spe_right
//#define SPLAY_ROOT(head) (head)->sph_root
//#define SPLAY_EMPTY(head) (SPLAY_ROOT(head) == NULL)
/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */
//#define SPLAY_ROTATE_RIGHT(head, tmp, field) do { SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); SPLAY_RIGHT(tmp, field) = (head)->sph_root; (head)->sph_root = tmp; } while (0)
//#define SPLAY_ROTATE_LEFT(head, tmp, field) do { SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); SPLAY_LEFT(tmp, field) = (head)->sph_root; (head)->sph_root = tmp; } while (0)
//#define SPLAY_LINKLEFT(head, tmp, field) do { SPLAY_LEFT(tmp, field) = (head)->sph_root; tmp = (head)->sph_root; (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); } while (0)
//#define SPLAY_LINKRIGHT(head, tmp, field) do { SPLAY_RIGHT(tmp, field) = (head)->sph_root; tmp = (head)->sph_root; (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); } while (0)
//#define SPLAY_ASSEMBLE(head, node, left, right, field) do { SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field); SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); } while (0)
/* Generates prototypes and inline functions */
//#define SPLAY_PROTOTYPE(name, type, field, cmp) void name##_SPLAY(struct name*, struct type*); void name##_SPLAY_MINMAX(struct name*, int); struct type* name##_SPLAY_INSERT(struct name*, struct type*); struct type* name##_SPLAY_REMOVE(struct name*, struct type*); /* Finds the node with the same key as elm */ static __unused __inline struct type* name##_SPLAY_FIND(struct name* head, struct type* elm) { if (SPLAY_EMPTY(head)) return (NULL); name##_SPLAY(head, elm); if ((cmp)(elm, (head)->sph_root) == 0) return (head->sph_root); return (NULL); } static __unused __inline struct type* name##_SPLAY_NEXT(struct name* head, struct type* elm) { name##_SPLAY(head, elm); if (SPLAY_RIGHT(elm, field) != NULL) { elm = SPLAY_RIGHT(elm, field); while (SPLAY_LEFT(elm, field) != NULL) { elm = SPLAY_LEFT(elm, field); } } else elm = NULL; return (elm); } static __unused __inline struct type* name##_SPLAY_MIN_MAX(struct name* head, int val) { name##_SPLAY_MINMAX(head, val); return (SPLAY_ROOT(head)); }
/* Main splay operation.
* Moves node close to the key of elm to top
*/
//#define SPLAY_GENERATE(name, type, field, cmp) struct type* name##_SPLAY_INSERT(struct name* head, struct type* elm) { if (SPLAY_EMPTY(head)) { SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; } else { int __comp; name##_SPLAY(head, elm); __comp = (cmp)(elm, (head)->sph_root); if (__comp < 0) { SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field); SPLAY_RIGHT(elm, field) = (head)->sph_root; SPLAY_LEFT((head)->sph_root, field) = NULL; } else if (__comp > 0) { SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field); SPLAY_LEFT(elm, field) = (head)->sph_root; SPLAY_RIGHT((head)->sph_root, field) = NULL; } else return ((head)->sph_root); } (head)->sph_root = (elm); return (NULL); } struct type* name##_SPLAY_REMOVE(struct name* head, struct type* elm) { struct type* __tmp; if (SPLAY_EMPTY(head)) return (NULL); name##_SPLAY(head, elm); if ((cmp)(elm, (head)->sph_root) == 0) { if (SPLAY_LEFT((head)->sph_root, field) == NULL) { (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); } else { __tmp = SPLAY_RIGHT((head)->sph_root, field); (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); name##_SPLAY(head, elm); SPLAY_RIGHT((head)->sph_root, field) = __tmp; } return (elm); } return (NULL); } void name##_SPLAY(struct name* head, struct type* elm) { struct type __node, *__left, *__right, *__tmp; int __comp; SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL; __left = __right = &__node; while ((__comp = (cmp)(elm, (head)->sph_root))) { if (__comp < 0) { __tmp = SPLAY_LEFT((head)->sph_root, field); if (__tmp == NULL) break; if ((cmp)(elm, __tmp) < 0) { SPLAY_ROTATE_RIGHT(head, __tmp, field); if (SPLAY_LEFT((head)->sph_root, field) == NULL) break; } SPLAY_LINKLEFT(head, __right, field); } else if (__comp > 0) { __tmp = SPLAY_RIGHT((head)->sph_root, field); if (__tmp == NULL) break; if ((cmp)(elm, __tmp) > 0) { SPLAY_ROTATE_LEFT(head, __tmp, field); if (SPLAY_RIGHT((head)->sph_root, field) == NULL) break; } SPLAY_LINKRIGHT(head, __left, field); } } SPLAY_ASSEMBLE(head, &__node, __left, __right, field); } /* Splay with either the minimum or the maximum element * Used to find minimum or maximum element in tree. */ void name##_SPLAY_MINMAX(struct name* head, int __comp) { struct type __node, *__left, *__right, *__tmp; SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL; __left = __right = &__node; while (1) { if (__comp < 0) { __tmp = SPLAY_LEFT((head)->sph_root, field); if (__tmp == NULL) break; if (__comp < 0) { SPLAY_ROTATE_RIGHT(head, __tmp, field); if (SPLAY_LEFT((head)->sph_root, field) == NULL) break; } SPLAY_LINKLEFT(head, __right, field); } else if (__comp > 0) { __tmp = SPLAY_RIGHT((head)->sph_root, field); if (__tmp == NULL) break; if (__comp > 0) { SPLAY_ROTATE_LEFT(head, __tmp, field); if (SPLAY_RIGHT((head)->sph_root, field) == NULL) break; } SPLAY_LINKRIGHT(head, __left, field); } } SPLAY_ASSEMBLE(head, &__node, __left, __right, field); }
enum SPLAY_NEGINF = -1;
enum SPLAY_INF = 1;
//#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y)
//#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y)
//#define SPLAY_FIND(name, x, y) name##_SPLAY_FIND(x, y)
//#define SPLAY_NEXT(name, x, y) name##_SPLAY_NEXT(x, y)
//#define SPLAY_MIN(name, x) (SPLAY_EMPTY(x) ? NULL : name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))
//#define SPLAY_MAX(name, x) (SPLAY_EMPTY(x) ? NULL : name##_SPLAY_MIN_MAX(x, SPLAY_INF))
//#define SPLAY_FOREACH(x, name, head) for ((x) = SPLAY_MIN(name, head); (x) != NULL; (x) = SPLAY_NEXT(name, head, x))
/* Macros that define a red-black tree */
//#define RB_HEAD(name, type) struct name { struct type* rbh_root; /* root of the tree */ }
//#define RB_INITIALIZER(root) { NULL }
//#define RB_INIT(root) do { (root)->rbh_root = NULL; } while (0)
enum RB_BLACK = 0;
enum RB_RED = 1;
//#define RB_ENTRY(type) struct { struct type* rbe_left; /* left element */ struct type* rbe_right; /* right element */ struct type* rbe_parent; /* parent element */ int rbe_color; /* node color */ }
//#define RB_LEFT(elm, field) (elm)->field.rbe_left
//#define RB_RIGHT(elm, field) (elm)->field.rbe_right
//#define RB_PARENT(elm, field) (elm)->field.rbe_parent
//#define RB_COLOR(elm, field) (elm)->field.rbe_color
//#define RB_ROOT(head) (head)->rbh_root
//#define RB_EMPTY(head) (RB_ROOT(head) == NULL)
//#define RB_SET(elm, parent, field) do { RB_PARENT(elm, field) = parent; RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; RB_COLOR(elm, field) = RB_RED; } while (0)
//#define RB_SET_BLACKRED(black, red, field) do { RB_COLOR(black, field) = RB_BLACK; RB_COLOR(red, field) = RB_RED; } while (0)
//#ifndef RB_AUGMENT
//#define RB_AUGMENT(x) do { } while (0)
//#endif
//#define RB_ROTATE_LEFT(head, elm, tmp, field) do { (tmp) = RB_RIGHT(elm, field); if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field))) { RB_PARENT(RB_LEFT(tmp, field), field) = (elm); } RB_AUGMENT(elm); if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))) { if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) RB_LEFT(RB_PARENT(elm, field), field) = (tmp); else RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); } else (head)->rbh_root = (tmp); RB_LEFT(tmp, field) = (elm); RB_PARENT(elm, field) = (tmp); RB_AUGMENT(tmp); if ((RB_PARENT(tmp, field))) RB_AUGMENT(RB_PARENT(tmp, field)); } while (0)
//#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { (tmp) = RB_LEFT(elm, field); if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field))) { RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); } RB_AUGMENT(elm); if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))) { if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) RB_LEFT(RB_PARENT(elm, field), field) = (tmp); else RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); } else (head)->rbh_root = (tmp); RB_RIGHT(tmp, field) = (elm); RB_PARENT(elm, field) = (tmp); RB_AUGMENT(tmp); if ((RB_PARENT(tmp, field))) RB_AUGMENT(RB_PARENT(tmp, field)); } while (0)
/* Generates prototypes and inline functions */
//#define RB_PROTOTYPE(name, type, field, cmp) RB_PROTOTYPE_INTERNAL(name, type, field, cmp, )
//#define RB_PROTOTYPE_STATIC(name, type, field, cmp) RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __attribute__((__unused__)) static)
//#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) attr void name##_RB_INSERT_COLOR(struct name*, struct type*); attr void name##_RB_REMOVE_COLOR(struct name*, struct type*, struct type*); attr struct type* name##_RB_REMOVE(struct name*, struct type*); attr struct type* name##_RB_INSERT(struct name*, struct type*); attr struct type* name##_RB_FIND(struct name*, struct type*); attr struct type* name##_RB_NFIND(struct name*, struct type*); attr struct type* name##_RB_NEXT(struct type*); attr struct type* name##_RB_PREV(struct type*); attr struct type* name##_RB_MINMAX(struct name*, int);
/* Main rb operation.
* Moves node close to the key of elm to top
*/
//#define RB_GENERATE(name, type, field, cmp) RB_GENERATE_INTERNAL(name, type, field, cmp, )
//#define RB_GENERATE_STATIC(name, type, field, cmp) RB_GENERATE_INTERNAL(name, type, field, cmp, __attribute__((__unused__)) static)
//#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) attr void name##_RB_INSERT_COLOR(struct name* head, struct type* elm) { struct type *parent, *gparent, *tmp; while ((parent = RB_PARENT(elm, field)) && RB_COLOR(parent, field) == RB_RED) { gparent = RB_PARENT(parent, field); if (parent == RB_LEFT(gparent, field)) { tmp = RB_RIGHT(gparent, field); if (tmp && RB_COLOR(tmp, field) == RB_RED) { RB_COLOR(tmp, field) = RB_BLACK; RB_SET_BLACKRED(parent, gparent, field); elm = gparent; continue; } if (RB_RIGHT(parent, field) == elm) { RB_ROTATE_LEFT(head, parent, tmp, field); tmp = parent; parent = elm; elm = tmp; } RB_SET_BLACKRED(parent, gparent, field); RB_ROTATE_RIGHT(head, gparent, tmp, field); } else { tmp = RB_LEFT(gparent, field); if (tmp && RB_COLOR(tmp, field) == RB_RED) { RB_COLOR(tmp, field) = RB_BLACK; RB_SET_BLACKRED(parent, gparent, field); elm = gparent; continue; } if (RB_LEFT(parent, field) == elm) { RB_ROTATE_RIGHT(head, parent, tmp, field); tmp = parent; parent = elm; elm = tmp; } RB_SET_BLACKRED(parent, gparent, field); RB_ROTATE_LEFT(head, gparent, tmp, field); } } RB_COLOR(head->rbh_root, field) = RB_BLACK; } attr void name##_RB_REMOVE_COLOR(struct name* head, struct type* parent, struct type* elm) { struct type* tmp; while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && elm != RB_ROOT(head)) { if (RB_LEFT(parent, field) == elm) { tmp = RB_RIGHT(parent, field); if (RB_COLOR(tmp, field) == RB_RED) { RB_SET_BLACKRED(tmp, parent, field); RB_ROTATE_LEFT(head, parent, tmp, field); tmp = RB_RIGHT(parent, field); } if ((RB_LEFT(tmp, field) == NULL || RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && (RB_RIGHT(tmp, field) == NULL || RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { RB_COLOR(tmp, field) = RB_RED; elm = parent; parent = RB_PARENT(elm, field); } else { if (RB_RIGHT(tmp, field) == NULL || RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) { struct type* oleft; if ((oleft = RB_LEFT(tmp, field))) RB_COLOR(oleft, field) = RB_BLACK; RB_COLOR(tmp, field) = RB_RED; RB_ROTATE_RIGHT(head, tmp, oleft, field); tmp = RB_RIGHT(parent, field); } RB_COLOR(tmp, field) = RB_COLOR(parent, field); RB_COLOR(parent, field) = RB_BLACK; if (RB_RIGHT(tmp, field)) RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; RB_ROTATE_LEFT(head, parent, tmp, field); elm = RB_ROOT(head); break; } } else { tmp = RB_LEFT(parent, field); if (RB_COLOR(tmp, field) == RB_RED) { RB_SET_BLACKRED(tmp, parent, field); RB_ROTATE_RIGHT(head, parent, tmp, field); tmp = RB_LEFT(parent, field); } if ((RB_LEFT(tmp, field) == NULL || RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && (RB_RIGHT(tmp, field) == NULL || RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { RB_COLOR(tmp, field) = RB_RED; elm = parent; parent = RB_PARENT(elm, field); } else { if (RB_LEFT(tmp, field) == NULL || RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) { struct type* oright; if ((oright = RB_RIGHT(tmp, field))) RB_COLOR(oright, field) = RB_BLACK; RB_COLOR(tmp, field) = RB_RED; RB_ROTATE_LEFT(head, tmp, oright, field); tmp = RB_LEFT(parent, field); } RB_COLOR(tmp, field) = RB_COLOR(parent, field); RB_COLOR(parent, field) = RB_BLACK; if (RB_LEFT(tmp, field)) RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; RB_ROTATE_RIGHT(head, parent, tmp, field); elm = RB_ROOT(head); break; } } } if (elm) RB_COLOR(elm, field) = RB_BLACK; } attr struct type* name##_RB_REMOVE(struct name* head, struct type* elm) { struct type *child, *parent, *old = elm; int color; if (RB_LEFT(elm, field) == NULL) child = RB_RIGHT(elm, field); else if (RB_RIGHT(elm, field) == NULL) child = RB_LEFT(elm, field); else { struct type* left; elm = RB_RIGHT(elm, field); while ((left = RB_LEFT(elm, field))) elm = left; child = RB_RIGHT(elm, field); parent = RB_PARENT(elm, field); color = RB_COLOR(elm, field); if (child) RB_PARENT(child, field) = parent; if (parent) { if (RB_LEFT(parent, field) == elm) RB_LEFT(parent, field) = child; else RB_RIGHT(parent, field) = child; RB_AUGMENT(parent); } else RB_ROOT(head) = child; if (RB_PARENT(elm, field) == old) parent = elm; (elm)->field = (old)->field; if (RB_PARENT(old, field)) { if (RB_LEFT(RB_PARENT(old, field), field) == old) RB_LEFT(RB_PARENT(old, field), field) = elm; else RB_RIGHT(RB_PARENT(old, field), field) = elm; RB_AUGMENT(RB_PARENT(old, field)); } else RB_ROOT(head) = elm; RB_PARENT(RB_LEFT(old, field), field) = elm; if (RB_RIGHT(old, field)) RB_PARENT(RB_RIGHT(old, field), field) = elm; if (parent) { left = parent; do { RB_AUGMENT(left); } while ((left = RB_PARENT(left, field))); } goto color; } parent = RB_PARENT(elm, field); color = RB_COLOR(elm, field); if (child) RB_PARENT(child, field) = parent; if (parent) { if (RB_LEFT(parent, field) == elm) RB_LEFT(parent, field) = child; else RB_RIGHT(parent, field) = child; RB_AUGMENT(parent); } else RB_ROOT(head) = child; color: if (color == RB_BLACK) name##_RB_REMOVE_COLOR(head, parent, child); return (old); } /* Inserts a node into the RB tree */ attr struct type* name##_RB_INSERT(struct name* head, struct type* elm) { struct type* tmp; struct type* parent = NULL; int comp = 0; tmp = RB_ROOT(head); while (tmp) { parent = tmp; comp = (cmp)(elm, parent); if (comp < 0) tmp = RB_LEFT(tmp, field); else if (comp > 0) tmp = RB_RIGHT(tmp, field); else return (tmp); } RB_SET(elm, parent, field); if (parent != NULL) { if (comp < 0) RB_LEFT(parent, field) = elm; else RB_RIGHT(parent, field) = elm; RB_AUGMENT(parent); } else RB_ROOT(head) = elm; name##_RB_INSERT_COLOR(head, elm); return (NULL); } /* Finds the node with the same key as elm */ attr struct type* name##_RB_FIND(struct name* head, struct type* elm) { struct type* tmp = RB_ROOT(head); int comp; while (tmp) { comp = cmp(elm, tmp); if (comp < 0) tmp = RB_LEFT(tmp, field); else if (comp > 0) tmp = RB_RIGHT(tmp, field); else return (tmp); } return (NULL); } /* Finds the first node greater than or equal to the search key */ attr struct type* name##_RB_NFIND(struct name* head, struct type* elm) { struct type* tmp = RB_ROOT(head); struct type* res = NULL; int comp; while (tmp) { comp = cmp(elm, tmp); if (comp < 0) { res = tmp; tmp = RB_LEFT(tmp, field); } else if (comp > 0) tmp = RB_RIGHT(tmp, field); else return (tmp); } return (res); } /* ARGSUSED */ attr struct type* name##_RB_NEXT(struct type* elm) { if (RB_RIGHT(elm, field)) { elm = RB_RIGHT(elm, field); while (RB_LEFT(elm, field)) elm = RB_LEFT(elm, field); } else { if (RB_PARENT(elm, field) && (elm == RB_LEFT(RB_PARENT(elm, field), field))) elm = RB_PARENT(elm, field); else { while (RB_PARENT(elm, field) && (elm == RB_RIGHT(RB_PARENT(elm, field), field))) elm = RB_PARENT(elm, field); elm = RB_PARENT(elm, field); } } return (elm); } /* ARGSUSED */ attr struct type* name##_RB_PREV(struct type* elm) { if (RB_LEFT(elm, field)) { elm = RB_LEFT(elm, field); while (RB_RIGHT(elm, field)) elm = RB_RIGHT(elm, field); } else { if (RB_PARENT(elm, field) && (elm == RB_RIGHT(RB_PARENT(elm, field), field))) elm = RB_PARENT(elm, field); else { while (RB_PARENT(elm, field) && (elm == RB_LEFT(RB_PARENT(elm, field), field))) elm = RB_PARENT(elm, field); elm = RB_PARENT(elm, field); } } return (elm); } attr struct type* name##_RB_MINMAX(struct name* head, int val) { struct type* tmp = RB_ROOT(head); struct type* parent = NULL; while (tmp) { parent = tmp; if (val < 0) tmp = RB_LEFT(tmp, field); else tmp = RB_RIGHT(tmp, field); } return (parent); }
enum RB_NEGINF = -1;
enum RB_INF = 1;
//#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y)
//#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y)
//#define RB_FIND(name, x, y) name##_RB_FIND(x, y)
//#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y)
//#define RB_NEXT(name, x, y) name##_RB_NEXT(y)
//#define RB_PREV(name, x, y) name##_RB_PREV(y)
//#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF)
//#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF)
//#define RB_FOREACH(x, name, head) for ((x) = RB_MIN(name, head); (x) != NULL; (x) = name##_RB_NEXT(x))
//#define RB_FOREACH_SAFE(x, name, head, y) for ((x) = RB_MIN(name, head); ((x) != NULL) && ((y) = name##_RB_NEXT(x), 1); (x) = (y))
//#define RB_FOREACH_REVERSE(x, name, head) for ((x) = RB_MAX(name, head); (x) != NULL; (x) = name##_RB_PREV(x))
//#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) for ((x) = RB_MAX(name, head); ((x) != NULL) && ((y) = name##_RB_PREV(x), 1); (x) = (y))
/*
* Copyright (c) 2016 David Gwynne <dlg@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
struct rb_type
{
int function(const (void)*, const (void)*) t_compare;
void function(void*) t_augment;
/**
* offset of rb_entry in type
*/
uint t_offset;
}
struct rb_tree
{
.rb_entry* rbt_root;
}
struct rb_entry
{
.rb_entry* rbt_parent;
.rb_entry* rbt_left;
.rb_entry* rbt_right;
uint rbt_color;
}
//#define RBT_HEAD(_name, _type) struct _name { struct rb_tree rbh_root; }
//#define RBT_ENTRY(_type) struct rb_entry
pragma(inline, true)
pure nothrow @trusted @nogc @live
static void _rb_init(.rb_tree* rbt)
in
{
assert(rbt != null);
}
do
{
rbt.rbt_root = null;
}
pragma(inline, true)
pure nothrow @trusted @nogc @live
static int _rb_empty(.rb_tree* rbt)
in
{
assert(rbt != null);
}
do
{
return rbt.rbt_root == null;
}
void* _rb_insert(const (.rb_type)*, .rb_tree*, void*);
void* _rb_remove(const (.rb_type)*, .rb_tree*, void*);
void* _rb_find(const (.rb_type)*, .rb_tree*, const (void)*);
void* _rb_nfind(const (.rb_type)*, .rb_tree*, const (void)*);
void* _rb_root(const (.rb_type)*, .rb_tree*);
void* _rb_min(const (.rb_type)*, .rb_tree*);
void* _rb_max(const (.rb_type)*, .rb_tree*);
void* _rb_next(const (.rb_type)*, void*);
void* _rb_prev(const (.rb_type)*, void*);
void* _rb_left(const (.rb_type)*, void*);
void* _rb_right(const (.rb_type)*, void*);
void* _rb_parent(const (.rb_type)*, void*);
void _rb_set_left(const (.rb_type)*, void*, void*);
void _rb_set_right(const (.rb_type)*, void*, void*);
void _rb_set_parent(const (.rb_type)*, void*, void*);
void _rb_poison(const (.rb_type)*, void*, core.stdc.config.c_ulong);
int _rb_check(const (.rb_type)*, void*, core.stdc.config.c_ulong);
//#define RBT_INITIALIZER(_head) { { NULL } }
//#define RBT_PROTOTYPE(_name, _type, _field, _cmp) extern const struct rb_type* const _name##_RBT_TYPE; __unused static inline void _name##_RBT_INIT(struct _name* head) { _rb_init(&head->rbh_root); } __unused static inline struct _type* _name##_RBT_INSERT(struct _name* head, struct _type* elm) { return _rb_insert(_name##_RBT_TYPE, &head->rbh_root, elm); } __unused static inline struct _type* _name##_RBT_REMOVE(struct _name* head, struct _type* elm) { return _rb_remove(_name##_RBT_TYPE, &head->rbh_root, elm); } __unused static inline struct _type* _name##_RBT_FIND(struct _name* head, const struct _type* key) { return _rb_find(_name##_RBT_TYPE, &head->rbh_root, key); } __unused static inline struct _type* _name##_RBT_NFIND(struct _name* head, const struct _type* key) { return _rb_nfind(_name##_RBT_TYPE, &head->rbh_root, key); } __unused static inline struct _type* _name##_RBT_ROOT(struct _name* head) { return _rb_root(_name##_RBT_TYPE, &head->rbh_root); } __unused static inline int _name##_RBT_EMPTY(struct _name* head) { return _rb_empty(&head->rbh_root); } __unused static inline struct _type* _name##_RBT_MIN(struct _name* head) { return _rb_min(_name##_RBT_TYPE, &head->rbh_root); } __unused static inline struct _type* _name##_RBT_MAX(struct _name* head) { return _rb_max(_name##_RBT_TYPE, &head->rbh_root); } __unused static inline struct _type* _name##_RBT_NEXT(struct _type* elm) { return _rb_next(_name##_RBT_TYPE, elm); } __unused static inline struct _type* _name##_RBT_PREV(struct _type* elm) { return _rb_prev(_name##_RBT_TYPE, elm); } __unused static inline struct _type* _name##_RBT_LEFT(struct _type* elm) { return _rb_left(_name##_RBT_TYPE, elm); } __unused static inline struct _type* _name##_RBT_RIGHT(struct _type* elm) { return _rb_right(_name##_RBT_TYPE, elm); } __unused static inline struct _type* _name##_RBT_PARENT(struct _type* elm) { return _rb_parent(_name##_RBT_TYPE, elm); } __unused static inline void _name##_RBT_SET_LEFT(struct _type* elm, struct _type* left) { return _rb_set_left(_name##_RBT_TYPE, elm, left); } __unused static inline void _name##_RBT_SET_RIGHT(struct _type* elm, struct _type* right) { return _rb_set_right(_name##_RBT_TYPE, elm, right); } __unused static inline void _name##_RBT_SET_PARENT(struct _type* elm, struct _type* parent) { return _rb_set_parent(_name##_RBT_TYPE, elm, parent); } __unused static inline void _name##_RBT_POISON(struct _type* elm, unsigned long poison) { return _rb_poison(_name##_RBT_TYPE, elm, poison); } __unused static inline int _name##_RBT_CHECK(struct _type* elm, unsigned long poison) { return _rb_check(_name##_RBT_TYPE, elm, poison); }
//#define RBT_GENERATE_INTERNAL(_name, _type, _field, _cmp, _aug) static int _name##_RBT_COMPARE(const void* lptr, const void* rptr) { const struct _type *l = lptr, *r = rptr; return _cmp(l, r); } static const struct rb_type _name##_RBT_INFO = { _name##_RBT_COMPARE, _aug, offsetof(struct _type, _field), }; const struct rb_type* const _name##_RBT_TYPE = &_name##_RBT_INFO
//#define RBT_GENERATE_AUGMENT(_name, _type, _field, _cmp, _aug) static void _name##_RBT_AUGMENT(void* ptr) { struct _type* p = ptr; return _aug(p); } RBT_GENERATE_INTERNAL(_name, _type, _field, _cmp, _name##_RBT_AUGMENT)
//#define RBT_GENERATE(_name, _type, _field, _cmp) RBT_GENERATE_INTERNAL(_name, _type, _field, _cmp, NULL)
//#define RBT_INIT(_name, _head) _name##_RBT_INIT(_head)
//#define RBT_INSERT(_name, _head, _elm) _name##_RBT_INSERT(_head, _elm)
//#define RBT_REMOVE(_name, _head, _elm) _name##_RBT_REMOVE(_head, _elm)
//#define RBT_FIND(_name, _head, _key) _name##_RBT_FIND(_head, _key)
//#define RBT_NFIND(_name, _head, _key) _name##_RBT_NFIND(_head, _key)
//#define RBT_ROOT(_name, _head) _name##_RBT_ROOT(_head)
//#define RBT_EMPTY(_name, _head) _name##_RBT_EMPTY(_head)
//#define RBT_MIN(_name, _head) _name##_RBT_MIN(_head)
//#define RBT_MAX(_name, _head) _name##_RBT_MAX(_head)
//#define RBT_NEXT(_name, _elm) _name##_RBT_NEXT(_elm)
//#define RBT_PREV(_name, _elm) _name##_RBT_PREV(_elm)
//#define RBT_LEFT(_name, _elm) _name##_RBT_LEFT(_elm)
//#define RBT_RIGHT(_name, _elm) _name##_RBT_RIGHT(_elm)
//#define RBT_PARENT(_name, _elm) _name##_RBT_PARENT(_elm)
//#define RBT_SET_LEFT(_name, _elm, _l) _name##_RBT_SET_LEFT(_elm, _l)
//#define RBT_SET_RIGHT(_name, _elm, _r) _name##_RBT_SET_RIGHT(_elm, _r)
//#define RBT_SET_PARENT(_name, _elm, _p) _name##_RBT_SET_PARENT(_elm, _p)
//#define RBT_POISON(_name, _elm, _p) _name##_RBT_POISON(_elm, _p)
//#define RBT_CHECK(_name, _elm, _p) _name##_RBT_CHECK(_elm, _p)
//#define RBT_FOREACH(_e, _name, _head) for ((_e) = RBT_MIN(_name, (_head)); (_e) != NULL; (_e) = RBT_NEXT(_name, (_e)))
//#define RBT_FOREACH_SAFE(_e, _name, _head, _n) for ((_e) = RBT_MIN(_name, (_head)); (_e) != NULL && ((_n) = RBT_NEXT(_name, (_e)), 1); (_e) = (_n))
//#define RBT_FOREACH_REVERSE(_e, _name, _head) for ((_e) = RBT_MAX(_name, (_head)); (_e) != NULL; (_e) = RBT_PREV(_name, (_e)))
//#define RBT_FOREACH_REVERSE_SAFE(_e, _name, _head, _n) for ((_e) = RBT_MAX(_name, (_head)); (_e) != NULL && ((_n) = RBT_PREV(_name, (_e)), 1); (_e) = (_n))
|
D
|
module dman.config;
import dyaml;
version (Have_unit_threaded)
{
import unit_threaded;
}
import dman.util;
enum isConfig(C) = mixin(generateIsSpec(
"C",
"read!int :: string -> int
fetch!int :: string, int -> int
write :: string, int"
));
struct DefaultConfig
{
static assert(isConfig!DefaultConfig);
Node rootNode;
this(Node rootNode) @safe
{
this.rootNode = rootNode;
}
this(in string fileName) @safe
{
rootNode = Loader(fileName).load();
}
static DefaultConfig fromString(in string yaml) @safe
{
return DefaultConfig(Loader.fromString(yaml.dup).load());
}
T read(T = Node)(in string key) @safe
{
import std.algorithm.iteration : splitter;
import std.traits : fullyQualifiedName;
auto node = rootNode;
foreach (part; splitter(key, ".")) {
node = node[part];
}
static if (is(T : Node)) {
return node;
} else {
assert(
node.convertsTo!T,
"the given type `" ~ fullyQualifiedName!T ~
"` cannot be converted to the node's type `" ~ node.nodeTypeString ~ "`."
);
return node.as!(T);
}
}
T fetch(T = Node)(in string key, lazy T defaultValue) @safe
{
import std.exception : ifThrown;
return read!T(key).ifThrown!NodeException(defaultValue);
}
void write(T)(in string key, T value) @trusted
{
import std.algorithm.iteration : splitter;
auto node = &rootNode;
foreach (part; splitter(key, ".")) {
if (!node.containsKey(part)) {
// the lambda is just so the correct overload is taken (make node as mapping)
(*node)[part] = Node({ Node[string] placeholder; return placeholder; }());
}
node = &((*node)[part]);
}
*node = Node(value);
}
/* ---------- Unittests ---------- */
version (Have_unit_threaded)
{
@("test reading") @safe unittest
{
import core.exception : AssertError;
auto c = DefaultConfig.fromString(
"---\n" ~
"a: 1 \n" ~
"b: hello\n" ~
"c: 3.14 \n" ~
"d: \n" ~
" e: foo"
);
// Can read simple keys
c.read!int("a").shouldEqual(1);
c.read!string("b").shouldEqual("hello");
c.read!real("c").shouldApproxEqual(3.14);
// Can read nested keys
c.read!string("d.e").shouldEqual("foo");
// Defaults to Node
typeid(c.read("d")).shouldEqual(typeid(Node));
// Throws AssertError on mismatched types
c.read!int("b").shouldThrowExactly!(AssertError);
}
@("test fetching") @safe unittest
{
import core.exception : AssertError;
auto c = DefaultConfig.fromString("---\na: hi");
// Can read existing keys
c.fetch!string("a", "hmm").shouldEqual("hi");
// Falls back to default when the key doesn't exist
c.fetch!int("b", 756).shouldEqual(756);
// Still throws AssertError on mismatched types
c.fetch!int("a", 0).shouldThrowExactly!(AssertError);
}
@("test writing") @system unittest
{
auto c = DefaultConfig.fromString("---\na: 123");
// Can write to simple keys
c.write("b", 321).shouldNotThrow();
c.rootNode["b"].shouldNotThrow();
c.rootNode["b"].as!(int).shouldEqual(321);
// Can write to nested keys
c.write("foo.bar", "hello").shouldNotThrow();
c.rootNode["foo"].shouldNotThrow();
c.rootNode["foo"]["bar"].shouldNotThrow();
c.rootNode["foo"]["bar"].as!(string).shouldEqual("hello");
// Can overwrite previously existing keys
c.rootNode["a"].as!(int).shouldEqual(123);
c.write("a", 3.14);
c.rootNode["a"].as!(real).shouldApproxEqual(3.14);
}
}
}
|
D
|
<?xml version="1.0" encoding="UTF-8"?>
<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
<pageList>
<availablePage>
<emfPageIdentifier href="classRealizationInterface.notation#_-_PzkDgeEeO8_ajv-jc4XQ"/>
</availablePage>
</pageList>
<sashModel currentSelection="//@sashModel/@windows.0/@children.0">
<windows>
<children xsi:type="di:TabFolder">
<children>
<emfPageIdentifier href="classRealizationInterface.notation#_-_PzkDgeEeO8_ajv-jc4XQ"/>
</children>
</children>
</windows>
</sashModel>
</di:SashWindowsMngr>
|
D
|
(of goods or funds) subject to taxation
|
D
|
instance SLD_816_FESTER(NPC_DEFAULT)
{
name[0] = "Фестер";
guild = GIL_SLD;
id = 816;
voice = 8;
flags = 0;
npctype = NPCTYPE_FRIEND;
b_setattributestochapter(self,1);
fight_tactic = FAI_HUMAN_NORMAL;
EquipItem(self,itmw_1h_sld_axe);
EquipItem(self,itrw_sld_bow);
CreateInvItems(self,itrw_arrow,10);
b_createambientinv(self);
b_setnpcvisual(self,MALE,"Hum_Head_FatBald",FACE_N_NORMALBART05,BODYTEX_N,itar_sld_l);
Mdl_SetModelFatness(self,1);
Mdl_ApplyOverlayMds(self,"Humans_Relaxed.mds");
b_givenpctalents(self);
b_setfightskills(self,30);
b_addfightskill(self,NPC_TALENT_BOW,30);
daily_routine = rtn_start_816;
};
func void rtn_start_816()
{
ta_practice_sword(5,0,6,0,"NW_BIGFARM_ALLEE_04");
ta_practice_sword(6,0,7,0,"NW_BIGFARM_ALLEE_02");
ta_practice_sword(7,0,8,0,"NW_BIGFARM_ALLEE_04");
ta_practice_sword(8,0,9,0,"NW_BIGFARM_ALLEE_02");
ta_practice_sword(9,0,10,0,"NW_BIGFARM_ALLEE_04");
ta_practice_sword(10,0,11,0,"NW_BIGFARM_ALLEE_02");
ta_practice_sword(11,0,12,0,"NW_BIGFARM_ALLEE_04");
ta_practice_sword(12,0,13,0,"NW_BIGFARM_ALLEE_02");
ta_practice_sword(13,0,14,0,"NW_BIGFARM_ALLEE_04");
ta_practice_sword(14,0,15,0,"NW_BIGFARM_ALLEE_02");
ta_practice_sword(15,0,16,0,"NW_BIGFARM_ALLEE_04");
ta_practice_sword(16,0,17,0,"NW_BIGFARM_ALLEE_02");
ta_practice_sword(17,0,18,0,"NW_BIGFARM_ALLEE_04");
ta_practice_sword(18,0,19,0,"NW_BIGFARM_ALLEE_02");
ta_practice_sword(19,0,20,0,"NW_BIGFARM_ALLEE_04");
ta_sit_campfire(20,0,6,0,"NW_BIGFARM_VORPOSTEN1_01");
};
func void rtn_guide_816()
{
ta_guide_player(8,0,20,0,"NW_BIGFARM_FELDREUBER4");
ta_guide_player(20,0,8,0,"NW_BIGFARM_FELDREUBER4");
};
|
D
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.